From b0aceee9a7e04f89d64d87c75e0a9489d3454f17 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Fri, 2 Oct 2026 11:50:58 -0700 Subject: [PATCH 1/3] Prepare offered profiles once and adopt component generations per worker --- amplifier_web/bundles.py | 21 +- amplifier_web/generation_leases.py | 39 ++ amplifier_web/host/config.py | 4 +- amplifier_web/host/session.py | 51 ++- amplifier_web/runtime.py | 68 +++- amplifier_web/runtime_profiles.py | 317 +++++++++++++++ amplifier_web/runtime_qualification.py | 28 +- amplifier_web/runtime_retention.py | 20 +- amplifier_web/service.py | 4 + ...Zo.js => abnfDiagram-VCTEODGH-Bfs8g8Bc.js} | 2 +- .../{app-W22-ExtL.js => app-zsnl1T1T.js} | 280 +++++++------- .../{arc-DXFEdbiI.js => arc-CxD3pp7w.js} | 2 +- ... architectureDiagram-5GKGNRK7-BMtIY0MM.js} | 2 +- ...q.js => blockDiagram-I7D4REHJ-JIRyk-UT.js} | 2 +- ...5Gsa.js => c4Diagram-7LVT6UL2-DdetwEv8.js} | 2 +- .../static/assets/channel-BqsL4B4X.js | 1 - .../static/assets/channel-CSv1n6Zd.js | 1 + ...CLX5dmV-.js => chunk-2Q5K7J3B-DR5XPUmF.js} | 2 +- ...DlVFuaV7.js => chunk-5VM5RSS4-XkKVGNmc.js} | 2 +- ...D9qW0VD2.js => chunk-F27PBJKO-35QGDevQ.js} | 2 +- ...CF8hlUB5.js => chunk-IMKFNOWR-D_IoXv7y.js} | 2 +- ...DxHQQjxU.js => chunk-JWPE2WC7-wq4F1yC9.js} | 2 +- ...fljvmLmW.js => chunk-POPQ4Y6H-C_hQ_kWj.js} | 2 +- ...BBG-Pp77.js => chunk-SVP7TREG-DegBQCYH.js} | 2 +- ...DG6NUFQe.js => chunk-TICWLB2K--YXzYqRv.js} | 2 +- ...BvgnYF8f.js => chunk-XXDRQBXY-DdE0HtLo.js} | 2 +- .../assets/classDiagram-ZZMXUADV-D0wKCQxK.js | 1 + .../assets/classDiagram-ZZMXUADV-Deegt-EK.js | 1 - .../classDiagram-v2-VYDZK3BY-D0wKCQxK.js | 1 + .../classDiagram-v2-VYDZK3BY-Deegt-EK.js | 1 - ...1.js => cose-bilkent-JH36ORCC-BYWhn9Rv.js} | 2 +- ...uqA1Xc.js => cynefin-OW5HDTMX-C5aohCXI.js} | 2 +- ...js => cynefinDiagram-5FMLGOSQ-T6cXmRvG.js} | 2 +- ...BPre4f4O.js => dagre-GXQ25YYZ-DqSq41IB.js} | 2 +- ...8K541U.js => diagram-S7CK7UJ4-Bhn2u9og.js} | 2 +- ...4fy4x0.js => diagram-UQ7AKVKN-CsDpBRwj.js} | 2 +- ...T7N-mF.js => diagram-VSXAHHWV-BPFQwR9c.js} | 2 +- ...jjslPi.js => diagram-VX7I27RA-DYKyI2lv.js} | 2 +- ...O8xWsb.js => diagram-Z3DM3KII-C7wRZKVi.js} | 2 +- ...Y1.js => ebnfDiagram-PWID7BFC-CsupTakH.js} | 2 +- ...q6f8.js => erDiagram-RLTQ6QDP-DV4h776D.js} | 2 +- ...V6.js => flowDiagram-HODETNUW-Bfis7KwQ.js} | 2 +- ...d.js => ganttDiagram-EL5Y4UJY-BU9eWm2s.js} | 2 +- ...s => gitGraphDiagram-WWUBYQGX-BkBjc4gg.js} | 2 +- ...gt.js => infoDiagram-27XIBGKW-D1rVSJoO.js} | 2 +- ...s => ishikawaDiagram-5VMMS53U-B42RhGud.js} | 2 +- ...js => journeyDiagram-3NMN7TZE-CkgASPQL.js} | 2 +- ...=> kanban-definition-UXKFOSKX-C_T9GYcq.js} | 2 +- ...{layout-KwbWDr7K.js => layout-xx7K6ykp.js} | 2 +- ...{linear-DE4AveAz.js => linear-BcEdwvr4.js} | 2 +- ...e-CDlaSEyP.js => mermaid.core-BQ5lTCZr.js} | 10 +- ...> mindmap-definition-YA3MSWOX-CnwxkU_o.js} | 2 +- ...hPF.js => pegDiagram-XKGWAZYB-C77gkBP1.js} | 2 +- ...EFW.js => pieDiagram-E7YTZNPT-DYkXhOYb.js} | 2 +- ...s => quadrantDiagram-AXDQQJYC-DHRSmvLk.js} | 2 +- ...s => railroadDiagram-O6MQD6OU-ByMdCyuE.js} | 2 +- ...> requirementDiagram-BXWQKSXE-DEA-5bvx.js} | 2 +- ....js => sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js} | 2 +- ...s => sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js} | 2 +- ...98.js => sizeCapture-INFHLROL-CKc8uScH.js} | 2 +- ...k.js => stateDiagram-D77RDMKH-sy7Rfo0f.js} | 2 +- .../stateDiagram-v2-MP3YSRHH-BRTKjL6-.js | 1 + .../stateDiagram-v2-MP3YSRHH-CFM38Jht.js | 1 - ...-11t.js => swimlanes-42K2YHIH-1QzInuS-.js} | 2 +- .../swimlanesDiagram-VR7AAH4N-CLgWPzHj.js | 8 + .../swimlanesDiagram-VR7AAH4N-DNn1qeTZ.js | 8 - ... timeline-definition-24CTP7MA-Ck5GR00U.js} | 2 +- ...y0.js => vennDiagram-4TSXK5OY-kVi8iDPL.js} | 2 +- ...js => wardleyDiagram-VM6X3IG4-xeAzTPpE.js} | 2 +- ...js => xychartDiagram-S5SC5T6Z-DF_x_q58.js} | 2 +- amplifier_web/static/build.json | 2 +- amplifier_web/static/index.html | 2 +- amplifier_web/update_diagnostics.py | 3 +- amplifier_web/update_inventory_index.py | 92 +++++ amplifier_web/update_plan.py | 142 +++++++ amplifier_web/update_probe.py | 22 +- amplifier_web/update_retention.py | 41 +- amplifier_web/updates.py | 154 ++++++-- docs/UPDATES.md | 14 +- frontend/src/update-overview.js | 3 +- frontend/src/updates.jsx | 5 +- frontend/tests/updates.test.mjs | 4 +- tests/conftest.py | 1 + tests/test_runtime_qualification.py | 36 +- tests/test_update_generations.py | 363 ++++++++++++++++++ tests/test_update_readiness.py | 2 +- tests/test_update_retention.py | 25 ++ tests/test_update_sequence.py | 6 +- tests/test_updates.py | 4 +- 89 files changed, 1559 insertions(+), 326 deletions(-) create mode 100644 amplifier_web/generation_leases.py create mode 100644 amplifier_web/runtime_profiles.py rename amplifier_web/static/assets/{abnfDiagram-VCTEODGH-IIquwGZo.js => abnfDiagram-VCTEODGH-Bfs8g8Bc.js} (86%) rename amplifier_web/static/assets/{app-W22-ExtL.js => app-zsnl1T1T.js} (51%) rename amplifier_web/static/assets/{arc-DXFEdbiI.js => arc-CxD3pp7w.js} (98%) rename amplifier_web/static/assets/{architectureDiagram-5GKGNRK7-Bn5yUOBZ.js => architectureDiagram-5GKGNRK7-BMtIY0MM.js} (99%) rename amplifier_web/static/assets/{blockDiagram-I7D4REHJ-BfemG4eq.js => blockDiagram-I7D4REHJ-JIRyk-UT.js} (99%) rename amplifier_web/static/assets/{c4Diagram-7LVT6UL2-Q9nf5Gsa.js => c4Diagram-7LVT6UL2-DdetwEv8.js} (99%) delete mode 100644 amplifier_web/static/assets/channel-BqsL4B4X.js create mode 100644 amplifier_web/static/assets/channel-CSv1n6Zd.js rename amplifier_web/static/assets/{chunk-2Q5K7J3B-CLX5dmV-.js => chunk-2Q5K7J3B-DR5XPUmF.js} (66%) rename amplifier_web/static/assets/{chunk-5VM5RSS4-DlVFuaV7.js => chunk-5VM5RSS4-XkKVGNmc.js} (83%) rename amplifier_web/static/assets/{chunk-F27PBJKO-D9qW0VD2.js => chunk-F27PBJKO-35QGDevQ.js} (96%) rename amplifier_web/static/assets/{chunk-IMKFNOWR-CF8hlUB5.js => chunk-IMKFNOWR-D_IoXv7y.js} (99%) rename amplifier_web/static/assets/{chunk-JWPE2WC7-DxHQQjxU.js => chunk-JWPE2WC7-wq4F1yC9.js} (78%) rename amplifier_web/static/assets/{chunk-POPQ4Y6H-fljvmLmW.js => chunk-POPQ4Y6H-C_hQ_kWj.js} (87%) rename amplifier_web/static/assets/{chunk-SVP7TREG-BBG-Pp77.js => chunk-SVP7TREG-DegBQCYH.js} (99%) rename amplifier_web/static/assets/{chunk-TICWLB2K-DG6NUFQe.js => chunk-TICWLB2K--YXzYqRv.js} (99%) rename amplifier_web/static/assets/{chunk-XXDRQBXY-BvgnYF8f.js => chunk-XXDRQBXY-DdE0HtLo.js} (72%) create mode 100644 amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js delete mode 100644 amplifier_web/static/assets/classDiagram-ZZMXUADV-Deegt-EK.js create mode 100644 amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js delete mode 100644 amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-Deegt-EK.js rename amplifier_web/static/assets/{cose-bilkent-JH36ORCC-C7XBKZ-1.js => cose-bilkent-JH36ORCC-BYWhn9Rv.js} (99%) rename amplifier_web/static/assets/{cynefin-OW5HDTMX-BZuqA1Xc.js => cynefin-OW5HDTMX-C5aohCXI.js} (99%) rename amplifier_web/static/assets/{cynefinDiagram-5FMLGOSQ-Bc7uv2gD.js => cynefinDiagram-5FMLGOSQ-T6cXmRvG.js} (98%) rename amplifier_web/static/assets/{dagre-GXQ25YYZ-BPre4f4O.js => dagre-GXQ25YYZ-DqSq41IB.js} (98%) rename amplifier_web/static/assets/{diagram-S7CK7UJ4-BS8K541U.js => diagram-S7CK7UJ4-Bhn2u9og.js} (96%) rename amplifier_web/static/assets/{diagram-UQ7AKVKN-C84fy4x0.js => diagram-UQ7AKVKN-CsDpBRwj.js} (95%) rename amplifier_web/static/assets/{diagram-VSXAHHWV-BrT7N-mF.js => diagram-VSXAHHWV-BPFQwR9c.js} (98%) rename amplifier_web/static/assets/{diagram-VX7I27RA-DnjjslPi.js => diagram-VX7I27RA-DYKyI2lv.js} (98%) rename amplifier_web/static/assets/{diagram-Z3DM3KII-CCO8xWsb.js => diagram-Z3DM3KII-C7wRZKVi.js} (94%) rename amplifier_web/static/assets/{ebnfDiagram-PWID7BFC-HFPcjqY1.js => ebnfDiagram-PWID7BFC-CsupTakH.js} (87%) rename amplifier_web/static/assets/{erDiagram-RLTQ6QDP-D5xxq6f8.js => erDiagram-RLTQ6QDP-DV4h776D.js} (99%) rename amplifier_web/static/assets/{flowDiagram-HODETNUW-DrKzI2V6.js => flowDiagram-HODETNUW-Bfis7KwQ.js} (99%) rename amplifier_web/static/assets/{ganttDiagram-EL5Y4UJY-Djl_xd9d.js => ganttDiagram-EL5Y4UJY-BU9eWm2s.js} (99%) rename amplifier_web/static/assets/{gitGraphDiagram-WWUBYQGX-Bl_uVKdO.js => gitGraphDiagram-WWUBYQGX-BkBjc4gg.js} (99%) rename amplifier_web/static/assets/{infoDiagram-27XIBGKW-B2QKprgt.js => infoDiagram-27XIBGKW-D1rVSJoO.js} (68%) rename amplifier_web/static/assets/{ishikawaDiagram-5VMMS53U-RV6LF1dl.js => ishikawaDiagram-5VMMS53U-B42RhGud.js} (99%) rename amplifier_web/static/assets/{journeyDiagram-3NMN7TZE-DmXdNqni.js => journeyDiagram-3NMN7TZE-CkgASPQL.js} (98%) rename amplifier_web/static/assets/{kanban-definition-UXKFOSKX-CPNlmuSu.js => kanban-definition-UXKFOSKX-C_T9GYcq.js} (99%) rename amplifier_web/static/assets/{layout-KwbWDr7K.js => layout-xx7K6ykp.js} (99%) rename amplifier_web/static/assets/{linear-DE4AveAz.js => linear-BcEdwvr4.js} (98%) rename amplifier_web/static/assets/{mermaid.core-CDlaSEyP.js => mermaid.core-BQ5lTCZr.js} (99%) rename amplifier_web/static/assets/{mindmap-definition-YA3MSWOX-Doia6bAL.js => mindmap-definition-YA3MSWOX-CnwxkU_o.js} (99%) rename amplifier_web/static/assets/{pegDiagram-XKGWAZYB-DCHkihPF.js => pegDiagram-XKGWAZYB-C77gkBP1.js} (87%) rename amplifier_web/static/assets/{pieDiagram-E7YTZNPT-nq59ZEFW.js => pieDiagram-E7YTZNPT-DYkXhOYb.js} (94%) rename amplifier_web/static/assets/{quadrantDiagram-AXDQQJYC-CApaH6GE.js => quadrantDiagram-AXDQQJYC-DHRSmvLk.js} (99%) rename amplifier_web/static/assets/{railroadDiagram-O6MQD6OU-CmYfgBi1.js => railroadDiagram-O6MQD6OU-ByMdCyuE.js} (84%) rename amplifier_web/static/assets/{requirementDiagram-BXWQKSXE-DZ6X4Hg-.js => requirementDiagram-BXWQKSXE-DEA-5bvx.js} (99%) rename amplifier_web/static/assets/{sankeyDiagram-P5KCCOFB-KPy6Sszp.js => sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js} (99%) rename amplifier_web/static/assets/{sequenceDiagram-WJ2MYXX4-DZbP_JPP.js => sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js} (99%) rename amplifier_web/static/assets/{sizeCapture-INFHLROL-tpuKIw98.js => sizeCapture-INFHLROL-CKc8uScH.js} (87%) rename amplifier_web/static/assets/{stateDiagram-D77RDMKH-DYtq5BDk.js => stateDiagram-D77RDMKH-sy7Rfo0f.js} (96%) create mode 100644 amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js delete mode 100644 amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CFM38Jht.js rename amplifier_web/static/assets/{swimlanes-42K2YHIH-Ef_o-11t.js => swimlanes-42K2YHIH-1QzInuS-.js} (99%) create mode 100644 amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js delete mode 100644 amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-DNn1qeTZ.js rename amplifier_web/static/assets/{timeline-definition-24CTP7MA-CD71W6Ad.js => timeline-definition-24CTP7MA-Ck5GR00U.js} (99%) rename amplifier_web/static/assets/{vennDiagram-4TSXK5OY-BWkGFFy0.js => vennDiagram-4TSXK5OY-kVi8iDPL.js} (99%) rename amplifier_web/static/assets/{wardleyDiagram-VM6X3IG4-DixAstWQ.js => wardleyDiagram-VM6X3IG4-xeAzTPpE.js} (99%) rename amplifier_web/static/assets/{xychartDiagram-S5SC5T6Z-DgwC-FOX.js => xychartDiagram-S5SC5T6Z-DF_x_q58.js} (99%) create mode 100644 amplifier_web/update_inventory_index.py create mode 100644 amplifier_web/update_plan.py create mode 100644 tests/test_update_generations.py diff --git a/amplifier_web/bundles.py b/amplifier_web/bundles.py index baf0c3ba2..4bba0f6c4 100644 --- a/amplifier_web/bundles.py +++ b/amplifier_web/bundles.py @@ -176,6 +176,19 @@ def sanitize_export(value, path=(), secrets=None): return copy.deepcopy(value) +def offered_profiles(config, registry=None): + """The picker and updater share one current, app-level profile authority.""" + if registry is None: + path = config.registry_home / 'registry.json' + registry = json.loads(path.read_text()).get('bundles', {}) if path.exists() else {} + available = set(registry) | set(config.registrations) + names = (STANDALONE_PROFILES & available) | set(config.settings.get('bundle', {}).get('added', {})) + entries = BundleManager.entries(config.settings) + disabled = {row.get('name') for row in entries + if row.get('role') == 'standalone' and row.get('enabled') is False} + return sorted(names - disabled) + + class BundleManager: def __init__(self, home: Path, *, store=None): if store is None: @@ -345,13 +358,9 @@ def register(current): # describe an add-on, so neither cache flag admits picker rows. # Source overrides also name dependencies; they are not standalone # registrations. Keep the capability catalog below unfiltered. - available = set(registry) | set(config.registrations) - names = STANDALONE_PROFILES & available - names.update(config.settings.get('bundle', {}).get('added', {})) - - disabled = {row['name'] for row in self.entries(settings) if row.get('role')=='standalone' and row.get('enabled') is False} + names = offered_profiles(config, registry) from .bundle_selection import catalog_entry - catalog = sorted((catalog_entry(name, catalog_metadata(config, registry, name)) for name in names-disabled), + catalog = sorted((catalog_entry(name, catalog_metadata(config, registry, name)) for name in names), key=lambda row: (row['label'].casefold(), row['name'].casefold(), row['name'])) return {"bundles": self.public_entries(settings), "registeredBundles": catalog} def mutate(current): diff --git a/amplifier_web/generation_leases.py b/amplifier_web/generation_leases.py new file mode 100644 index 000000000..53c058e10 --- /dev/null +++ b/amplifier_web/generation_leases.py @@ -0,0 +1,39 @@ +"""Private durable references from live worker processes to source generations.""" + +from __future__ import annotations + +import json +import os +import uuid +from pathlib import Path + + +def acquire(home, generation, pid): + from .host.config import write_private + + path = Path(home) / "updates/worker-leases" / (uuid.uuid4().hex + ".json") + write_private(path, json.dumps({"schema": 1, "generation": generation, "pid": pid})) + return path + + +def references(home): + generations = set() + for path in (Path(home) / "updates/worker-leases").glob("*.json"): + record = json.loads(path.read_text()) + if ( + record.get("schema") != 1 + or type(record.get("pid")) is not int + or record["pid"] <= 0 + ): + raise ValueError("Unrecognized worker lease; storage retained") + try: + os.kill(record["pid"], 0) + except ProcessLookupError: + # Crash recovery: no live holder remains. PID reuse can only retain + # too much storage, never remove a live generation. + path.unlink(missing_ok=True) + continue + except PermissionError: + pass + generations.add(record["generation"]) + return generations diff --git a/amplifier_web/host/config.py b/amplifier_web/host/config.py index 1c6509ec2..16bff9584 100644 --- a/amplifier_web/host/config.py +++ b/amplifier_web/host/config.py @@ -226,14 +226,14 @@ def load_config(workspace, *, home=None, legacy_home=None, session_id=None, glob return read_config(workspace, home=home, shared_home=shared, session_id=session_id, global_only=global_only) -def read_config(workspace, *, home=None, shared_home=None, session_id=None, global_only=False, settings_cache=None): +def read_config(workspace, *, home=None, shared_home=None, session_id=None, global_only=False, settings_cache=None, registry_home=None): """Read runtime settings without loading keys, preparing caches or writing.""" home = Path(home or app_home()).expanduser().resolve() workspace = Path(workspace).expanduser().resolve(strict=True) shared = Path(shared_home or amplifier_home()).expanduser().resolve() settings = read_settings(workspace, shared_home=shared, session_id=session_id, global_only=global_only, cache=settings_cache) from ..updates import foundation_home - registry_home = foundation_home(home) + registry_home = Path(registry_home) if registry_home is not None else foundation_home(home) # Keep explicit app-cache source overrides aligned with the active snapshot. def relocate(value): if isinstance(value, dict): return {k:relocate(v) for k,v in value.items()} diff --git a/amplifier_web/host/session.py b/amplifier_web/host/session.py index 854a26f6b..63913949f 100644 --- a/amplifier_web/host/session.py +++ b/amplifier_web/host/session.py @@ -567,7 +567,24 @@ def take(self, config, bundle, *, execution_workspace=None): return root -async def prepare_dependencies(workspace, *, bundle=None, install_overrides=None): +def apply_runtime_plan(loaded, edited, config, execution_workspace): + from ..runtime_controls import validate_plan + validate_plan(edited) + for key in ("providers", "tools", "hooks"): + if key in edited: + setattr(loaded, key, [{k:v for k,v in row.items() if k != "enabled"} + for row in edited[key] if row.get("enabled", True)]) + for key in ("session", "agents", "context", "instruction"): + if key in edited: + setattr(loaded, key, edited[key]) + loaded = _apply_host_policy(loaded, config, execution_workspace=execution_workspace) + for key in ("providers", "tools", "hooks", "session", "agents"): + if key in edited: + setattr(loaded, key, _expand_module_configuration(getattr(loaded, key))) + return loaded + + +async def prepare_dependencies(workspace, *, bundle=None, install_overrides=None, dependency_batch=None, global_only=False, runtime_plan=None): """Prepare a fresh qualification worker before importing its live runtime. This first probe only installs configured dependencies. A separate process @@ -575,7 +592,7 @@ async def prepare_dependencies(workspace, *, bundle=None, install_overrides=None already imported wheel runtime with an editable cache in one interpreter. No conversation, history store, job recovery or model execution is opened. """ - config = load_config(workspace) + config = load_config(workspace, global_only=global_only) from .config import prepare_registry prepare_registry(config) execution_workspace = Path(config.workspace).expanduser().resolve(strict=True) @@ -583,6 +600,8 @@ async def prepare_dependencies(workspace, *, bundle=None, install_overrides=None _, loaded, _ = await load_root_bundle(config, bundle or config.active_bundle, execution_workspace=execution_workspace) snapshot = is_snapshot(loaded) + if runtime_plan is not None: + loaded = apply_runtime_plan(loaded, runtime_plan, config, execution_workspace) adapted, _ = live_plan(loaded.to_mount_plan()) components = getattr(loaded, '_host_components', None) or required_components() loaded.session = adapted['session'] @@ -590,7 +609,8 @@ async def prepare_dependencies(workspace, *, bundle=None, install_overrides=None components.apply(loaded) from .config import configure_skill_cache configure_skill_cache(loaded, config.registry_home) - await loaded.prepare(strict=True, refresh_dependencies=True, + return await loaded.prepare(strict=True, refresh_dependencies=True, + **({"dependency_batch": dependency_batch} if dependency_batch is not None else {}), **({'install_overrides': Path(install_overrides)} if install_overrides is not None else {}), cache_dir=config.registry_home / 'cache', source_resolver=lambda module, source: module_source(config, snapshot, module, source, components)) @@ -601,7 +621,7 @@ async def prepare_manager(workspace, *, runtime=None, bundle=None, background_de application_host="Amplifier Unified", shared_handle=None, shared_handle_getter=None, shared_snapshot=None, write_guard=None, resolved_root=None, execution_workspace=None, - refresh_dependencies=False, install_overrides=None, qualification_readonly=False, **kwargs): + refresh_dependencies=False, install_overrides=None, qualification_readonly=False, global_only=False, runtime_plan=None, **kwargs): if refresh_dependencies and resume: raise ValueError("Dependency refresh is limited to a new isolated qualification session.") from amplifier_foundation import SessionConfigurator @@ -613,7 +633,7 @@ async def prepare_manager(workspace, *, runtime=None, bundle=None, background_de from .storage import SessionStore runtime = runtime or Runtime() - config = load_config(workspace, session_id=runtime.session_id) + config = load_config(workspace, session_id=runtime.session_id, global_only=global_only) from .config import prepare_registry prepare_registry(config) # Registry/cache ownership is passed explicitly below. AMPLIFIER_HOME must @@ -663,22 +683,11 @@ def legacy_value(name, default=None): registry, loaded, chosen = (resolved_root.take(config, chosen, execution_workspace=execution_workspace) if resolved_root is not None else await load_root_bundle(config, chosen, execution_workspace=execution_workspace)) snapshot = is_snapshot(loaded) - from ..runtime_controls import override_path, validate_plan + from ..runtime_controls import override_path edited_path = override_path(runtime.session_id) - if edited_path.exists(): - edited = json.loads(edited_path.read_text()) - validate_plan(edited) - for key in ("providers", "tools", "hooks"): - if key in edited: - setattr(loaded, key, [{k:v for k,v in row.items() if k != "enabled"} - for row in edited[key] if row.get("enabled", True)]) - for key in ("session", "agents", "context", "instruction"): - if key in edited: - setattr(loaded, key, edited[key]) - loaded = _apply_host_policy(loaded, config, execution_workspace=execution_workspace) - for key in ("providers", "tools", "hooks", "session", "agents"): - if key in edited: - setattr(loaded, key, _expand_module_configuration(getattr(loaded, key))) + if runtime_plan is not None or edited_path.exists(): + edited = runtime_plan if runtime_plan is not None else json.loads(edited_path.read_text()) + loaded = apply_runtime_plan(loaded, edited, config, execution_workspace) if not snapshot: from .mentions import include_instruction_files loaded = include_instruction_files(loaded) @@ -712,7 +721,7 @@ def progress(action, detail): preparation_policy["install_overrides"] = Path(install_overrides) # Activate modules from the same generation as the bundle registry. The # shared AMPLIFIER_HOME still owns history/settings, not app module caches. - prepared = await loaded.prepare(strict=True, install_deps=not qualification_readonly, **preparation_policy, + prepared = await loaded.prepare(strict=True, install_deps=not (qualification_readonly or os.environ.get("AMPLIFIER_RUNTIME_IMMUTABLE") == "1"), **preparation_policy, cache_dir=config.registry_home / "cache", source_resolver=lambda module, source: module_source(config, snapshot, module, source, components), progress_callback=progress) diff --git a/amplifier_web/runtime.py b/amplifier_web/runtime.py index a05d58b34..15c57a755 100644 --- a/amplifier_web/runtime.py +++ b/amplifier_web/runtime.py @@ -19,6 +19,8 @@ from .runtime_protocol import MAX_MESSAGE_BYTES, encode_message +_CURRENT_GENERATION = object() + Emitter = Callable[[str, dict], Awaitable[None]] class RuntimeOperationPending(RuntimeError): @@ -158,6 +160,7 @@ def __init__(self, app_bridge=None, *, command=None, startup_timeout=600, progre self._closed = False self._retired = {} self._execution_state = None + self.home = None from .runtime_retention import WorkerRetention self.retention = WorkerRetention(self, retention) @@ -186,6 +189,23 @@ def has_pending_operations(self): for row in self.workers.values() ) + def promote_generation(self, generation, *, protected=None): + """A host promotion changes future starts, never mounted code in place. + + Old workers remain leased until their own park/retire handshake proves + there are no active jobs, approvals, queued inputs or uncertain effects. + This boundary is usable by future host/agent protocol adapters as well. + """ + self.retention.protected = protected or (lambda sid: False) + for sid, row in self.workers.items(): + row['update_pending'] = row.get('generation') != generation + self.retention.wake() + + def generation_usage(self): + return [{'sessionId': sid, 'generation': row.get('generation'), + 'updatePending': bool(row.get('update_pending'))} + for sid, row in self.workers.items() if row['process'].returncode is None] + def configure_retention(self, settings): from .runtime_retention import validate_retention updated = validate_retention(settings) @@ -194,7 +214,7 @@ def configure_retention(self, settings): self.retention.settings = updated self.retention.wake() - def _command(self, release=None, *, home=None): + def _command(self, release=_CURRENT_GENERATION, *, home=None): if self.command: return list(self.command) worker = Path(__file__).with_name("runtime_worker.py") @@ -205,8 +225,8 @@ def _command(self, release=None, *, home=None): # directories may be read-only and uv creates its lock and .venv there. from .updates import active_release from .runtime_environment import prepare_project, receipt_directory - home = Path(home or os.environ.get("AMPLIFIER_WEB_HOME", Path.home() / ".amplifier-unified")) - generation = release if release is not None else active_release(home).get("current") + home = Path(home or self.home or os.environ.get("AMPLIFIER_WEB_HOME", Path.home() / ".amplifier-unified")) + generation = active_release(home).get("current") if release is _CURRENT_GENERATION else release cache = prepare_project(home, generation) recorded = (receipt_directory(home, generation) / 'runtime.lock').exists() return [uv, "run", *(["--locked"] if recorded else []), *(["--no-sync"] if (receipt_directory(home, generation) / "runtime-project.json").exists() else []), "--project", str(cache), "--python", "3.13", "python", str(worker)] @@ -240,6 +260,10 @@ async def _admission(self, sid): pending = stopping elif retirement is not None and not retirement.done(): pending = retirement + elif row and row.get('update_pending') and self.retention.eligible(row) and not self.retention.protected(sid): + # Admission wins races with the periodic retirement sweep. + # Wait for the same acknowledged handshake before new work. + pending = self.retention.schedule(sid, row) else: yield return @@ -271,14 +295,42 @@ async def _start_locked(self, session, emit, *, preserve_emit=False): await emit("runtime.status", {"sessionId": sid, "status": "starting", "phase": "runtime-setup", "detail": "Preparing the pinned Amplifier runtime. First use may install dependencies.", "elapsedSeconds": 0}) from .host.config import worker_environment - proc = await asyncio.create_subprocess_exec(*self._command(), stdin=asyncio.subprocess.PIPE, - stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, limit=MAX_MESSAGE_BYTES, - start_new_session=os.name != "nt", env=worker_environment()) - row = {"process": proc, "emit": emit, "ready": asyncio.get_running_loop().create_future(), + from .updates import active_release + from .host.config import app_home + home = self.home or app_home() + generation = active_release(home).get('current') + from .generation_leases import acquire + reservation = acquire(home, generation, os.getpid()) + source_reservation = None + try: + source_generation = generation + if not self.command: + from .runtime_profiles import ensure + source_generation = await ensure(home, generation, session) + source_reservation = acquire(home, source_generation, os.getpid()) + environment = {**worker_environment(), 'AMPLIFIER_WEB_HOME': str(home), + 'AMPLIFIER_UNIFIED_RELEASE': source_generation or ''} + if source_generation and (Path(home)/'updates/releases'/source_generation/'profiles-qualified.json').exists(): + environment['AMPLIFIER_RUNTIME_IMMUTABLE'] = '1' + proc = await asyncio.create_subprocess_exec(*self._command(source_generation, home=home), stdin=asyncio.subprocess.PIPE, + stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, limit=MAX_MESSAGE_BYTES, + start_new_session=os.name != "nt", env=environment) + try: + lease = acquire(home, source_generation, proc.pid) + except BaseException: + proc.terminate() + await proc.wait() + raise + finally: + reservation.unlink(missing_ok=True) + if source_reservation: + source_reservation.unlink(missing_ok=True) + row = {"process": proc, "emit": emit, "generation": generation, "source_generation": source_generation, "update_pending": generation != active_release(home).get("current"), "ready": asyncio.get_running_loop().create_future(), "pending": {}, "inflight": set(), "inputId": None, "closing": False, "stderr": [], "bridge_tasks": set(), "started_at": time.monotonic(), "phase": "runtime-setup", "detail": "Preparing the pinned Amplifier runtime. First use may install dependencies."} self.workers[sid] = row + row['generation_lease'] = lease row["reader"] = asyncio.create_task(self._read(sid, row)) row["stderr_task"] = asyncio.create_task(self._drain_stderr(row)) row["heartbeat"] = asyncio.create_task(self._progress(sid, row)) @@ -861,6 +913,8 @@ async def _stop_row(self, session_id, row): {"sessionId": session_id, "status": "cold" if row.get("retiring") else "stopped"}) if self.workers.get(session_id) is row: self.workers.pop(session_id, None) + if row.get('generation_lease'): + row['generation_lease'].unlink(missing_ok=True) async def close(self): self._closed = True diff --git a/amplifier_web/runtime_profiles.py b/amplifier_web/runtime_profiles.py new file mode 100644 index 000000000..c632ec4f4 --- /dev/null +++ b/amplifier_web/runtime_profiles.py @@ -0,0 +1,317 @@ +"""Prepare a custom configuration on explicit execution, never while browsing. + +Offered profiles share the qualified app environment. A workspace override gets +its own immutable candidate; it must never pip-install into that shared runtime. +Identical effective configurations share the same prepared environment afterward. +""" + +from __future__ import annotations + +import asyncio +import hashlib +import json +import os +import shutil +import time +import uuid +from pathlib import Path +from types import SimpleNamespace + + +def configuration_key(settings, *roots): + # Provider IDs, keys, models and prompts are runtime values. They must not + # create a new Python graph for every conversation or credential rotation. + from .builtin_behaviors import app_behaviors + + def declarations(value): + if isinstance(value, dict): + return { + key: declarations(item) + for key, item in value.items() + if key not in {"config", "instruction", "context", "id", "instance_id"} + or key == "context" + and isinstance(item, dict) + and "module" in item + } + if isinstance(value, list): + return [declarations(item) for item in value] + return value + + value = { + "sources": settings.get("sources", {}), + "bundles": settings.get("bundle", {}).get("added", {}), + "behaviors": app_behaviors(settings), + "routing": bool(settings.get("routing")), + "modules": declarations(settings.get("config", {})), + "overrides": { + key: row.get("source") + for key, row in settings.get("overrides", {}).items() + if isinstance(row, dict) and row.get("source") + }, + } + text = json.dumps(value, sort_keys=True, default=str) + for root in sorted( + {str(Path(root).resolve()) for root in roots}, key=len, reverse=True + ): + text = text.replace(root, "$APP") + return hashlib.sha256(text.encode()).hexdigest() + + +async def ensure(home, generation, session): + from .host.config import read_config, write_private + from .runtime_environment import project_path, receipt_directory + from .updates import process + + if not generation: + return generation # Legacy first-start setup keeps its existing contract. + receipt = receipt_directory(home, generation) + descriptor = receipt / "profiles-qualified.json" + if not descriptor.exists(): + return generation # A pre-migration generation has not opted into immutability. + config = read_config( + session["workspace"], + home=home, + session_id=session.get("runtimeSessionId") or session["id"], + registry_home=receipt / "foundation", + ) + bundle = session.get("bundle") or config.active_bundle + key = configuration_key(config.settings, home, receipt) + # Explicit local bundles can shadow a named offering. Their content is not + # represented by the app's Git generation and must be qualified separately. + from .host.bundle_paths import local_bundle_path + + local = local_bundle_path(config, bundle) + from .session_files import validate_id + + runtime_id = ( + session.get("runtimeSessionId") + or session.get("nativeIdentity") + or session["id"] + ) + validate_id(runtime_id) + edited_path = Path(home) / "sessions" / runtime_id / "configuration.json" + edited = json.loads(edited_path.read_text()) if edited_path.exists() else None + local_inputs = {local} if local else set() + # Local overrides are mutable user inputs. Content, not merely the path, + # participates in qualification so edits cannot reuse an obsolete wheel. + declarations = [ + config.module_sources, + config.bundle_sources, + config.settings.get("bundle", {}).get("added", {}), + edited or {}, + ] + + def inspect(value): + if isinstance(value, dict): + for child in value.values(): + inspect(child) + elif isinstance(value, list): + for child in value: + inspect(child) + elif isinstance(value, str) and value.startswith( + ("/", "./", "../", "~", "file://") + ): + path = Path(value.removeprefix("file://")).expanduser() + if not path.is_absolute(): + path = config.workspace / path + # Generation-owned sources are already immutable and identified by + # the parent generation. Hash only external user-owned inputs here. + if path.exists() and not path.resolve().is_relative_to( + Path(home).resolve() + ): + local_inputs.add(path.resolve()) + + inspect(declarations) + if local_inputs: + from amplifier_foundation.modules.preparation import source_signature + + contents = [] + for path in sorted(local_inputs): + content = await asyncio.to_thread( + source_signature, path if path.is_dir() else path.parent + ) + contents.append([str(path), content]) + key = hashlib.sha256((key + json.dumps(contents)).encode()).hexdigest() + if edited is not None: + key = hashlib.sha256( + (key + json.dumps(edited, sort_keys=True)).encode() + ).hexdigest() + offered = json.loads(descriptor.read_text()) + if ( + not local_inputs + and edited is None + and bundle in offered["profiles"] + and key == offered["configuration"] + ): + return generation + # The profile key contains no prompts, histories or credentials in plaintext. + identity = hashlib.sha256( + json.dumps([generation, bundle, key]).encode() + ).hexdigest() + index = Path(home) / "updates/profiles" / (identity + ".json") + from filelock import AsyncFileLock + + index.parent.mkdir(parents=True, exist_ok=True) + async with AsyncFileLock(str(index) + ".lock"): + if index.exists(): + selected = json.loads(index.read_text())["generation"] + target = receipt_directory(home, selected) + if (target / "validated.json").exists() and project_path( + home, selected + ).exists(): + return selected + selected = uuid.uuid4().hex + stage = receipt_directory(home, selected) + stage.mkdir(parents=True, mode=0o700) + from .update_storage import copy_snapshot + + await asyncio.to_thread( + copy_snapshot, receipt / "foundation", stage / "foundation" + ) + registry = stage / "foundation/registry.json" + if registry.exists(): + write_private( + registry, + registry.read_text().replace( + str(receipt / "foundation"), str(stage / "foundation") + ), + ) + shared = stage / "shared-config" + shared.mkdir(mode=0o700) + import yaml + + def relocate(value): + if isinstance(value, dict): + return {k: relocate(v) for k, v in value.items()} + if isinstance(value, list): + return [relocate(v) for v in value] + if isinstance(value, str): + return value.replace( + str(receipt / "foundation"), str(stage / "foundation") + ) + return value + + write_private( + shared / "settings.yaml", yaml.safe_dump(relocate(config.settings)) + ) + # Only setup uses this private snapshot. Real worker credentials and + # conversations continue through their ordinary shared authorities. + keys = config.config_home / "keys.env" + if keys.exists(): + shutil.copy2(keys, shared / "keys.env") + for routing in ("routing",): + source = config.config_home / routing + if source.is_dir(): + shutil.copytree(source, shared / routing) + # Preserve relative source semantics while all probe history/output and + # settings remain in the candidate's private home and shared root. + workspace = config.workspace + profile = str(local) if local else bundle + profiles = stage / "profiles.json" + write_private(profiles, json.dumps([profile])) + plan_flags = [] + if edited is not None: + plan_file = stage / "runtime-plan.json" + write_private(plan_file, json.dumps(edited)) + plan_flags = ["--runtime-plan", str(plan_file)] + project = Path(home) / "runtime" / ("prepare-" + selected) + project.mkdir(parents=True) + current = project_path(home, generation) + shutil.copy2(current / "pyproject.toml", project / "pyproject.toml") + shutil.copy2(current / "uv.lock", project / "uv.lock") + from .runtime_qualification import freeze, prepare_overrides, verify_recorded + from .update_sources import store_environment + + uv = shutil.which("uv") + await process( + uv, + "sync", + "--locked", + "--project", + str(project), + "--python", + "3.13", + timeout=900, + ) + overrides = await prepare_overrides( + project, stage / "runtime-install-overrides.txt" + ) + env = { + **os.environ, + **store_environment(home), + "AMPLIFIER_WEB_HOME": str(stage), + "AMPLIFIER_HOME": str(shared), + "AMPLIFIER_UNIFIED_RELEASE": "", + "AMPLIFIER_INSTALL_PREPARATION": uuid.uuid4().hex, + "UV_OVERRIDE": str(overrides), + } + command = [ + uv, + "run", + "--locked", + "--no-sync", + "--project", + str(project), + "--python", + "3.13", + "python", + str(Path(__file__).with_name("update_probe.py")), + ] + await process( + *command, + str(workspace), + profile, + "--profiles", + str(profiles), + "--install-overrides", + str(overrides), + *plan_flags, + env=env, + timeout=900, + ) + + class Diagnostics: + async def run(self, phase, function, *args, **kwargs): + return await function(*args, **kwargs) + + def record(self, *args, **kwargs): + pass + + manager = SimpleNamespace(home=home, diagnostics=Diagnostics()) + final = await freeze(manager, selected, project) + overrides = stage / "runtime-install-overrides.txt" + command[command.index("--project") + 1] = str(final) + await process( + *command, + str(workspace), + profile, + "--global-only", + "--read-only", + "--install-overrides", + str(overrides), + *plan_flags, + env={**env, "UV_OVERRIDE": str(overrides)}, + timeout=900, + ) + await asyncio.to_thread(verify_recorded, final, stage) + write_private( + stage / "validated.json", + json.dumps( + { + "generationSchema": 1, + "workerProtocol": 1, + "parentGeneration": generation, + "hostVersion": __import__("amplifier_web").__version__, + "sources": 1, + "createdAt": time.time(), + } + ), + ) + write_private( + stage / "profiles-qualified.json", + json.dumps({"profiles": [bundle], "configuration": key}), + ) + write_private( + index, json.dumps({"generation": selected, "parentGeneration": generation}) + ) + return selected diff --git a/amplifier_web/runtime_qualification.py b/amplifier_web/runtime_qualification.py index f88e58447..603801b98 100644 --- a/amplifier_web/runtime_qualification.py +++ b/amplifier_web/runtime_qualification.py @@ -2,6 +2,7 @@ from __future__ import annotations import importlib.metadata +import asyncio import hashlib import json from pathlib import Path @@ -63,14 +64,25 @@ def package_content(project): roots += [Path(project) / '.venv/Lib/site-packages'] digest = hashlib.sha256() files = {} + resolved_parents = {} for root in roots: if not root.is_dir(): continue + resolved_root = root.resolve() for dist in importlib.metadata.distributions(path=[str(root)]): for entry in dist.files or (): file = dist.locate_file(entry) - if (file.suffix == '.pyc' or file.name in {'RECORD', 'direct_url.json', 'INSTALLER', 'REQUESTED'} - or not file.resolve().is_relative_to(root.resolve())): + if file.suffix == '.pyc' or file.name in {'RECORD', 'direct_url.json', 'INSTALLER', 'REQUESTED'}: + continue + # RECORD can list tens of thousands of files. Resolving every + # ancestor for every entry turned this check into repeated + # filesystem walks. Resolve each containing directory once; + # still resolve file symlinks and reject external payloads. + parent = resolved_parents.get(file.parent) + if parent is None: + parent = resolved_parents[file.parent] = file.parent.resolve() + actual = file.resolve() if file.is_symlink() else parent / file.name + if not actual.is_relative_to(resolved_root): continue files[str(file.relative_to(root))] = file for name, file in sorted(files.items()): @@ -333,6 +345,14 @@ def identity(rows): receipt.joinpath('runtime-sources.json').write_text(json.dumps(policies, indent=2) + '\n') await manager.diagnostics.run('ecosystem-runtime-policy', prepare_overrides, final, receipt / 'runtime-install-overrides.txt') receipt.joinpath('runtime-installed.json').write_text(json.dumps(actual, indent=2) + '\n') + # Qualification owns this disposable preparation environment. Keep only + # the frozen graph after every installer has exited; never accumulate a + # second venv per successful update. Unusual editable references preserve it. + original = Path(project) + if (original != final and not original.is_symlink() + and original.parent.resolve() == (Path(manager.home) / 'runtime').resolve() + and str(original.resolve()) not in json.dumps(actual)): + await asyncio.to_thread(shutil.rmtree, original) return final @@ -356,8 +376,8 @@ def active_install_overrides(home, current_override=None): An explicit user override remains authoritative. Legacy generations have no new policy. Validate an existing graph before mounting another conversation. """ - from .updates import active_release - generation = active_release(home).get('current') + from .updates import selected_release + generation = selected_release(home) receipt = environments.receipt_directory(home, generation) if not (receipt / 'runtime-installed.json').exists(): return None diff --git a/amplifier_web/runtime_retention.py b/amplifier_web/runtime_retention.py index 9d9fa3993..879689f25 100644 --- a/amplifier_web/runtime_retention.py +++ b/amplifier_web/runtime_retention.py @@ -39,6 +39,7 @@ def __init__(self, manager, settings=None, *, clock=time.monotonic): self.sweep_lock = asyncio.Lock() self.reply_timeout = 30 self.retirements = set() + self.protected = lambda sid: False def wake(self): if self.manager._closed: @@ -61,17 +62,15 @@ async def sweep(self): ttl = self.settings["idle_timeout_hours"] * 3600 now = self.clock() for index, (sid, row) in enumerate(candidates): - if index >= excess and now - row["parked_at"] < ttl: + if self.protected(sid): + continue + if not row.get("update_pending") and index >= excess and now - row["parked_at"] < ttl: continue # Serialize the final idle check with command admission/start. async with self.manager._locks.setdefault(sid, asyncio.Lock()): if self.manager.workers.get(sid) is not row or not self.eligible(row): continue - row["closing"] = True - task = asyncio.create_task(self.retire(sid, row)) - row['retirement_task'] = task - self.retirements.add(task) - task.add_done_callback(self.retirements.discard) + task = self.schedule(sid, row) try: await asyncio.wait_for(asyncio.shield(task), self.reply_timeout) except TimeoutError: @@ -79,6 +78,15 @@ async def sweep(self): # for reconciliation; a timeout is not a refusal to retire. continue + def schedule(self, sid, row): + # Caller holds the per-session admission lock. + row['closing'] = True + task = asyncio.create_task(self.retire(sid, row)) + row['retirement_task'] = task + self.retirements.add(task) + task.add_done_callback(self.retirements.discard) + return task + async def retire(self, sid, row): try: # Retirement has no protocol-reply deadline. The sweep and command diff --git a/amplifier_web/service.py b/amplifier_web/service.py index 3fd214982..3c2b7aebc 100644 --- a/amplifier_web/service.py +++ b/amplifier_web/service.py @@ -349,6 +349,8 @@ def __init__(self, data_dir: Path, runtime=None, workspace=None): self.surface_context = SurfaceContext(self) self.default_workspace = str(Path(workspace or os.getcwd()).resolve()) self.runtime = runtime + if runtime is not None and hasattr(runtime, "home"): + runtime.home = self.data_dir self.voice_service = None self.voice_visual = VoiceVisual(self) self.computer_visual = ComputerVisuals(self) @@ -1094,6 +1096,8 @@ async def install_runtime(self, runtime): await runtime.close() raise RuntimeError("The runtime host is closing.") self.runtime = runtime + if runtime is not None and hasattr(runtime, "home"): + runtime.home = self.data_dir self.worktrees.bind_runtime() self.state["runtime"]["available"] = runtime is not None if hasattr(runtime, "retention"): diff --git a/amplifier_web/static/assets/abnfDiagram-VCTEODGH-IIquwGZo.js b/amplifier_web/static/assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js similarity index 86% rename from amplifier_web/static/assets/abnfDiagram-VCTEODGH-IIquwGZo.js rename to amplifier_web/static/assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js index e3e2f980c..ca631415f 100644 --- a/amplifier_web/static/assets/abnfDiagram-VCTEODGH-IIquwGZo.js +++ b/amplifier_web/static/assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js @@ -1 +1 @@ -import{g as p,r as u,d as a}from"./chunk-SVP7TREG-BBG-Pp77.js";import{p as f}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{_ as n,l as o}from"./mermaid.core-CDlaSEyP.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram}; +import{g as p,r as u,d as a}from"./chunk-SVP7TREG-DegBQCYH.js";import{p as f}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as n,l as o}from"./mermaid.core-BQ5lTCZr.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram}; diff --git a/amplifier_web/static/assets/app-W22-ExtL.js b/amplifier_web/static/assets/app-zsnl1T1T.js similarity index 51% rename from amplifier_web/static/assets/app-W22-ExtL.js rename to amplifier_web/static/assets/app-zsnl1T1T.js index 4eaa2b7e1..5e0a715e7 100644 --- a/amplifier_web/static/assets/app-W22-ExtL.js +++ b/amplifier_web/static/assets/app-zsnl1T1T.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CDlaSEyP.js","assets/client-BPXDbY79.js","assets/index-D1m6Llf0.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BQ5lTCZr.js","assets/client-BPXDbY79.js","assets/index-D1m6Llf0.js"])))=>i.map(i=>d[i]); var Ck=Object.defineProperty;var Nk=(e,t,a)=>t in e?Ck(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Ke=(e,t,a)=>Nk(e,typeof t!="symbol"?t+"":t,a);import{a as v,R as n,r as Mi,g as og,c as Rk}from"./client-BPXDbY79.js";const zi=v.createContext(null),_s=e=>{var t;return((t=e==null?void 0:e.view)==null?void 0:t.workSurface)||"chat"},Tk=(e,t=null)=>({workSurface:e,workWorkspaceId:t,workWorkspaceTab:"chats"});/** * @license lucide-react v0.468.0 - ISC * @@ -19,502 +19,502 @@ var Ck=Object.defineProperty;var Nk=(e,t,a)=>t in e?Ck(e,t,{enumerable:!0,config * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ee=(e,t)=>{const a=v.forwardRef(({className:r,...o},i)=>v.createElement(_k,{ref:i,iconNode:t,className:ig(`lucide-${Ik(e)}`,r),...o}));return a.displayName=`${e}`,a};/** + */const we=(e,t)=>{const a=v.forwardRef(({className:r,...o},i)=>v.createElement(_k,{ref:i,iconNode:t,className:ig(`lucide-${Ik(e)}`,r),...o}));return a.displayName=`${e}`,a};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mo=Ee("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const mo=we("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Pk=Ee("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** + */const Pk=we("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wi=Ee("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** + */const wi=we("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sg=Ee("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** + */const sg=we("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Sa=Ee("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const Sa=we("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Dr=Ee("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const Dr=we("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ok=Ee("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** + */const Ok=we("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Li=Ee("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const Li=we("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zu=Ee("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** + */const zu=we("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lg=Ee("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/** + */const lg=we("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Mk=Ee("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + */const Mk=we("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zk=Ee("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 zk=we("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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lk=Ee("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + */const Lk=we("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Dk=Ee("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** + */const Dk=we("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cm=Ee("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** + */const cm=we("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Pt=Ee("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const Pt=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const el=Ee("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const el=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fk=Ee("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const Fk=we("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const en=Ee("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const en=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zn=Ee("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + */const zn=we("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jc=Ee("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** + */const jc=we("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qk=Ee("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const qk=we("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Uk=Ee("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + */const Uk=we("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cg=Ee("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const cg=we("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ps=Ee("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** + */const Ps=we("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Os=Ee("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** + */const Os=we("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jk=Ee("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + */const jk=we("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rr=Ee("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const rr=we("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wa=Ee("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const wa=we("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Di=Ee("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + */const Di=we("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sa=Ee("ExternalLink",[["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 sa=we("ExternalLink",[["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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $k=Ee("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 $k=we("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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const um=Ee("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** + */const um=we("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const No=Ee("FileText",[["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"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + */const No=we("FileText",[["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"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ql=Ee("File",[["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"}]]);/** + */const ql=we("File",[["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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Bk=Ee("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** + */const Bk=we("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nr=Ee("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + */const nr=we("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Hk=Ee("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + */const Hk=we("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fr=Ee("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + */const Fr=we("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wa=Ee("GitBranch",[["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 Wa=we("GitBranch",[["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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vr=Ee("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const vr=we("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vk=Ee("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + */const Vk=we("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wk=Ee("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + */const Wk=we("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ug=Ee("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const ug=we("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qr=Ee("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/** + */const qr=we("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dm=Ee("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** + */const dm=we("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zk=Ee("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + */const Zk=we("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ro=Ee("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const Ro=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dg=Ee("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** + */const dg=we("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Jk=Ee("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** + */const Jk=we("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Kk=Ee("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + */const Kk=we("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Yk=Ee("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + */const Yk=we("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gk=Ee("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** + */const Gk=we("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fi=Ee("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const Fi=we("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Qk=Ee("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + */const Qk=we("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xk=Ee("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + */const Xk=we("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ex=Ee("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + */const ex=we("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tx=Ee("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + */const tx=we("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lu=Ee("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 Lu=we("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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nx=Ee("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + */const nx=we("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $c=Ee("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 $c=we("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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ax=Ee("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** + */const ax=we("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Bc=Ee("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** + */const Bc=we("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Du=Ee("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** + */const Du=we("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rx=Ee("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + */const rx=we("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fu=Ee("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/** + */const Fu=we("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qi=Ee("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const qi=we("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qu=Ee("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** + */const qu=we("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pg=Ee("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const pg=we("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ox=Ee("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + */const ox=we("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ln=Ee("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const Ln=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Mt=Ee("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const Mt=we("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ix=Ee("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** + */const ix=we("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pm=Ee("RotateCcw",[["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 pm=we("RotateCcw",[["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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sx=Ee("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** + */const sx=we("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lx=Ee("ScanEye",[["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:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** + */const lx=we("ScanEye",[["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:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const To=Ee("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const To=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cx=Ee("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** + */const cx=we("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ux=Ee("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + */const ux=we("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Hc=Ee("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const Hc=we("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dx=Ee("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** + */const dx=we("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const px=Ee("ShieldCheck",[["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 px=we("ShieldCheck",[["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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tl=Ee("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** + */const tl=we("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mx=Ee("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** + */const mx=we("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hx=Ee("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + */const hx=we("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fx=Ee("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** + */const fx=we("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gx=Ee("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 gx=we("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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mm=Ee("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 mm=we("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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vx=Ee("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const vx=we("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ea=Ee("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const ea=we("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bx=Ee("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** + */const bx=we("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yx=Ee("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** + */const yx=we("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mg=Ee("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + */const mg=we("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ex=Ee("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const Ex=we("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nn=Ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + */const nn=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wx=Ee("ZoomIn",[["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 wx=we("ZoomIn",[["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"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kx=Ee("ZoomOut",[["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 xx(e=""){const t=String(e).trim().toLowerCase();if(!/[\*?\[]/.test(t))return r=>String(r??"").toLowerCase().includes(t);const a=[];for(let r=0;rl!==u.some(([p,m])=>d>=p&&d<=m)),r=i;continue}}a.push(i=>i===o)}return r=>{const o=[...String(r??"").toLowerCase()];let i=Array(o.length+1).fill(!1);i[0]=!0;for(const s of a){const l=Array(o.length+1).fill(!1);l[0]=s==="*"&&i[0];for(let c=1;c<=o.length;c++)l[c]=s==="*"?i[c]||l[c-1]:i[c-1]&&(s==="?"||s(o[c-1]));i=l}return i[o.length]}}function nl(e,t,a){const r=xx(t);return e.filter(o=>a(o).some(r))}function Uu(e){return e.runtimeSessionId||e.nativeIdentity||e.id}function ju(e,t){var r,o,i,s,l,c,u,d,p,m,h;if(e.activity)return e.activity;if((r=e.approvals)!=null&&r.some(f=>f.status==null||f.status==="pending"))return{kind:"attention",label:"Approval requested"};if((o=e.questions)!=null&&o.some(f=>f.status==="pending"&&f.required))return{kind:"attention",label:"Answer requested"};if((i=e.questions)!=null&&i.some(f=>{var g;return["unknown","rejected"].includes((g=f.delivery)==null?void 0:g.status)}))return{kind:"attention",label:"Check answer delivery"};if(e.status==="blocked"||((u=(c=(l=(s=t==null?void 0:t.runtimeControl)==null?void 0:s[e.id])==null?void 0:l["task.get"])==null?void 0:c.task)==null?void 0:u.status)==="blocked")return{kind:"attention",label:"Work blocked"};if(["starting","working","running","stopping"].includes(e.status))return{kind:"working",label:e.status==="starting"?"Starting":e.status==="stopping"?"Stopping":"Working"};const a=(p=(d=t==null?void 0:t.attention)==null?void 0:d.items)==null?void 0:p.some(f=>f.id==="session:"+e.id&&f.sessionId===e.id&&f.read);return(e.error||["error","failed"].includes(e.status))&&!a?{kind:"attention",label:"Needs attention"}:(h=(m=t==null?void 0:t.attention)==null?void 0:m.sessions)!=null&&h[e.id]?{kind:"unread",label:"New response"}:{kind:"idle",label:"Idle"}}function $u(e,t=Date.now()/1e3){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return{short:"—",long:"Activity time unavailable"};const a=Math.max(0,t-e);if(a<60)return{short:"now",long:"Just now"};for(const[r,o,i]of[["minute",60,3600],["hour",3600,86400],["day",86400,604800],["week",604800,1/0]])if(a2?"…/"+a.slice(-2).join("/"):t}function Sx(e){const t=e.pathLabel||"",a=e.name||"";return e.customName?t||e.path:t.endsWith("/"+a)?t.slice(0,-a.length-1):fg(e.path)}const Vc=100;function al(e){return(e.workspaces||[]).filter(t=>t.available===!0&&!!t.path)}function ho(e){var t;return(e==null?void 0:e.sessionKind)==="root"?!0:(e==null?void 0:e.sessionKind)==="worker"||(e==null?void 0:e.sessionKind)==="internal"?!1:(t=e==null?void 0:e.forkTranscript)!=null&&t.length||e!=null&&e.editOrigin?!0:!(e!=null&&e.nativeParentId)}function gg(e=[],t){if(!t)return[];const a=t.nativeIdentity||t.runtimeSessionId||t.id;return e.filter(r=>r.id!==t.id&&!ho(r)&&(r.parentId===t.id||r.nativeParentId===a&&(t.nativeProject?r.nativeProject===t.nativeProject:t.workspaceId?r.workspaceId===t.workspaceId:!!t.workspace&&r.workspace===t.workspace)))}function Cx(e){return[e.navigationActivityAt,e.recentActivityAt,e.createdAt].find(t=>typeof t=="number"&&Number.isFinite(t)&&t>=0)??0}function vg(e,t,a="workspace"){const r=al(e),o=new Map(r.map(h=>[h.id,h])),i=new Map(r.map(h=>[h.path,h])),s=new Set(e.pinnedSessionIds||[]),l=e.conversationOrganization||{},c=l.archived||{},u=e.view||{},d=u.navArchive||"active",p=u.navSort||"activity",m=new Map((e.pinnedSessionIds||[]).map((h,f)=>[h,f]));return(e.sessions||[]).map((h,f)=>({chat:h,position:f,workspace:o.get(h.workspaceId)||i.get(h.workspace)})).filter(h=>{var f,g,y;return ho(h.chat)&&(h.workspace||((f=h.chat.location)==null?void 0:f.kind)==="managed")&&(a==="all"||((g=h.chat.location)==null?void 0:g.kind)!=="managed"&&((y=h.workspace)==null?void 0:y.id)===(t==null?void 0:t.id))}).filter(({chat:h})=>{var f;return a!=="all"||u.navLocationFilter!=="managed"||((f=h.location)==null?void 0:f.kind)==="managed"}).filter(({chat:h})=>d==="all"||d==="archived"===Object.hasOwn(c,h.id)).map(h=>{var f,g,y,E,b;return{...h.chat,workspace:((f=h.workspace)==null?void 0:f.path)||h.chat.workspace,workspaceId:((g=h.chat.location)==null?void 0:g.kind)==="managed"?null:h.workspace.id,workspaceName:((y=h.chat.location)==null?void 0:y.kind)==="managed"?"No workspace":h.workspace.name||"",workspaceLabel:((E=h.chat.location)==null?void 0:E.kind)==="managed"?"No workspace":(b=h.workspace)==null?void 0:b.label,pinned:s.has(h.chat.id),recentActivityAt:Cx(h.chat),position:h.position}}).sort((h,f)=>Number(f.pinned)-Number(h.pinned)||(h.pinned?m.get(h.id)-m.get(f.id):p==="name"?(h.title||"Untitled conversation").toLowerCase()<(f.title||"Untitled conversation").toLowerCase()?-1:(h.title||"Untitled conversation").toLowerCase()>(f.title||"Untitled conversation").toLowerCase()?1:0:p==="created"?(f.createdAt||0)-(h.createdAt||0):f.recentActivityAt-h.recentActivityAt)||h.position-f.position)}function Es(e,t,{section:a=null}={}){var C,O;const r=e.view||{},o=r.navChatScope==="all"?"all":"workspace",i=r.navFilter||"",s=e.selectedSessionId??null;t=al(e).find(k=>k.id===((t==null?void 0:t.id)??e.selectedWorkspaceId));const l={mode:o,workspaceId:o==="all"?null:(t==null?void 0:t.id)??null,filter:i,selectedSessionId:s};a&&(l.section=a),r.navSort&&r.navSort!=="activity"&&(l.sort=r.navSort),o==="all"&&r.navLocationFilter==="managed"&&(l.locationFilter="managed");const c=r.navStatusFilter||"all";c!=="all"&&(l.statusFilter=c),r.navArchive&&r.navArchive!=="active"&&(l.archive=r.navArchive);const u=a?(C=e.sidebarNavigation)==null?void 0:C[a]:e.chatNavigation,d=k=>((k==null?void 0:k.sort)||"activity")===(l.sort||"activity"),p=k=>((k==null?void 0:k.locationFilter)||"all")===(l.locationFilter||"all"),m=r.navChatPage,h=m&&p(m)&&d(m)&&Object.entries(l).every(([k,T])=>m[k]===T),f=a==="pinned"?Math.max(0,Math.min(((u==null?void 0:u.pages)||1)-1,r.navPinnedPage||0)):h&&Number.isSafeInteger(m.index)?Math.max(0,Math.min(((u==null?void 0:u.pages)||1)-1,m.index)):null;if(u!=null&&u.scope&&p(u.scope)&&d(u.scope)&&Array.isArray(u.items)&&Object.entries(l).every(([k,T])=>u.scope[k]===T)&&(f===null||u.index===f))return u;if((O=e.library)!=null&&O.bounded)return{items:[],total:0,index:0,pages:1,start:0,end:0,scope:l,pending:!0};let g=nl(vg(e,t,o),i,k=>[k.title||"Untitled conversation",k.description||"",k.id,Uu(k),k.workspace,k.workspaceName]);(a==="pinned"||a==="recent")&&(g=g.filter(k=>k.pinned===(a==="pinned")));const y={attention:0,working:0,unread:0,idle:0};g=g.map(k=>({...k,activity:ju(k,e)}));for(const k of g)y[k.activity.kind]++;c!=="all"&&(g=g.filter(k=>k.activity.kind===c));const E=a?g.length>50?40:50:Vc,b=o==="all"?0:Math.floor(Math.max(0,g.findIndex(k=>k.id===s))/E),S=a==="pinned"?r.navPinnedPage||0:h&&Number.isSafeInteger(m.index)?m.index:b,w=Math.max(1,Math.ceil(g.length/E)),N=Math.max(0,Math.min(w-1,S)),x=N*E,A=Math.min(g.length,x+E);return{items:g.slice(x,A),total:g.length,index:N,pages:w,start:x,end:A,scope:l,activityCounts:y}}function Nx(e){var i,s,l;if(!e)return{items:[],total:0};if(Array.isArray((i=e.headerChatNavigation)==null?void 0:i.items))return e.headerChatNavigation;const t=(s=e.workspaces)==null?void 0:s.find(c=>c.id===e.selectedWorkspaceId),a=(l=e.sessions)==null?void 0:l.find(c=>c.id===e.selectedSessionId),r=vg({...e,view:{...e.view,navArchive:"active",navCollection:null}},t),o=r.slice(0,Vc);return a&&ho(a)&&!o.some(c=>c.id===a.id)&&o.splice(Math.max(0,Vc-1),1,a),{items:o,total:r.length}}function bg(e,t){var r;if(Number.isSafeInteger(t==null?void 0:t.subagentCount)&&t.subagentCount>=0)return t.subagentCount;const a=e.subagentNavigation;return t&&((r=a==null?void 0:a.scope)==null?void 0:r.sessionId)===t.id&&Number.isSafeInteger(a.unfilteredTotal)?a.unfilteredTotal:gg(e.sessions,t).length}function Rx(e,t){var h,f;const a=((h=e.view)==null?void 0:h.subagentHistory)||{},r=a.filter||"",o={sessionId:t==null?void 0:t.id,filter:r},i=e.subagentNavigation,s=Number.isSafeInteger(a.index)?a.index:0;if(i!=null&&i.scope&&Array.isArray(i.items)&&Object.entries(o).every(([g,y])=>i.scope[g]===y)&&i.index===Math.max(0,Math.min(i.pages-1,s)))return i;if((f=e.library)!=null&&f.bounded)return{items:[],total:0,unfilteredTotal:bg(e,t),index:0,pages:1,start:0,end:0,scope:o,pending:!0};const l=gg(e.sessions,t),c=nl(l,r,g=>[g.title,g.description,g.id,g.nativeIdentity]),u=Math.max(1,Math.ceil(c.length/50)),d=Math.max(0,Math.min(u-1,s)),p=d*50,m=Math.min(c.length,p+50);return{items:c.slice(p,m),total:c.length,unfilteredTotal:l.length,index:d,pages:u,start:p,end:m,scope:o}}function yg(e,t,a){if(t===a||!e.includes(t)||!e.includes(a))return e;const r=e.filter(o=>o!==t);return r.splice(e.indexOf(a),0,t),r}const Eg=v.createContext(!0),Ji=new WeakMap;function Bu(e="(max-width: 760px)"){const[t,a]=v.useState(()=>typeof matchMedia=="function"&&matchMedia(e).matches);return v.useEffect(()=>{if(typeof matchMedia!="function")return;const r=matchMedia(e),o=()=>a(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[e]),t}function rl(e,t,a){const r=v.useRef(a);r.current=a,v.useEffect(()=>{var d;const o=e.current;if(!t||!o)return;const i=document.activeElement,s=[];let l=o;for(;l!=null&&l.parentElement&&l.id!=="amp-one";){for(const p of l.parentElement.children){if(p===l||p.tagName==="STYLE"||p.matches(".a-navigation-scrim,.a-details-scrim,.a-toolbar-scrim"))continue;const m=Ji.get(p)||{count:0,original:p.inert};m.count++,Ji.set(p,m),s.push(p),p.inert=!0}l=l.parentElement}const c=()=>[...o.querySelectorAll('button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href],[tabindex="0"]')].filter(p=>p.getClientRects().length&&!p.closest("[inert]"));(d=c()[0])==null||d.focus({preventScroll:!0});const u=p=>{if(p.defaultPrevented)return;if(p.key==="Escape"){p.preventDefault(),r.current();return}if(p.key!=="Tab")return;const m=c(),h=m[0],f=m.at(-1);if(!h){p.preventDefault();return}p.shiftKey&&(document.activeElement===h||!o.contains(document.activeElement))?(p.preventDefault(),f.focus()):!p.shiftKey&&(document.activeElement===f||!o.contains(document.activeElement))&&(p.preventDefault(),h.focus())};return document.addEventListener("keydown",u),()=>{var p;document.removeEventListener("keydown",u);for(const m of s){const h=Ji.get(m);h&&!--h.count&&(m.inert=h.original,Ji.delete(m))}i!=null&&i.isConnected&&!i.closest("[inert]")&&((p=i.focus)==null||p.call(i,{preventScroll:!0}))}},[t,e])}function ol(){const[e,t]=v.useState(()=>Date.now()/1e3);return v.useEffect(()=>{if(typeof window>"u")return;const a=setInterval(()=>t(Date.now()/1e3),3e4);return()=>clearInterval(a)},[]),e}function Hu({activity:e}){return n.createElement("span",{className:"a-navigation-status","data-kind":e.kind,"aria-label":e.label,title:e.label},e.kind==="working"?n.createElement(Ro,{className:"a-progress-spinner"}):e.kind==="attention"?n.createElement(zn,null):e.kind==="unread"?n.createElement("span",{className:"a-navigation-unread"}):n.createElement(Fi,null))}function Tx({at:e,now:t}){const a=$u(e,t);return n.createElement("span",{className:"a-navigation-age","data-view-source":"activity-time",title:a.long,"aria-label":"Last activity: "+a.long},a.short)}function Ms({label:e,value:t}){const[a,r]=v.useState("");return v.useEffect(()=>r(""),[t]),n.createElement("div",{className:"a-navigation-copy"},n.createElement("div",null,n.createElement("span",null,e),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy "+e.toLowerCase(),onClick:async()=>{try{await navigator.clipboard.writeText(t),r("Copied")}catch{r("Select the text and copy it manually.")}}},a==="Copied"?n.createElement(Pt,null):n.createElement(rr,null))),n.createElement("code",null,t),a&&n.createElement("small",{role:"status"},a))}function wg({row:e,now:t,actions:a}){const r=e.activityCounts||{};return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-navigation-detail-heading"},n.createElement(nr,null),n.createElement("span",null,"Workspace details")),n.createElement("h3",null,e.customName||e.name),n.createElement("dl",null,n.createElement("dt",null,"Chats"),n.createElement("dd",null,e.chatCount??0),n.createElement("dt",null,"Activity"),n.createElement("dd",null,r.working||0," working · ",r.attention||0," need attention"),n.createElement("dt",null,"Last activity"),n.createElement("dd",null,$u(e.recentActivityAt,t).long)),n.createElement(Ms,{label:"Full workspace path",value:e.path}),a&&n.createElement("div",{className:"a-navigation-actions"},a))}function Vu({className:e="",label:t,children:a,details:r,expanded:o=!1,...i}){var k;const s=Bu(),l=v.useContext(Eg),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),p=v.useRef(null),m=v.useRef(null),h=v.useRef(!1),f=v.useId(),[g,y]=v.useState(!1),[E,b]=v.useState(!1),[S,w]=v.useState({left:0,top:0}),N=()=>{clearTimeout(p.current),clearTimeout(m.current)},x=(T=!1)=>{var I;N(),y(!1),b(!1),T&&((I=d.current)==null||I.focus({preventScroll:!0}))};rl(u,l&&s&&g,()=>x(!0));const A=(T=!1)=>{var I;N(),!((I=c.current)!=null&&I.closest('[data-reordering="true"]'))&&(!T&&document.querySelector('.a-navigation-flyout[data-locked="true"]')||(document.dispatchEvent(new CustomEvent("amplifier-navigation-details",{detail:f})),h.current=T,b(T),y(!0)))};v.useEffect(()=>()=>N(),[]),v.useEffect(()=>{l||x()},[l]),v.useEffect(()=>{o&&A(!0)},[o]),v.useEffect(()=>{if(!g)return;const T=z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),x(E))},I=z=>{var U,H;!((U=c.current)!=null&&U.contains(z.target))&&!((H=u.current)!=null&&H.contains(z.target))&&x()},F=z=>{z.detail!==f&&x()};return document.addEventListener("keydown",T,!0),document.addEventListener("pointerdown",I),document.addEventListener("amplifier-navigation-details",F),()=>{document.removeEventListener("keydown",T,!0),document.removeEventListener("pointerdown",I),document.removeEventListener("amplifier-navigation-details",F)}},[g,E,f]),v.useEffect(()=>{var T,I;g&&E&&h.current&&(h.current=!1,(I=(T=u.current)==null?void 0:T.querySelector("button"))==null||I.focus({preventScroll:!0}))},[g,E]),v.useLayoutEffect(()=>{if(!g||!u.current||!c.current)return;const T=()=>{const z=(c.current.closest(".a-nav-slot")?c.current:d.current||c.current).getBoundingClientRect(),U=u.current.getBoundingClientRect(),H=10,te=z.right+8,j=te+U.width<=innerWidth-H?te:Math.max(H,z.left-U.width-8),_={left:Math.min(j,innerWidth-U.width-H),top:Math.max(H,Math.min(z.top,innerHeight-U.height-H))};w(P=>P.left===_.left&&P.top===_.top?P:_)};T();const I=new ResizeObserver(T);return I.observe(u.current),I.observe(c.current),window.addEventListener("resize",T),document.addEventListener("scroll",T,!0),()=>{I.disconnect(),window.removeEventListener("resize",T),document.removeEventListener("scroll",T,!0)}},[g,r]);const C=T=>{var I,F;T.relatedTarget instanceof Node&&((I=c.current)!=null&&I.contains(T.relatedTarget)||(F=u.current)!=null&&F.contains(T.relatedTarget))||(clearTimeout(p.current),E||(m.current=setTimeout(()=>x(),250)))},O=((k=c.current)==null?void 0:k.closest(".a-nav-slot"))||(typeof document<"u"?document.getElementById("amp-one"):null);return n.createElement("div",{...i,ref:c,className:e+(g?" is-peeking":""),onPointerEnter:T=>{clearTimeout(m.current),!s&&T.pointerType!=="touch"&&!g&&(p.current=setTimeout(()=>A(),550))},onPointerLeave:C,onClick:T=>{T.target.closest("[data-navigation-select]")&&x()}},a,n.createElement("button",{ref:d,type:"button",className:"a-icon a-navigation-more","aria-label":"Details and actions for "+t,"aria-expanded":g,"aria-controls":g?f:void 0,onClick:()=>g&&E?x():A(!0)},n.createElement(Di,null)),g&&O&&Mi.createPortal(n.createElement(n.Fragment,null,s&&n.createElement("div",{className:"a-details-scrim",onClick:()=>x(!0)}),n.createElement("section",{ref:u,id:f,role:"dialog","aria-modal":s||void 0,"aria-label":"Details for "+t,className:"a-navigation-flyout","data-locked":E,style:S,onPointerEnter:()=>clearTimeout(m.current),onPointerLeave:C,onFocus:()=>{clearTimeout(m.current),E||b(!0)}},r({close:x}))),O))}function hm(e,t,a){if(!e.includes(t))return e;const r=e.filter(o=>o!==t);return r.splice(Math.max(0,Math.min(a,r.length)),0,t),r}function kg({items:e,ids:t,onChange:a,busy:r=!1,renderItem:o,className:i="",rowClassName:s="",floatingClassName:l="",action:c="view.update",savedHint:u="",onDraggingChange:d}){var j;const p=v.useRef(null),m=v.useRef(null),h=v.useRef(new Map),f=v.useRef(!1),g=v.useRef(!0),[y,E]=v.useState(null),[b,S]=v.useState(null),[w,N]=v.useState(""),x=y||t,A=new Map(e.map(_=>[_.id,_])),C=_=>{var P;return(P=globalThis.requestAnimationFrame)==null?void 0:P.call(globalThis,()=>{var G,W;return(W=(G=p.current)==null?void 0:G.querySelector(`[data-order-id="${CSS.escape(_)}"] .a-reorder-grip`))==null?void 0:W.focus({preventScroll:!0})})},O=()=>{p.current&&(h.current=new Map([...p.current.querySelectorAll("[data-order-id]")].map(_=>[_.dataset.orderId,_.getBoundingClientRect()])))};v.useEffect(()=>(g.current=!0,()=>{g.current=!1,m.current=null}),[]),v.useLayoutEffect(()=>{var _;if(!(!p.current||window.matchMedia("(prefers-reduced-motion: reduce)").matches))for(const P of p.current.querySelectorAll("[data-order-id]")){const G=h.current.get(P.dataset.orderId);P.getAnimations().forEach(D=>D.cancel());const W=P.getBoundingClientRect();G&&P.dataset.orderId!==((_=m.current)==null?void 0:_.id)&&G.top!==W.top&&P.animate([{transform:`translateY(${G.top-W.top}px)`},{transform:"translateY(0)"}],{duration:150,easing:"ease-out"})}},[x.join("\0")]);const k=async(_,P)=>{var G;if(!(r||f.current)){if(_.join("\0")===t.join("\0")){E(null);return}f.current=!0,E(_);try{await a(_,{id:P,to:_.indexOf(P)}),g.current&&N(`${(G=A.get(P))==null?void 0:G.label} moved to position ${_.indexOf(P)+1}.${u?" "+u:""}`)}catch(W){g.current&&N(W.message||"Could not change order.")}finally{f.current=!1,g.current&&(E(null),C(P))}}},T=_=>{var G;const P=m.current;P&&(O(),m.current=null,S(null),d==null||d(!1),(G=p.current)!=null&&G.hasPointerCapture(P.pointerId)&&p.current.releasePointerCapture(P.pointerId),P.active&&!_&&P.valid?k(P.preview,P.id):(E(null),N("Reorder cancelled."),C(P.id)))};v.useEffect(()=>{if(typeof document>"u")return;const _=P=>{P.key==="Escape"&&m.current&&(P.preventDefault(),P.stopPropagation(),T(!0))};return document.addEventListener("keydown",_,!0),()=>document.removeEventListener("keydown",_,!0)}),v.useEffect(()=>{m.current&&m.current.original.join("\0")!==t.join("\0")&&T(!0)},[t.join("\0")]);const I=(_,P)=>{if(r||f.current||_.button!==0)return;_.preventDefault(),document.dispatchEvent(new CustomEvent("amplifier-navigation-details",{detail:"reordering"}));const G=_.currentTarget.closest("[data-order-id]"),W=G.getBoundingClientRect(),D=p.current.getBoundingClientRect();let ne=p.current.parentElement;for(;ne&&!(ne.scrollHeight>ne.clientHeight&&/(auto|scroll)/.test(getComputedStyle(ne).overflowY));)ne=ne.parentElement;const q=[...p.current.querySelectorAll("[data-order-id]")];m.current={id:P,pointerId:_.pointerId,x:_.clientX,y:_.clientY,box:W,bounds:D,scroll:ne,scrollTop:(ne==null?void 0:ne.scrollTop)||0,centers:q.map(Z=>{const ie=Z.getBoundingClientRect();return(ie.top+ie.bottom)/2}),original:[...t],preview:[...t],active:!1,valid:!0},p.current.setPointerCapture(_.pointerId)},F=_=>{const P=m.current;if(!P||!P.active&&Math.hypot(_.clientX-P.x,_.clientY-P.y)<5)return;P.active||d==null||d(!0),P.active=!0,_.preventDefault();const{box:G,bounds:W,scroll:D}=P;if(D){const ke=D.getBoundingClientRect();_.clientYke.bottom-35&&(D.scrollTop+=12)}const ne=((D==null?void 0:D.scrollTop)||0)-P.scrollTop;P.valid=_.clientX>=W.left-24&&_.clientX<=W.right+24&&_.clientY>=W.top-ne-28&&_.clientY<=W.bottom-ne+28;let q=0,Z=1/0;P.centers.forEach((ke,me)=>{const _e=Math.abs(_.clientY+ne-ke);_e{O(),k(hm(t,_,P),_)},U=(_,P=!1)=>n.createElement("button",{type:"button",className:"a-icon a-order-grip a-reorder-grip","aria-disabled":r||f.current||void 0,draggable:!1,"data-action":c,"aria-label":"Reorder "+_.label,title:"Drag, or use Up/Down (Alt + Up/Down also works)",tabIndex:P?-1:0,onPointerDown:G=>I(G,_.id),onKeyDown:G=>{["ArrowUp","ArrowDown"].includes(G.key)&&(G.preventDefault(),z(_.id,t.indexOf(_.id)+(G.key==="ArrowUp"?-1:1)))}},n.createElement(Vk,null)),H=b&&A.get(b.id),te=((j=p.current)==null?void 0:j.closest(".a-settings-experience,.a-nav-slot"))||p.current;return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-reorder-list "+i,ref:p,"data-reordering":!!b||void 0,onPointerMove:F,onPointerUp:()=>T(!1),onPointerCancel:()=>T(!0),onLostPointerCapture:()=>{m.current&&T(!0)},onDragStart:_=>_.preventDefault()},x.map((_,P)=>{const G=A.get(_)||{id:_,label:_};return n.createElement("div",{key:_,"data-order-id":_,className:`a-reorder-item ${s}${(b==null?void 0:b.id)===_?" a-order-placeholder":""}`},(b==null?void 0:b.id)===_&&b.valid&&n.createElement("span",{className:"a-order-insertion","aria-hidden":"true"}),o(G,{handle:U(G),index:P,move:W=>z(_,W),floating:!1}))})),H&&te&&Mi.createPortal(n.createElement("div",{className:"a-order-floating a-reorder-floating "+l,"aria-hidden":"true",inert:!0,style:{left:b.left,top:b.top,width:b.width}},o(H,{handle:U(H,!0),index:x.indexOf(b.id),move:()=>{},floating:!0})),te),n.createElement("span",{className:"a-sr-only",role:"status","aria-live":"polite"},w))}function Da({state:e={},section:t,page:a,count:r,settings:o=!1}){var s,l,c,u,d,p;const i=r??(o?(s=e.attention)==null?void 0:s.settingsUnread:a?(c=(l=e.attention)==null?void 0:l.pages)==null?void 0:c[a]:t?(d=(u=e.attention)==null?void 0:u.sections)==null?void 0:d[t]:(p=e.attention)==null?void 0:p.unread);return i>0?n.createElement("span",{className:"a-attention-badge",role:"status","aria-label":`${i} unread items`},i):null}function xg(e,t,a){const r=JSON.stringify(e.filter(o=>o&&!o.read).map(o=>[o.id,o.fingerprint]));n.useEffect(()=>{const o=e.filter(m=>m&&!m.read),i=a.current;if(!o.length||!i)return;let s,l=!1,c=!1;const u=()=>l&&!document.hidden&&document.hasFocus()&&i.getClientRects().length>0&&!i.closest("[inert], [hidden], details:not([open])"),d=()=>{clearTimeout(s),!c&&u()&&(s=setTimeout(()=>{u()&&(c=!0,Promise.resolve(br(t,o)).catch(()=>{c=!1}))},750))},p=new IntersectionObserver(m=>{l=m[0].isIntersecting,d()});return p.observe(i),document.addEventListener("visibilitychange",d),window.addEventListener("focus",d),window.addEventListener("blur",d),()=>{clearTimeout(s),p.disconnect(),document.removeEventListener("visibilitychange",d),window.removeEventListener("focus",d),window.removeEventListener("blur",d)}},[r,t,a])}function Ui({item:e,act:t,children:a,className:r}){const o=n.useRef(null);return xg(e?[e]:[],t,o),n.createElement("div",{ref:o,className:r},a)}function zs({state:e,act:t,page:a,items:r,showItems:o=!1}){var s;const i=r||(((s=e.attention)==null?void 0:s.items)||[]).filter(l=>l.page===a&&!l.read);return!i.length||a==="updates"?null:n.createElement("div",{className:"a-attention-review"},i.map(l=>n.createElement(Ui,{key:l.id,item:l,act:t},n.createElement("p",null,n.createElement("strong",null,l.title),l.detail&&n.createElement(n.Fragment,null," · ",l.detail)))))}const br=(e,t)=>e("attention.read",{ids:t.map(a=>a.id),fingerprints:Object.fromEntries(t.map(a=>[a.id,a.fingerprint]))});function Ix({state:e,act:t}){var l;const[a,r]=n.useState(!1),o=((l=e.attention)==null?void 0:l.items)||[],i=o.filter(c=>a||!c.read);async function s(c){c.sessionId?(await t("session.select",{id:c.sessionId}),await t("view.update",{patch:{panel:null}})):c.requestId?(await t("view.update",{patch:{panel:"feedback"}}),await br(t,[c])):await t("view.update",{patch:{panel:"settings",settingsSection:c.section,settingsExpanded:[c.page]}})}return n.createElement("section",{className:"a-activity-inbox","aria-label":"Activity to review"},n.createElement("p",null,"Finished work and items that need your attention. Read status is shared with your agent and other devices."),o.some(c=>c.read)&&n.createElement("button",{className:"a-link",type:"button",onClick:()=>r(!a)},a?"Hide reviewed items":"Show reviewed items"),i.length?n.createElement(n.Fragment,null,i.map(c=>n.createElement("div",{className:"a-attention-item",key:c.id},n.createElement("button",{className:"a-attention-open",type:"button","data-action":c.sessionId?"session.select":"view.update",onClick:()=>s(c)},n.createElement("strong",null,c.title),n.createElement("span",null,c.label||c.detail))))):n.createElement("p",null,"All caught up."))}function Ax(e){var t,a;return(a=(t=e==null?void 0:e.attention)==null?void 0:t.items)==null?void 0:a.find(r=>r.id==="completion:"+e.selectedSessionId&&!r.read)}function _x(e,t,a,r=!0){var s,l,c,u;const o=Ax(e),i=!!((s=e==null?void 0:e.view)!=null&&s.panel)||!!((l=e==null?void 0:e.view)!=null&&l.canvasFocused)||!!((c=e==null?void 0:e.view)!=null&&c.navExpanded)&&matchMedia("(max-width:760px)").matches||!!((u=e==null?void 0:e.canvas)!=null&&u.open)&&matchMedia("(max-width:760px)").matches;n.useEffect(()=>{if(!r||!o||i||!a.current)return;const d=a.current;let p;const m=()=>!document.hidden&&document.hasFocus()&&d.clientHeight>0&&getComputedStyle(d).visibility!=="hidden"&&!d.closest("[inert]")&&d.scrollHeight-d.scrollTop-d.clientHeight<40,h=()=>{clearTimeout(p),m()&&(p=setTimeout(()=>{m()&&br(t,[o])},900))};d.addEventListener("scroll",h,{passive:!0}),document.addEventListener("visibilitychange",h),window.addEventListener("focus",h),window.addEventListener("blur",h);const f=new ResizeObserver(h);f.observe(d);for(const g of d.children)f.observe(g);return h(),()=>{clearTimeout(p),f.disconnect(),d.removeEventListener("scroll",h),document.removeEventListener("visibilitychange",h),window.removeEventListener("focus",h),window.removeEventListener("blur",h)}},[o==null?void 0:o.id,o==null?void 0:o.fingerprint,i,t,a,r])}const Ul=new WeakMap,Sg=e=>{var t;return(t=e==null?void 0:e.closest)==null?void 0:t.call(e,"[data-activity-region],.a-model-popover,.a-location-picker,.a-settings-page-body,.a-card,section,form")};function Wu(e){if(!e)return()=>{};const t=Ul.get(e)||{tokens:new Set,busy:e.getAttribute("aria-busy")},a=Symbol();t.tokens.add(a),Ul.set(e,t),e.setAttribute("data-region-pending",""),e.setAttribute("aria-busy","true");let r=!1;return()=>{r||(r=!0,t.tokens.delete(a),t.tokens.size||(e.removeAttribute("data-region-pending"),t.busy===null?e.removeAttribute("aria-busy"):e.setAttribute("aria-busy",t.busy),Ul.delete(e)))}}function Zu(e,t){v.useEffect(()=>t?Wu(e.current):void 0,[t])}function Xt({busy:e=!1,name:t,children:a,className:r="",as:o="div",...i}){const s=v.useRef(null);return Zu(s,e),n.createElement(o,{...i,ref:s,className:r,"data-activity-region":t||""},a)}function Wc(e,t,a){var o;const r=v.useRef(null);return a||(r.current={key:e,value:t}),a&&((o=r.current)==null?void 0:o.key)===e?r.current.value:t}const Ki=[];function il(e,t,a){const r=v.useRef(a);r.current=a,v.useEffect(()=>{if(!e||!t.current)return;let o=!1;const i={};Ki.push(i);const s=d=>!!t.current&&!d.composedPath().includes(t.current),l=d=>{o=s(d)},c=d=>{o&&s(d)&&r.current()},u=d=>{d.key==="Escape"&&Ki.at(-1)===i&&(d.preventDefault(),d.stopImmediatePropagation(),r.current())};return document.addEventListener("pointerdown",l,!0),document.addEventListener("click",c,!0),document.addEventListener("keydown",u,!0),()=>{Ki.splice(Ki.indexOf(i),1),document.removeEventListener("pointerdown",l,!0),document.removeEventListener("click",c,!0),document.removeEventListener("keydown",u,!0)}},[e,t])}function nt({phase:e,message:t,detail:a}){const r=v.useRef(null),o=["working","queued","pending","checking","staging","validating","activating"].includes(e),i=["error","failed"].includes(e),s=o?Ro:i?Uk:e==="neutral"?ug:qk;return v.useEffect(()=>o&&t?Wu(Sg(r.current)):void 0,[o,!!t]),t?n.createElement("div",{ref:r,className:`a-check-result ${o||e==="neutral"?"pending":i?"error":"success"}`,role:i?"alert":"status","aria-live":"polite"},n.createElement(s,{"aria-hidden":"true",className:o?"a-progress-spinner":void 0}),n.createElement("div",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a))):null}const Ju=v.createContext(null);function Pa({id:e,title:t,summary:a,state:r,act:o,children:i}){var m,h,f;const s=v.useContext(Ju),l={setup:["loaded-modules","providers","routing","defaults","conversation"],capabilities:["smart-tools","add-bundles","app-bundles","loaded-modules","registries","share-bundle"],maintenance:["ready-conversations","updates","diagnostics","history","permissions","notifications","automation","repair","reset"]},c=s||((h=(m=r.view)==null?void 0:m.settingsExpanded)==null?void 0:h.find(g=>{var y,E;return!((y=r.view)!=null&&y.settingsSection)||((E=l[r.view.settingsSection])==null?void 0:E.includes(g))})),u=c===e,d=v.useRef();if(v.useEffect(()=>{var g,y,E;u&&!s&&((g=d.current)==null||g.focus({preventScroll:!0}),(E=(y=d.current)==null?void 0:y.closest(".a-dialog"))==null||E.scrollTo(0,0))},[u,s]),s)return u?n.createElement("section",{className:"a-settings-page","data-settings-page":e},n.createElement("div",{id:"settings-group-"+e,className:"a-settings-page-body"},i)):null;if(c&&!u)return null;const p=()=>o("view.update",{patch:{settingsExpanded:u?[]:[e]}});return u?n.createElement("section",{className:"a-settings-page",key:e},n.createElement("button",{type:"button",className:"a-link a-settings-back","data-action":"view.update",onClick:p},n.createElement(Sa,null),"Back to ",{setup:"Setup",capabilities:"Capabilities",maintenance:"Maintenance"}[((f=r.view)==null?void 0:f.settingsSection)||"setup"]),n.createElement("h3",{ref:d,tabIndex:-1},t),n.createElement(zs,{state:r,act:o,page:e}),n.createElement("div",{id:"settings-group-"+e,className:"a-settings-page-body"},i)):n.createElement("section",{className:"a-settings-group"},n.createElement("button",{type:"button",className:"a-settings-group-title","aria-label":t+(a?" "+a:""),"data-action":"view.update",onClick:p},n.createElement("span",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a)),n.createElement(Da,{state:r,page:e}),n.createElement(en,{"aria-hidden":"true"})))}function Cg({id:e,accept:t,disabled:a,action:r,onFile:o,label:i="Choose file",hint:s}){const l=v.useRef(),[c,u]=v.useState(!1),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(!1),y=v.useRef(!1);async function E(b){if(!(!b||a||y.current)){y.current=!0,g(!0),h(""),p(b.name);try{await o(b)}catch(S){h(S.message)}finally{y.current=!1,g(!1)}}}return n.createElement(Xt,{busy:f,name:e,className:`a-file-drop ${c?"drag-over":""}`,onDragOver:b=>{b.preventDefault(),a||u(!0)},onDragLeave:()=>u(!1),onDrop:b=>{var S;b.preventDefault(),u(!1),E((S=b.dataTransfer.files)==null?void 0:S[0])}},n.createElement(mg,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("button",{type:"button",className:"a-soft",disabled:a||f,"data-operation-pending":f||void 0,"aria-busy":f||void 0,"data-action":r,onClick:()=>{var b;return(b=l.current)==null?void 0:b.click()}},i),n.createElement("small",null,d||s||"Drop a file here, or browse to choose one.")),n.createElement("input",{ref:l,id:e,className:"a-file-input",type:"file",accept:t,disabled:a,"data-action":r,"aria-label":i,onChange:b=>{var S;E((S=b.target.files)==null?void 0:S[0]),b.target.value=""}}),m&&n.createElement(nt,{phase:"error",message:m}))}function Px(e){var a;const t=(a=(e.getData("text/uri-list")||e.getData("text/plain")||"").split(` -`).find(r=>r.trim()&&!r.startsWith("#")))==null?void 0:a.trim();if(!t)return null;if(t.startsWith("file://"))try{return decodeURIComponent(new URL(t).pathname)}catch{return null}return t}function Ox({id:e,parent:t,act:a,status:r,listing:o,onCreated:i}){const[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(null),[m,h]=v.useState(""),f=v.useRef(!1);v.useEffect(()=>{u(""),l(!1),h("")},[t]),v.useEffect(()=>{!d||(r==null?void 0:r.commandId)!==d||(r.phase==="error"&&(h(r.error||"Could not create the folder."),p(null),f.current=!1),r.phase==="ready"&&(o==null?void 0:o.createdBy)===d&&(p(null),f.current=!1,u(""),l(!1),i(o.path)))},[d,r==null?void 0:r.commandId,r==null?void 0:r.phase,o==null?void 0:o.createdBy]);async function g(){if(!(!c.trim()||f.current)){f.current=!0,h(""),p("sending");try{const y=await a("locations.create",{controlId:e,path:t,name:c.trim()});if(!(y!=null&&y.accepted)||!y.operationId)throw Error((y==null?void 0:y.error)||"Folder creation was not accepted.");p(y.operationId)}catch(y){f.current=!1,p(null),h(y.message)}}}return n.createElement("div",{className:"a-create-folder"},s?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:e+"-folder-name"},"New folder name"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:e+"-folder-name",value:c,maxLength:255,autoFocus:!0,disabled:!!d,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),g())}}),n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.create",disabled:!!d||!c.trim(),onClick:g},d?"Creating…":"Create folder"),n.createElement("button",{type:"button",className:"a-soft",disabled:!!d,onClick:()=>{l(!1),u(""),h("")}},"Cancel"))):n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:!!d,onClick:()=>l(!0)},n.createElement(Hk,null),"New folder"),m&&n.createElement(nt,{phase:"error",message:m}))}function Ma({id:e,value:t,onChange:a,state:r,act:o,placeholder:i,action:s="view.update",directory:l=!1,multiline:c=!1}){var k,T,I,F,z;const[u,d]=v.useState(!1),[p,m]=v.useState(""),[h,f]=v.useState(""),g=(k=r.view)==null?void 0:k.locationPicker,y=(g==null?void 0:g.controlId)===e,E=((T=r.locationListing)==null?void 0:T.controlId)===e?r.locationListing:null;v.useEffect(()=>{y&&f(g.path??(E==null?void 0:E.path)??"")},[y,g==null?void 0:g.path,E==null?void 0:E.path]);const b=v.useRef(null);il(y,b,()=>o("view.update",{patch:{locationPicker:null}}));const S=(I=r.actionStatus)==null?void 0:I["locations.list"],w=((F=S==null?void 0:S.target)==null?void 0:F.controlId)===e?S:null,N=["working","queued"].includes(w==null?void 0:w.phase),x=Wc(e,E,N),A=U=>(f(U||""),m(""),o("view.update",{patch:{locationPicker:{controlId:e,path:U||""}}}),o("locations.list",{controlId:e,...U?{path:U}:{},directoriesOnly:l})),C=U=>{a(c?[t,U].filter(Boolean).join(` -`):U),o("view.update",{patch:{locationPicker:null}})},O=c?"textarea":"input";return n.createElement("div",{ref:b,className:`a-path-field ${u?"drag-over":""}`,onDragOver:U=>{U.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:U=>{U.preventDefault(),d(!1);const H=Px(U.dataTransfer);H?(m(""),a(c?[t,H].filter(Boolean).join(` -`):H)):m("Your browser hides the full path of dropped files. Use Browse, or drop a copied file or folder path.")}},n.createElement("div",{className:"a-inline-form"},n.createElement(O,{id:e,value:t,placeholder:i,"data-action":s,onChange:U=>a(U.target.value)}),n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.list",onClick:()=>A(!c&&(t!=null&&t.startsWith("/"))?t:void 0)},n.createElement(nr,null),"Browse")),p&&n.createElement(nt,{phase:"error",message:p})," ",y&&n.createElement(Xt,{busy:N,name:e+"-locations",className:"a-location-picker"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,l?"Choose a folder":"Choose a file or folder"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close location picker","data-action":"view.update",onClick:()=>o("view.update",{patch:{locationPicker:null}})},n.createElement(nn,null))),n.createElement("label",{htmlFor:e+"-browse-path"},"Folder path"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:e+"-browse-path",value:h,placeholder:"Type a path, e.g. ~/Projects","data-action":"view.update",onChange:U=>{f(U.target.value),o("view.update",{patch:{locationPicker:{...g,path:U.target.value}}})},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),A(U.currentTarget.value))}}),n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.list",onClick:()=>A(h)},"Go")),(w==null?void 0:w.phase)==="error"&&n.createElement(nt,{phase:"error",message:w.error})," ",N&&!x&&n.createElement(nt,{phase:"working",message:"Loading locations…"}),x&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-settings-row"},n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.list",disabled:x.parent===x.path,onClick:()=>A(x.parent)},n.createElement(Li,null),"Up"),n.createElement("code",{className:"a-wrap"},x.path)),n.createElement(Ox,{id:e,parent:x.path,act:o,status:(z=r.actionStatus)==null?void 0:z["locations.create"],listing:E,onCreated:U=>{f(U),o("view.update",{patch:{locationPicker:{controlId:e,path:U}}})}}),n.createElement("div",{className:"a-location-list"},x.entries.map(U=>n.createElement("button",{type:"button",className:"a-location-entry",key:U.path,"data-action":U.directory?"locations.list":s,onClick:()=>U.directory?A(U.path):C(U.path)},U.directory&&n.createElement(nr,null),U.name,U.directory&&n.createElement(en,null))),!x.entries.length&&n.createElement("p",null,"No ",l?"folders":"files"," here.")),x.truncated&&n.createElement("p",null,"Showing the first 300 items. Enter a more specific path above."),n.createElement("button",{type:"button",className:"a-primary","data-action":s,onClick:()=>C(x.path)},"Use this folder"))))}function Ng({id:e,value:t,onChange:a,state:r,act:o,action:i="view.update"}){var d,p,m,h;const s=((p=(d=r.view)==null?void 0:d.bundleSources)==null?void 0:p.includes(e))||!1,l=f=>{var g,y;return o("view.update",{patch:{bundleSources:f?[...new Set([...((g=r.view)==null?void 0:g.bundleSources)||[],e])]:(((y=r.view)==null?void 0:y.bundleSources)||[]).filter(E=>E!==e)}})};v.useEffect(()=>{o("bundles.list",{})},[]);const c=r.registeredBundles||[{name:"work",label:"Work",value:"work"}],u=c.find(f=>f.value===t);return n.createElement(Xt,{busy:["queued","working"].includes((h=(m=r.actionStatus)==null?void 0:m["bundles.list"])==null?void 0:h.phase),name:"bundles-"+e,className:"a-bundle-picker"},n.createElement("select",{id:e,"aria-label":"Registered root bundles",value:u?t:":custom:","data-action":i,onChange:f=>{f.target.value===":custom:"?l(!0):a(f.target.value)}},n.createElement("option",{value:":custom:"},t&&!u?t:"Choose a bundle"),c.map(f=>n.createElement("option",{value:f.value,key:f.value},f.label||f.name))),(u==null?void 0:u.description)&&n.createElement("p",{className:"a-caption"},u.description),n.createElement("button",{type:"button",className:"a-link","aria-expanded":s,"data-action":"view.update",onClick:()=>l(!s)},s?"Hide source":"Use a bundle source or file"),s&&n.createElement(Ma,{action:i,id:e+"-source",value:t,onChange:a,state:r,act:o,placeholder:"Bundle name, git URL or file path"}))}const Rg=e=>{var t;return((t=e==null?void 0:e.result)==null?void 0:t.accepted)!==void 0?e.result:e};function sl({state:e,act:t,mode:a="create",fromDraft:r=!1,onDone:o,onCancel:i}){var T,I;const[s,l]=v.useState(a),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(null),[y,E]=v.useState(!1),[b,S]=v.useState(""),w=v.useRef(!1),N=v.useRef(null),x=v.useId();v.useEffect(()=>{var F,z;(z=(F=N.current)==null?void 0:F.querySelector("input"))==null||z.focus()},[s]);const A=F=>z=>{F(z),g(null),S("")},C=async(F,z)=>{const U=Rg(await t(F,z));if(!U||U.accepted===!1)throw Error((U==null?void 0:U.error)||"Could not save. Your choices are kept.");return U.result},O=async F=>{if(F.preventDefault(),!w.current){w.current=!0,E(!0),S("");try{if(s==="attach"){const H=await C("workspace.add",{path:d,fromDraft:r});o==null||o(H);return}const z=f||await C("workspace.prepare",{name:c,...m.trim()?{root:m.trim()}:{}});if(g(z),z.disposition!=="create")return;const U=await C("workspace.create",{planId:z.planId,fromDraft:r});o==null||o(U)}catch(z){S(z.message)}finally{w.current=!1,E(!1)}}},k=async()=>{if(!w.current){w.current=!0,E(!0),S("");try{const F=await C("workspace.add",{path:f.path,fromDraft:r});o==null||o(F)}catch(F){S(F.message)}finally{w.current=!1,E(!1)}}};return n.createElement("form",{ref:N,className:"a-workspace-setup",onSubmit:O,"aria-label":s==="attach"?"Use existing folder":"Create workspace","aria-busy":y},n.createElement("div",{className:"a-workspace-setup-heading"},n.createElement("h3",null,s==="attach"?"Use an existing folder":"New workspace"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Cancel workspace setup",disabled:y,onClick:i},n.createElement(nn,null))),s==="create"?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:x+"-name"},"Workspace name"),n.createElement("input",{id:x+"-name",value:c,maxLength:200,required:!0,disabled:y,placeholder:"e.g. Launch plan",onChange:F=>A(u)(F.target.value)}),n.createElement("details",null,n.createElement("summary",null,"More options"),n.createElement("label",{htmlFor:x+"-root"},"Create in"),n.createElement(Ma,{id:x+"-root",value:m,placeholder:((T=e.workspaceDefaults)==null?void 0:T.root)||"Default workspace folder",directory:!0,state:e,act:t,onChange:A(h)}),n.createElement("p",{className:"a-caption"},"A new folder will be created here. Change the default in Settings → Workspaces."))):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:x+"-folder"},"Folder on ",((I=e.workspaceDefaults)==null?void 0:I.hostLabel)||"this host"),n.createElement(Ma,{id:x+"-folder",value:d,directory:!0,state:e,act:t,onChange:A(p),placeholder:"~/dev/my-project"}),n.createElement("p",{className:"a-caption"},"Work with files here. Existing Amplifier chats will appear automatically.")),f&&f.disposition!=="create"&&n.createElement("p",{role:"status"},f.disposition==="open"?"This folder already has a workspace.":f.disposition==="attach"?"This folder already exists. Use it as a workspace?":"A file already uses this name. Choose another name.",n.createElement("span",{className:"a-workspace-destination"},f.path)),b&&n.createElement("p",{role:"alert",className:"a-danger"},b),n.createElement("div",{className:"a-workspace-setup-actions"},n.createElement("button",{type:"button",className:"a-link",disabled:y,onClick:i},"Cancel"),f&&["open","attach"].includes(f.disposition)?n.createElement("button",{type:"button",className:"a-primary",disabled:y,onClick:k},f.disposition==="open"?"Open workspace":"Use folder"):n.createElement("button",{type:"submit",className:"a-primary",disabled:y||!(s==="create"?c.trim():d.trim())},y?"Saving…":s==="create"?"Create workspace":"Use folder")),n.createElement("button",{type:"button",className:"a-link",disabled:y,onClick:()=>{l(s==="create"?"attach":"create"),g(null),S("")}},s==="create"?"Use an existing folder":"Create a new workspace"))}function Mx({state:e,act:t,setup:a,onChange:r}){var H,te;const[o,i]=v.useState(null),[s,l]=v.useState([]),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(!1),[f,g]=v.useState(0),[y,E]=v.useState(!0),[b,S]=v.useState(0),[w,N]=v.useState(0),[x,A]=v.useState(!1),C=v.useRef(null),O=v.useRef(!1),k=v.useRef(null),T=v.useId(),I=40;v.useEffect(()=>{var j;o||(j=C.current)==null||j.focus()},[o]),v.useEffect(()=>{if(o)return;let j=!0;E(!0),p(""),l([]);const _=setTimeout(()=>{Promise.resolve(t("workspace.list",{query:c,offset:f*I,limit:I})).then(P=>{const G=Rg(P);if(!(G!=null&&G.accepted))throw Error((G==null?void 0:G.error)||"Could not load workspaces.");j&&(l(G.result.items),h(G.result.nextOffset!=null),S(G.result.total||0),k.current&&(k.current.scrollTop=0))}).catch(P=>{j&&p(P.message)}).finally(()=>{j&&E(!1)})},c?150:0);return()=>{j=!1,clearTimeout(_)}},[c,f,(H=e.workspaces)==null?void 0:H.length,o,w]);const F=async j=>{if(!O.current){O.current=!0,A(!0),p("");try{await r({workspace:j,location:{kind:j?"workspace":"managed"}})}catch(_){p(_.message)}finally{O.current=!1,A(!1)}}},z=((te=a.location)==null?void 0:te.kind)==="managed"?"":a.workspace||"",U=j=>{const _=j.split("/").filter(Boolean);return _.pop(),_.length>3?"…/"+_.slice(-3).join("/"):"/"+_.join("/")};return o?n.createElement("div",{className:"a-workspace-picker"},n.createElement("button",{type:"button",className:"a-link a-picker-back",onClick:()=>i(null)},n.createElement(Sa,null),"Back to workspaces"),n.createElement("h3",null,o==="create"?"New workspace":"Use an existing folder"),n.createElement(sl,{state:e,act:t,mode:o,fromDraft:!0,onCancel:()=>i(null),onDone:j=>F(j.path)}),d&&n.createElement("p",{role:"alert"},d)):n.createElement("div",{className:"a-workspace-picker","aria-busy":x},n.createElement("button",{type:"button",className:"a-picker-choice","aria-pressed":!z,disabled:x,onClick:()=>F("")},n.createElement(Fi,null),n.createElement("span",null,n.createElement("strong",null,"No workspace"),n.createElement("small",null,"Keep this conversation on its own.")),!z&&n.createElement(Pt,null)),n.createElement("label",{className:"a-picker-search",htmlFor:T+"-search"},n.createElement(To,null),n.createElement("input",{ref:C,id:T+"-search",type:"search",maxLength:500,"aria-label":"Find a workspace",placeholder:"Search workspaces by name or folder",value:c,onChange:j=>{g(0),u(j.target.value)}})),n.createElement("div",{ref:k,className:"a-picker-results","aria-label":"Workspaces","aria-busy":y},y?n.createElement("p",{role:"status"},"Finding workspaces…"):d?n.createElement("p",{role:"alert"},d," ",n.createElement("button",{type:"button",className:"a-link",onClick:()=>N(w+1)},"Try again")):s.length?n.createElement("ul",null,s.map(j=>n.createElement("li",{key:j.id},n.createElement("button",{type:"button",className:"a-picker-choice","aria-label":j.name+" · "+j.path,"aria-pressed":z===j.path,disabled:x,title:j.path,onClick:()=>F(j.path)},n.createElement(Fr,null),n.createElement("span",null,n.createElement("strong",null,j.name),n.createElement("small",null,U(j.path))),z===j.path&&n.createElement(Pt,null))))):n.createElement("p",{role:"status"},c?"No matching workspaces. Try a name or part of its folder path.":"No workspaces yet. Create one or use an existing folder below.")),!y&&!d&&(f>0||m)&&n.createElement("div",{className:"a-picker-pages"},n.createElement("span",null,f*I+1,"–",f*I+s.length," of ",b),n.createElement("button",{type:"button",className:"a-link",disabled:!f,onClick:()=>g(f-1)},"Previous"),n.createElement("button",{type:"button",className:"a-link",disabled:!m,onClick:()=>g(f+1)},"Next")),n.createElement("div",{className:"a-picker-actions"},n.createElement("button",{type:"button",disabled:x,onClick:()=>i("create")},n.createElement(Ln,null),"New workspace"),n.createElement("button",{type:"button",disabled:x,onClick:()=>i("attach")},n.createElement(nr,null),"Use existing folder")))}function zx({state:e,act:t}){var u,d,p,m,h,f;const[a,r]=v.useState(((d=(u=e.settings)==null?void 0:u.workspaces)==null?void 0:d.defaultRoot)||""),[o,i]=v.useState(""),[s,l]=v.useState(!1),c=async g=>{g.preventDefault(),l(!0);try{const y=await t("settings.update",{patch:{workspaces:{defaultRoot:a.trim()}}});if(!y||y.accepted===!1)throw Error((y==null?void 0:y.error)||"Could not save.");i("Saved. Existing workspaces stay where they are.")}catch(y){i(y.message)}finally{l(!1)}};return n.createElement("form",{className:"a-workspace-setup",onSubmit:c},n.createElement("h3",null,"Where new workspaces live"),n.createElement("p",null,"Name a workspace and Amplifier creates its folder here."),n.createElement("label",{htmlFor:"default-workspace-root"},"Default workspace folder on ",((p=e.workspaceDefaults)==null?void 0:p.hostLabel)||"this host"),n.createElement(Ma,{id:"default-workspace-root",value:a,directory:!0,state:e,act:t,onChange:r,placeholder:(m=e.workspaceDefaults)==null?void 0:m.root}),n.createElement("p",{className:"a-caption"},"Leave blank to use Amplifier’s workspace folder. This only affects new workspaces."),n.createElement("button",{className:"a-primary",disabled:s},"Save"),o&&n.createElement("p",{role:"status"},o),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:!!((f=(h=e.settings)==null?void 0:h.workspaces)!=null&&f.showPaths),onChange:g=>t("settings.update",{patch:{workspaces:{showPaths:g.target.checked}}})}),"Show folder paths in the sidebar"))}function ji({state:e,act:t,onOpen:a,onEdit:r,heading:o=!0,previewLimit:i=1/0,compact:s=!1,onSelect:l}){var U,H,te,j,_,P,G;const c=ol(),u=e.workspaceExplorer||{},d=s?e.workspaceShortcuts||[]:u.rows||[],p=u.breadcrumbs||[],[m,h]=v.useState(!1),g=!m&&!u.filter&&u.mode==="recent"&&(u.page||1)===1?d.slice(0,i):d,[y,E]=v.useState(u.filter||""),b=v.useRef(null);v.useEffect(()=>{b.current=null,E(u.filter||"")},[e.selectedWorkspaceId]),v.useEffect(()=>{(b.current===null||b.current===u.filter)&&(b.current=null,E(u.filter||""))},[u.filter]);const[S,w]=v.useState(0),N=v.useRef(null);Zu(N,S>0||!!((U=e.sharedHistory)!=null&&U.loading));const x=async W=>{w(D=>D+1);try{return await t("view.update",{patch:W})}finally{w(D=>D-1)}},A=W=>(b.current=null,E(""),x({navWorkspacePath:W,navWorkspaceFilter:"",navWorkspacePage:1,navWorkspaceAncestorsOpen:!1,navWorkspaceMode:"folders"})),C=W=>{b.current=W,E(W),Promise.resolve(x({navWorkspaceFilter:W,navWorkspacePage:1})).then(D=>{b.current===W&&(!D||D.accepted===!1?(b.current=null,E(u.filter||"")):b.current=null)}).catch(()=>{b.current===W&&(b.current=null,E(u.filter||""))})},O=async W=>{if(l)return l(W);const D=await t("workspace.select",{id:W.workspaceId});D&&D.accepted!==!1&&await(a==null?void 0:a())},k=p.length>3?p.slice(0,-2):[],T=k.length?p.slice(-2):p,I=u.page||1,F=u.pages||1,z=W=>W.name===W.path&&W.path.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||W.name;return n.createElement("section",{ref:N,"data-activity-region":"workspace-folders",className:"a-workspace-explorer","data-part":"workspace-explorer","data-compact":s,"data-show-paths":!!((te=(H=e.settings)==null?void 0:H.workspaces)!=null&&te.showPaths),"aria-label":"Workspace folders"},!s&&n.createElement("div",{className:"a-workspace-modes",role:"group","aria-label":"Workspace list"},n.createElement("button",{type:"button","aria-pressed":u.mode==="recent","data-action":"view.update",onClick:()=>x({navWorkspaceMode:"recent",navWorkspacePage:1})},"Recent"),n.createElement("button",{type:"button","aria-pressed":!s&&u.mode!=="recent","data-action":"view.update",onClick:()=>x({navWorkspaceMode:"folders",navWorkspacePage:1})},"Browse folders")),o&&!s&&n.createElement("div",{className:"a-workspace-explorer-heading"},n.createElement("strong",null,"Workspaces"),n.createElement("span",null,u.totalWorkspaces||0)),!s&&n.createElement("div",{className:"a-nav-search a-workspace-search"},n.createElement(To,null),n.createElement("input",{type:"search","aria-label":"Filter workspaces",placeholder:"Find workspace · * ? patterns",value:y,"data-action":"view.update",onChange:W=>C(W.target.value)})),!s&&u.mode!=="recent"&&!u.filter&&n.createElement("div",{className:"a-workspace-location"},n.createElement("button",{type:"button",className:"a-icon","aria-label":"Go to parent workspace folder",disabled:u.parentPath==null,"data-action":"view.update",onClick:()=>A(u.parentPath)},n.createElement(Sa,null)),n.createElement("nav",{className:"a-workspace-breadcrumbs","aria-label":"Workspace folder path"},k.length>0&&n.createElement("div",{className:"a-workspace-ancestors","data-open":!!((j=e.view)!=null&&j.navWorkspaceAncestorsOpen)},n.createElement("button",{type:"button",className:"a-workspace-ancestor-toggle","aria-label":"Show ancestor folders","aria-expanded":!!((_=e.view)!=null&&_.navWorkspaceAncestorsOpen),"data-action":"view.update",onClick:()=>{var W;return x({navWorkspaceAncestorsOpen:!((W=e.view)!=null&&W.navWorkspaceAncestorsOpen)})}},n.createElement(Di,null)),((P=e.view)==null?void 0:P.navWorkspaceAncestorsOpen)&&n.createElement("div",null,k.map(W=>n.createElement("button",{key:W.path,type:"button","data-action":"view.update","aria-label":"Browse "+(W.path||"all workspace folders"),onClick:()=>A(W.path)},W.path||"All workspace folders")))),T.map((W,D)=>n.createElement(n.Fragment,{key:W.path},(D>0||k.length>0)&&n.createElement(en,{"aria-hidden":"true"}),n.createElement("button",{type:"button","data-action":"view.update","aria-current":D===T.length-1?"location":void 0,title:W.path||"All workspace folders","aria-label":"Browse "+(W.path||"all workspace folders"),onClick:()=>A(W.path)},z(W)))))),n.createElement("div",{className:"a-workspace-folders"},g.map(W=>{var me,_e,Je,De;const D=!!W.workspaceId,ne=D&&W.workspaceId===(((me=e.view)==null?void 0:me.workWorkspaceId)||e.selectedWorkspaceId),q="Browse "+W.path,Z=W.activityCounts||{},ie=Z.attention?{kind:"attention",label:`${Z.attention} chats need attention`}:Z.working?{kind:"working",label:`${Z.working} chats working`}:W.unread?{kind:"unread",label:`${W.unread} chats with unread activity`}:null,ke=n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-workspace-select","data-navigation-select":!0,"data-action":D?"workspace.select":"view.update","aria-label":D?"Open chats in "+W.path:q,"aria-pressed":D?ne:void 0,onClick:()=>D?O(W):A(W.path)},ie?n.createElement(Hu,{activity:ie}):D?n.createElement(Bk,null):n.createElement(Fr,null),n.createElement("span",{className:"a-workspace-label"},n.createElement("span",null,W.customName||W.name),n.createElement("small",{className:"a-workspace-result-path",title:W.path},(Je=(_e=e.settings)==null?void 0:_e.workspaces)!=null&&Je.showPaths?W.path:Sx(W))),n.createElement("span",{className:"a-workspace-count","aria-label":`${D?W.chatCount:W.descendantWorkspaceCount} ${D?"chats":"workspaces"}`},D?W.chatCount:W.descendantWorkspaceCount),!D&&W.canBrowse&&n.createElement(en,{className:"a-workspace-arrow"})),!s&&D&&W.canBrowse&&n.createElement("button",{type:"button",className:"a-workspace-drill","data-action":"view.update","aria-label":q,title:`${W.descendantWorkspaceCount} nested workspaces`,onClick:()=>A(W.path)},n.createElement(en,null)));return D?n.createElement(Vu,{className:`a-workspace-row is-workspace ${ne?"is-selected":""}`,key:W.path,"data-workspace-path":W.path,"data-qualified":!W.customName&&((De=W.pathLabel)==null?void 0:De.includes("/")),label:W.customName||W.name,details:({close:ue})=>{var ye;return n.createElement(wg,{row:W,now:c,actions:n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-link","data-action":"workspace.select",onClick:()=>{ue(),O(W)}},n.createElement(Fi,null),"Open chats"),n.createElement("button",{type:"button","data-action":"view.update",onClick:()=>{ue(),A(W.parentPath??hg(W.path))}},n.createElement(Fr,null),"Browse parent"),r&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button","data-action":"view.update",onClick:()=>{ue(),r({mode:"rename",id:W.workspaceId,name:W.customName||W.name})}},n.createElement(qi,null),"Rename"),n.createElement("button",{type:"button",className:"a-danger",disabled:((ye=e.library)==null?void 0:ye.workspaceCount)<2,"data-action":"view.update",onClick:()=>{ue(),r({mode:"remove",id:W.workspaceId,name:W.customName||W.name})}},n.createElement(ea,null),"Remove")))})}},ke):n.createElement("div",{className:"a-workspace-row",key:W.path,"data-workspace-path":W.path},ke)})),g.lengthh(!0)},"More workspaces",n.createElement(en,null)),!d.length&&!((G=e.sharedHistory)!=null&&G.loading)&&n.createElement("p",{className:"a-nav-empty"},u.filter?"No matching workspaces.":"Create a workspace to start a chat."),!s&&F>1&&g.length===d.length&&n.createElement("div",{className:"a-nav-pagination a-workspace-pagination"},n.createElement("span",null,"Page ",I," of ",F),n.createElement("div",null,n.createElement("button",{type:"button",className:"a-link","aria-label":"Show previous workspace folders","data-action":"view.update",disabled:I<=1,onClick:()=>x({navWorkspacePage:I-1})},"Previous"),n.createElement("button",{type:"button",className:"a-link","aria-label":"Show more workspace folders","data-action":"view.update",disabled:I>=F,onClick:()=>x({navWorkspacePage:I+1})},"More",n.createElement(en,null)))))}function Lx({state:e,act:t}){const a=e.view||{},r=e.conversationOrganization||{};return n.createElement("div",{"aria-label":"Conversation library filters"},n.createElement("label",null,"Conversations",n.createElement("select",{"aria-label":"Active or archived conversations",value:a.navArchive||"active","data-action":"view.update",onChange:o=>t("view.update",{patch:{navArchive:o.target.value}})},n.createElement("option",{value:"active"},"Active"),n.createElement("option",{value:"archived"},"Archived (",r.archivedCount||0,")"),n.createElement("option",{value:"all"},"Active and archived"))))}function Dx({state:e,session:t,act:a}){var u;const r=Object.hasOwn(((u=e.conversationOrganization)==null?void 0:u.archived)||{},t.id),[o,i]=v.useState(!1),[s,l]=v.useState("");async function c(){i(!0),l("");try{const d=await a(r?"session.restore":"session.archive",{id:t.id});if(!(d!=null&&d.accepted))throw Error("The change was not saved.")}catch(d){l(d.message)}finally{i(!1)}}return n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Conversation library"),n.createElement("p",null,"Archive keeps this conversation and its files. Work already running continues."),n.createElement("button",{type:"button",className:"a-soft",disabled:o,"data-action":r?"session.restore":"session.archive",onClick:c},r?n.createElement(Pk,null):n.createElement(wi,null),r?"Restore conversation":"Archive conversation"),s&&n.createElement("p",{role:"alert",className:"a-danger"},s))}function Fx({session:e,act:t}){const[a,r]=v.useState(null),[o,i]=v.useState([]),[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(604800),m=v.useRef(0),[h,f]=v.useState(null);v.useEffect(()=>(m.current++,r(null),i([]),f(null),u(""),l(!1),()=>{m.current++}),[e.id]);async function g(b,S,w){const N=m.current;l(!0),u("");try{const x=await t(b,S);if(!(x!=null&&x.result))throw Error("The snapshot action did not return a result.");N===m.current&&w(x.result)}catch(x){N===m.current&&u(x.message)}finally{N===m.current&&l(!1)}}const y=b=>i(S=>[b,...S.filter(w=>w.id!==b.id)]),E=(b=0)=>g("session.shareList",{sessionId:e.id,offset:b},S=>{i(w=>b?[...w,...S.items.filter(N=>!w.some(x=>x.id===N.id))]:S.items),f(S.nextOffset)});return n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Share a snapshot"),n.createElement("p",null,"A snapshot includes visible conversation text and voice exchanges. File contents and interactive artifacts are not embedded."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.sharePreview",onClick:()=>g("session.sharePreview",{sessionId:e.id},r)},n.createElement(dx,null),"Preview snapshot"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.shareList",onClick:()=>E()},"Show shared snapshots")),a&&n.createElement(n.Fragment,null,n.createElement("pre",{className:"a-state-view","aria-label":"Snapshot preview",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",maxHeight:320}},a.text),a.nextOffset!==null&&n.createElement("button",{type:"button",className:"a-link",disabled:s,"data-action":"session.shareRead",onClick:()=>g("session.shareRead",{id:a.id,offset:a.nextOffset},b=>r(S=>({...S,text:S.text+b.text,nextOffset:b.nextOffset})))},"Read more of this snapshot"),n.createElement("p",null,"Anyone with the link can read this snapshot while this host is reachable. Later edits stay private to the original chat. You can revoke the link."),n.createElement("label",{htmlFor:"share-expiry"},"Link expires after"),n.createElement("select",{id:"share-expiry",value:d,onChange:b=>p(Number(b.target.value))},n.createElement("option",{value:86400},"One day"),n.createElement("option",{value:604800},"One week"),n.createElement("option",{value:2592e3},"Thirty days")),n.createElement("button",{type:"button",className:"a-primary",disabled:s,"data-action":"session.shareCreate",onClick:()=>g("session.shareCreate",{id:a.id,contentHash:a.contentHash,visibility:"anyone_with_link",expiresInSeconds:d},b=>{y(b),r(null)})},"Create share link")),o.map(b=>n.createElement("div",{className:"a-selection-card",key:b.id},n.createElement("strong",null,b.title),n.createElement("p",null,b.status,b.expiresAt?" · expires "+new Date(b.expiresAt*1e3).toLocaleString():""),b.path&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"share-"+b.id},"Snapshot link"),n.createElement("input",{id:"share-"+b.id,readOnly:!0,value:new URL(b.path,window.location.origin).href}),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>navigator.clipboard.writeText(new URL(b.path,window.location.origin).href).catch(()=>u("Copy was unavailable. Select the link and copy it."))},n.createElement(rr,null),"Copy link"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.shareRevoke",onClick:()=>g("session.shareRevoke",{id:b.id},y)},"Revoke link")))),h!==null&&n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.shareList",onClick:()=>E(h)},"Load older snapshots"),c&&n.createElement("p",{role:"alert",className:"a-danger"},c))}function Tg({id:e,act:t,cancel:a}){var y;const[r,o]=v.useState(null),[i,s]=v.useState(!1),[l,c]=v.useState(""),[u,d]=v.useState(!1),p=v.useRef(0),m=v.useRef(!1);async function h(){var b;const E=++p.current;o(null),c(""),s(!0);try{const S=await t("session.deletePreview",{id:e});if(!(S!=null&&S.accepted)||!((b=S.result)!=null&&b.confirmationToken))throw Error((S==null?void 0:S.error)||"Could not review this chat for deletion.");E===p.current&&o(S.result)}catch(S){E===p.current&&c(S.message)}finally{E===p.current&&s(!1)}}v.useEffect(()=>(h(),()=>{p.current++}),[e]);async function f(){var b;if(!r||m.current)return;const E=p.current;m.current=!0,s(!0),c("");try{const S=await t("session.delete",{id:e,confirmationToken:r.confirmationToken});if(!(S!=null&&S.accepted))throw Error((S==null?void 0:S.error)||"Deletion was not confirmed. Review the chat again before retrying.");E===p.current&&((b=S.result)!=null&&b.cleanupPending?(d(!0),o(null)):a())}catch(S){E===p.current&&(c(S.message),o(null))}finally{m.current=!1,E===p.current&&s(!1)}}const g=r==null?void 0:r.summary;return n.createElement("div",{className:"a-chat-delete","aria-busy":i},r?n.createElement(n.Fragment,null,n.createElement("p",null,"Permanently delete ",n.createElement("strong",null,r.title||"this chat"),"?"),n.createElement("p",null,r.description),g&&n.createElement("p",{className:"a-caption"},g.conversationCount," saved conversation",g.conversationCount===1?"":"s"," · ",g.fileCount," file",g.fileCount===1?"":"s"," · ",g.attachmentCount," attachment",g.attachmentCount===1?"":"s"," · ",g.artifactCount," artifact",g.artifactCount===1?"":"s"," · ",g.shareCount," published link",g.shareCount===1?"":"s"),n.createElement("p",null,n.createElement("strong",null,"This cannot be undone.")),!!((y=r.preserved)!=null&&y.length)&&n.createElement("p",{className:"a-caption"},"Kept: ",r.preserved.join("; "),".")):i?n.createElement("p",{role:"status"},"Checking what will be deleted…"):null,u&&n.createElement("p",{role:"status"},"The chat has been removed. File cleanup is pending and will be retried automatically."),l&&n.createElement("p",{role:"alert",className:"a-danger"},l),n.createElement("div",{className:"a-dialog-actions"},r?n.createElement("button",{type:"button",className:"a-soft a-danger","data-action":"session.delete",disabled:i,onClick:f},i?"Deleting…":"Delete permanently"):!i&&!u&&n.createElement("button",{type:"button",className:"a-soft","data-action":"session.deletePreview",onClick:h},"Review again"),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:m.current,onClick:a},u?"Close":"Keep chat")))}function Ku(e,t){return e.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}const ia=(e,t)=>e("view.update",{patch:t});function qx({chat:e,act:t,cancel:a,inputId:r="nav-workspace-name"}){var E,b;const[o,i]=v.useState(e.title||""),[s,l]=v.useState(!1),[c,u]=v.useState(""),d=v.useRef(!1),p=v.useRef(!1),m=((E=e.naming)==null?void 0:E.status)==="working",h=e.configurationBusy,f=e.autoName??(e.titleSource!=="manual"&&e.nativeNameSource!=="manual");v.useEffect(()=>{p.current||i(e.title||"")},[e.title]);const g=async S=>{S.preventDefault();const w=o.trim();if(!(!w||d.current)){d.current=!0,l(!0),u("");try{const N=await t("session.rename",{id:e.id,title:w});N&&N.accepted!==!1?a():u((N==null?void 0:N.error)||"Could not rename. Your text is kept; try again.")}catch(N){u(N.message||"Could not rename. Please try again.")}finally{d.current=!1,l(!1)}}};async function y(){if(!(d.current||m||h||o!==(e.title||""))){d.current=!0,l(!0),u("");try{const S=await t("session.naming",{id:e.id,regenerate:!0});if(!S||S.accepted===!1)throw Error((S==null?void 0:S.error)||"Could not generate a name. Your current name is kept.")}catch(S){u(S.message)}finally{d.current=!1,l(!1)}}}return n.createElement("form",{"aria-busy":s||m,className:"a-nav-chat a-nav-chat-rename","data-session-id":e.id,onSubmit:g},n.createElement("input",{id:r,maxLength:200,"aria-label":`New name for ${e.title||"conversation"}`,value:o,disabled:s,required:!0,autoFocus:!0,onChange:S=>{p.current=S.target.value!==(e.title||""),i(S.target.value),u("")}}),n.createElement("button",{type:"submit",className:"a-icon a-nav-chat-edit","aria-label":"Save conversation name",disabled:s||!o.trim(),"data-action":"session.rename"},n.createElement(Pt,null)),n.createElement("button",{type:"button",className:"a-icon a-nav-chat-edit","aria-label":"Cancel conversation rename",disabled:s,"data-action":"view.update",onClick:a},n.createElement(nn,null)),n.createElement("button",{type:"button",className:"a-link","data-action":"session.naming",disabled:s||m||h||o!==(e.title||""),onClick:y},n.createElement(Mt,null),m?"Naming…":"Auto name now"),n.createElement("small",{className:"a-nav-name-help"},"Generate one name. Future automatic naming stays ",f?"on":"off",".",h?" Finish changing the conversation configuration first.":o!==(e.title||"")?" Save or cancel your edit first.":""),m&&n.createElement("small",{role:"status"},"Generating chat name…"),(c||((b=e.naming)==null?void 0:b.error))&&n.createElement("small",{role:"alert",className:"a-danger"},c||e.naming.error))}function fo(e,t){var k,T,I;const a=Ku(n,e),r=e.dispatch,o=e.instanceId==="workspaces"?"nav-workspace":"nav-"+e.instanceId,i=a.view||{},s=i.workspaceDraft||{},l=(t==="chats"?(k=s.mode)!=null&&k.startsWith("chat-"):!((T=s.mode)!=null&&T.startsWith("chat-")))?s:{},c=v.useRef(null),u=v.useRef(l),d=v.useRef(0),p=v.useRef(!1),[m,h]=v.useState(!1),[f,g]=v.useState("");v.useEffect(()=>{u.current=l},[l]);const y=a.sharedHistory||{},E=!!(y.loading||y.refreshing),b=al(a),S=b.find(F=>F.id===a.selectedWorkspaceId),w=(I=a.library)!=null&&I.bounded?a.library.workspaceCount:b.length,N=i.navChatScope==="all",x=F=>{d.current++,u.current=F,g(""),ia(r,{workspaceDraft:F})},A=F=>x({...l,...F}),C=F=>r("session.select",{id:F}),O=async F=>{var U;if(F.preventDefault(),p.current)return;const z=d.current;p.current=!0,h(!0),g("");try{let H;l.mode==="add"?H=await r("workspace.create",{path:l.path||"",...(U=l.name)!=null&&U.trim()?{name:l.name.trim()}:{}}):l.mode==="rename"?H=await r("workspace.rename",{id:l.id,name:l.name||""}):l.mode==="chat-rename"?H=await r("session.rename",{id:l.id,title:l.name||""}):l.mode==="remove"&&(H=await r("workspace.remove",{id:l.id})),H&&H.accepted!==!1?d.current===z&&x({}):g((H==null?void 0:H.error)||"Could not save. Check the folder or name and try again.")}catch(H){g(H.message||"Could not save. Please try again.")}finally{p.current=!1,h(!1)}};return v.useEffect(()=>{var F,z,U,H,te;l.mode&&((z=(F=c.current)==null?void 0:F.scrollIntoView)==null||z.call(F,{block:"nearest"}),(te=(H=(U=c.current)==null?void 0:U.querySelector)==null?void 0:H.call(U,"input"))==null||te.focus())},[l.mode,l.id]),{state:a,act:r,prefix:o,view:i,draft:l,form:c,saving:m,formError:f,history:y,refreshing:E,workspace:S,workspaceCount:w,allChats:N,setDraft:x,updateDraft:A,choose:C,submit:O}}function go({model:e}){var p;const{state:t,act:a,prefix:r,draft:o,form:i,saving:s,formError:l,setDraft:c,updateDraft:u,submit:d}=e;return o.mode==="add"?n.createElement(sl,{state:t,act:a,onDone:()=>c({}),onCancel:()=>c({})}):n.createElement(n.Fragment,null,o.mode==="chat-delete"&&n.createElement("div",{className:"a-nav-form"},n.createElement("strong",null,"Delete chat?"),n.createElement(Tg,{key:o.id,id:o.id,act:a,cancel:()=>c({})}))," ",o.mode&&o.mode!=="chat-rename"&&o.mode!=="chat-delete"&&n.createElement("form",{ref:i,className:"a-nav-form","aria-busy":s,onSubmit:d},n.createElement("div",{className:"a-nav-form-title"},n.createElement("strong",null,o.mode==="add"?"New workspace":o.mode==="rename"?"Rename workspace":o.mode==="chat-rename"?"Rename chat":"Remove workspace?"),n.createElement("button",{className:"a-icon",type:"button","aria-label":"Cancel navigation edit","data-action":"view.update",onClick:()=>c({})},n.createElement(nn,null))),o.mode==="add"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Choose an existing folder, or enter a path to create one. Your first chat opens here."),n.createElement("label",{htmlFor:r+"-path"},"Folder"),n.createElement(Ma,{id:r+"-path",value:o.path||"",onChange:m=>u({path:m}),directory:!0,state:t,act:a,placeholder:"~/Projects/my-project"})),["add","rename","chat-rename"].includes(o.mode)?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:r+"-name"},o.mode==="add"?"Name (optional)":"Name"),n.createElement("input",{id:r+"-name",maxLength:200,value:o.name||"",required:o.mode!=="add","data-action":"view.update",onChange:m=>u({name:m.target.value})})):n.createElement("p",null,"Remove ",o.name," from this list? Its files and chats will stay on disk."),n.createElement("button",{type:"submit",disabled:s||o.mode==="add"&&!((p=o.path)!=null&&p.trim()),className:o.mode==="remove"?"a-soft a-danger":"a-primary","data-action":o.mode==="add"?"workspace.create":o.mode==="rename"?"workspace.rename":o.mode==="remove"?"workspace.remove":"session.rename"},s?"Saving…":o.mode==="add"?"Create workspace":o.mode==="remove"?"Remove registration":"Save name"),l&&n.createElement("p",{role:"alert",className:"a-danger"},l)))}function Ux({host:e,paired:t=!1}){const a=fo(e,"workspaces"),{state:r,act:o,allChats:i,workspace:s,workspaceCount:l,setDraft:c}=a;return t?n.createElement(go,{model:a}):n.createElement(n.Fragment,null,n.createElement(go,{model:a})," ",!i&&n.createElement(ji,{state:r,act:o}),!i&&s&&n.createElement("div",{className:"a-nav-workspace-path"},n.createElement("span",{className:"a-workspace-full-path",title:s.path||"Project folder unavailable"},s.path||"Project folder unavailable"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Rename workspace","data-action":"view.update",onClick:()=>c({mode:"rename",id:s.id,name:s.name})},n.createElement(qi,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Remove workspace registration",disabled:l<2,"data-action":"view.update",onClick:()=>c({mode:"remove",id:s.id,name:s.name})},n.createElement(ea,null))))}function jx({host:e,onOpen:t}){const a=fo(e,"workspaces");return n.createElement(ji,{state:a.state,act:a.act,onOpen:t,onEdit:a.setDraft,heading:!1,previewLimit:8})}function $x({chat:e,model:t,now:a,close:r}){var C,O,k,T;const{state:o,act:i,draft:s,setDraft:l,choose:c,prefix:u}=t,d=ju(e,o),p=e.title||"Untitled conversation",m=((C=e.location)==null?void 0:C.kind)==="managed",h=o.pinnedSessionIds||[],f=h.indexOf(e.id),[g,y]=v.useState(""),[E,b]=v.useState(""),[S,w]=v.useState(!1),N=(k=(O=o.attention)==null?void 0:O.items)==null?void 0:k.find(I=>I.id==="session:"+e.id&&I.sessionId===e.id&&!I.read),x=async()=>{if(!(S||!N)){w(!0),b("");try{await br(i,[N])}catch(I){b(I.message||"Could not mark this error reviewed.")}finally{w(!1)}}},A=async I=>{try{y(""),await i("session.pinOrder",{ids:yg(h,e.id,h[f+I])})}catch(F){y(F.message)}};return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-navigation-detail-heading"},n.createElement(Fi,null),"Chat details"),n.createElement("h3",null,p),n.createElement("div",{className:"a-navigation-detail-status"},n.createElement(Hu,{activity:d}),n.createElement("strong",null,d.label)),n.createElement("dl",null,n.createElement("dt",null,"Last activity"),n.createElement("dd",null,$u(e.recentActivityAt,a).long),n.createElement("dt",null,"Workspace"),n.createElement("dd",null,m?"No workspace":e.workspaceName||((T=e.workspace)==null?void 0:T.split(/[\\/]/).filter(Boolean).at(-1)))),n.createElement(Ms,{label:m?"Chat files":"Full workspace path",value:e.workspace||"Unavailable"}),n.createElement(Ms,{label:"Session ID",value:Uu(e)}),n.createElement("p",{className:"a-caption"},m?"Files stored in this chat’s managed folder.":"Saved in this folder’s native Amplifier history."),s.mode==="chat-rename"&&s.id===e.id?n.createElement(qx,{inputId:u+"-name",chat:e,act:i,cancel:()=>l({})}):n.createElement("div",{className:"a-navigation-actions"},n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",onClick:()=>{r(),c(e.id)}},n.createElement(Ok,null),"Open chat"),N&&n.createElement("button",{type:"button",className:"a-link","data-action":"attention.read",disabled:S,onClick:x},S?"Marking reviewed…":"Mark error reviewed"),E&&n.createElement("span",{role:"alert"},E),n.createElement("button",{type:"button","aria-label":`${e.pinned?"Unpin":"Pin"} ${p}`,"aria-pressed":!!e.pinned,"data-action":"session.pin",onClick:()=>i("session.pin",{id:e.id,pinned:!e.pinned})},n.createElement(qu,null),e.pinned?"Unpin":"Pin"),e.pinned&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button","aria-label":"Move "+p+" up","data-action":"session.pinOrder",disabled:f<1,onClick:()=>A(-1)},n.createElement(Li,null),"Move up"),n.createElement("button",{type:"button","aria-label":"Move "+p+" down","data-action":"session.pinOrder",disabled:f<0||f===h.length-1,onClick:()=>A(1)},n.createElement(sg,null),"Move down"),g&&n.createElement("span",{role:"alert"},g)),n.createElement("button",{type:"button","aria-label":"Rename "+p,"data-action":"view.update",onClick:()=>l({mode:"chat-rename",id:e.id,name:p})},n.createElement(qi,null),"Rename"),n.createElement("button",{type:"button","aria-label":(e.archived?"Restore ":"Archive ")+p,"data-action":e.archived?"session.restore":"session.archive",onClick:()=>i(e.archived?"session.restore":"session.archive",{id:e.id})},e.archived?"Restore":"Archive"),m&&!e.parentId&&n.createElement("button",{type:"button",className:"a-danger","aria-label":"Delete "+p,"data-action":"view.update",onClick:()=>{r(),l({mode:"chat-delete",id:e.id,name:p})}},n.createElement(ea,null),"Delete")))}function ro({id:e,title:t,count:a,model:r,actions:o,children:i}){const s=n.useId(),l=r.view.navSectionsCollapsed||[],c=l.includes(e);return n.createElement("section",{className:"a-sidebar-section","aria-label":t==="Pinned"?"Pinned chats":t==="Recent"?"Recent chats":t,"data-sidebar-section":e},n.createElement("div",{className:"a-sidebar-section-heading"},n.createElement("button",{type:"button","aria-expanded":!c,"aria-controls":s,"data-action":"view.update",onClick:()=>ia(r.act,{navSectionsCollapsed:c?l.filter(u=>u!==e):[...l,e]})},n.createElement("span",null,t),n.createElement(en,{className:c?"":"is-open"}),a!=null&&n.createElement("small",null,a)),o),n.createElement("div",{id:s,hidden:c},i))}function Yu({chat:e,model:t,now:a,showLocation:r=!0,handle:o,floating:i=!1}){const{state:s,choose:l}=t,c=e.title||"Untitled conversation",u=ju(e,s),d=n.createElement(n.Fragment,null,o,n.createElement("button",{className:"a-nav-chat-select",type:"button","data-navigation-select":!0,"data-action":"session.select","aria-current":e.id===s.selectedSessionId?"page":void 0,"aria-label":c,onClick:()=>l(e.id)},n.createElement(Hu,{activity:u}),n.createElement("span",{className:"a-nav-chat-label"},n.createElement("span",null,c),n.createElement("small",{className:"a-nav-chat-workspace",title:r?e.workspace:void 0},r?e.workspaceLabel||e.workspace:u.label)),n.createElement(Tx,{at:e.recentActivityAt,now:a}))),p="a-nav-chat "+(e.id===s.selectedSessionId?"is-selected":"");return i?n.createElement("div",{className:p},d,n.createElement(Di,{className:"a-navigation-more"})):n.createElement(Vu,{className:p,"data-session-id":e.id,label:c,details:({close:m})=>n.createElement($x,{chat:e,model:t,now:a,close:m})},d)}function Ig({page:e,onChange:t,label:a="conversations"}){return e.pages<2?null:n.createElement("div",{className:"a-nav-pagination"},n.createElement("span",null,e.start+1,"–",e.end," of ",e.total),n.createElement("div",null,n.createElement("button",{type:"button",className:"a-link","data-action":"view.update","aria-label":"Show previous "+a,disabled:e.index===0,onClick:()=>t(e.index-1)},"Previous"),n.createElement("button",{type:"button",className:"a-link","data-action":"view.update","aria-label":"Show more "+a,disabled:e.index===e.pages-1,onClick:()=>t(e.index+1)},"More",n.createElement(en,null))))}function Gu({page:e,model:t,now:a}){const[r,o]=v.useState(""),i=e.items.map(c=>({...c,label:c.title||"Untitled conversation"})),s=i.map(c=>c.id),l=async(c,{id:u,to:d})=>{var p;o("");try{const m=await t.act("session.pinOrder",{ids:yg(t.state.pinnedSessionIds||[],u,s[d])}),h=((p=m==null?void 0:m.result)==null?void 0:p.accepted)!==void 0?m.result:m;if((h==null?void 0:h.accepted)===!1)throw Error(h.error||"Could not reorder pins.")}catch(m){throw o(m.message||"Could not reorder pins. Please try again."),m}};return n.createElement(n.Fragment,null,n.createElement(kg,{items:i,ids:s,onChange:l,className:"a-pinned-chats",floatingClassName:"a-pinned-drag",action:"session.pinOrder",renderItem:(c,{handle:u,floating:d})=>n.createElement(Yu,{chat:c,model:t,now:a,handle:u,floating:d})}),r&&n.createElement("p",{role:"alert",className:"a-danger"},r),!e.total&&n.createElement("p",{className:"a-nav-empty"},"Pin a chat from its actions menu to keep it here."),n.createElement(Ig,{page:e,label:"pinned chats",onChange:c=>ia(t.act,{navPinnedPage:c})}))}function Zc({page:e,model:t,view:a,viewAct:r,now:o,showLocation:i}){const s=e.activityCounts||{};return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-nav-search"},n.createElement(To,null),n.createElement("input",{"aria-label":"Filter conversations",maxLength:500,type:"search",value:a.navFilter||"",placeholder:i?"Find chats or paths · * ?":"Find chats · * ? patterns","data-action":"view.update",onChange:l=>ia(r,{navFilter:l.target.value})})),n.createElement("details",{className:"a-sidebar-filters"},n.createElement("summary",null,"Filters",a.navFilter||a.navArchive&&a.navArchive!=="active"||a.navStatusFilter&&a.navStatusFilter!=="all"||a.navLocationFilter==="managed"?" · active":""),n.createElement(Lx,{state:{...t.state,view:a},act:r}),n.createElement("label",{className:"a-managed-chat-filter"},"Sort",n.createElement("select",{"aria-label":"Sort conversations",value:a.navSort||"activity","data-action":"view.update",onChange:l=>ia(r,{navSort:l.target.value})},n.createElement("option",{value:"activity"},"Recent activity"),n.createElement("option",{value:"created"},"Newest created"),n.createElement("option",{value:"name"},"Name"))),i&&n.createElement("label",{className:"a-managed-chat-filter"},"Location",n.createElement("select",{"aria-label":"Filter chats by location",value:a.navLocationFilter||"all","data-action":"view.update",onChange:l=>ia(r,{navLocationFilter:l.target.value})},n.createElement("option",{value:"all"},"All locations"),n.createElement("option",{value:"managed"},"No workspace"))),n.createElement("div",{className:"a-navigation-filters",role:"group","aria-label":"Conversation activity filters"},n.createElement("button",{type:"button","aria-pressed":a.navStatusFilter==="attention","data-action":"view.update",onClick:()=>ia(r,{navStatusFilter:a.navStatusFilter==="attention"?"all":"attention"})},n.createElement(zn,null),s.attention??0," need attention"),n.createElement("button",{type:"button","aria-pressed":a.navStatusFilter==="working","data-action":"view.update",onClick:()=>ia(r,{navStatusFilter:a.navStatusFilter==="working"?"all":"working"})},n.createElement(Ro,null),s.working??0," working"),a.navStatusFilter&&a.navStatusFilter!=="all"&&n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>ia(r,{navStatusFilter:"all"})},"Clear"))),e.pending&&n.createElement("p",{role:"status"},"Loading conversations…"),n.createElement("div",{className:"a-nav-chats"},e.items.map(l=>n.createElement(Yu,{key:l.id,chat:l,model:t,now:o,showLocation:i}))),!e.total&&!e.pending&&n.createElement("p",{className:"a-nav-empty"},a.navFilter||a.navStatusFilter&&a.navStatusFilter!=="all"?"No matching chats.":"Your conversations will appear here."),n.createElement(Ig,{page:e,onChange:l=>ia(r,{navChatPage:{...e.scope,index:l}})}))}const fm={navArchive:"active",navCollection:null,navFilter:"",navStatusFilter:"all",navLocationFilter:"all",navSort:"activity"};function Bx({host:e,workspaceHost:t}){var T,I,F;const a=fo(e,"chats"),{state:r,act:o,view:i,workspace:s,history:l,refreshing:c}=a,u=Ku(n,t||e),d=ol(),p=(t==null?void 0:t.dispatch)||o,[m,h]=v.useState(!1),f=v.useRef(null),g=()=>{h(!1),requestAnimationFrame(()=>{var z;return(z=f.current)==null?void 0:z.focus()})},y=r.sidebarNavigation,E={...fm,navChatScope:((T=y==null?void 0:y.pinned)==null?void 0:T.scope.mode)||"all",navPinnedPage:i.navPinnedPage},b={...fm,...y==null?void 0:y.recentView,...i.navRecentView},S=Es({...r,view:E},s,{section:"pinned"}),w=Es({...r,view:{...b,navChatScope:E.navChatScope}},s,{section:"recent"}),N=Es({...r,view:{...i,navChatScope:"workspace"}},s,{section:"workspace"}),x=(z,U)=>{if(z!=="view.update")return o(z,U);const H={...b,...U.patch};return Object.hasOwn(U.patch,"navChatPage")||delete H.navChatPage,ia(o,{navRecentView:H})},A=i.navWorkspaceList!==!1||!s,C=()=>ia(o,{navWorkspaceList:!0}),O=()=>ia(o,{navWorkspaceList:!1,navChatScope:"workspace",navFilter:"",navStatusFilter:"all",navArchive:"active",navLocationFilter:"all"}),k=(I=u.workspaceExplorer)==null?void 0:I.selected;return n.createElement("div",{className:"a-sidebar-navigation"},n.createElement(go,{model:a}),n.createElement(ro,{id:"pinned",title:"Pinned",count:S.total,model:a},n.createElement(Gu,{page:S,model:a,now:d})),n.createElement(ro,{id:"workspaces",title:"Workspaces",count:(F=u.workspaceExplorer)==null?void 0:F.totalWorkspaces,model:a,actions:n.createElement("button",{ref:f,type:"button",className:"a-icon","aria-label":"New workspace","data-action":"view.update",onClick:()=>{h(!0),ia(o,{navSectionsCollapsed:(i.navSectionsCollapsed||[]).filter(z=>z!=="workspaces")})}},n.createElement(Ln,null))},m&&n.createElement(sl,{state:u,act:p,onDone:g,onCancel:g}),A?t?n.createElement(jx,{host:t,onOpen:O}):n.createElement(ji,{state:r,act:o,onOpen:O,onEdit:a.setDraft,heading:!1,previewLimit:8}):n.createElement("div",{className:"a-workspace-chat-view","aria-label":"Chats in "+s.name},n.createElement("button",{type:"button",className:"a-navigation-back","data-action":"view.update",onClick:C},n.createElement(Sa,null),"All workspaces"),n.createElement(Vu,{className:"a-navigation-workspace",label:s.name,details:({close:z})=>{var U;return n.createElement(wg,{row:k||{...s,chatCount:N.total},now:d,actions:n.createElement(n.Fragment,null,n.createElement("button",{type:"button","data-action":"view.update",onClick:()=>{z(),p("view.update",{patch:{workspaceDraft:{mode:"rename",id:s.id,name:s.name}}})}},n.createElement(qi,null),"Rename"),n.createElement("button",{type:"button",className:"a-danger",disabled:((U=u.library)==null?void 0:U.workspaceCount)<2,"data-action":"view.update",onClick:()=>{z(),p("view.update",{patch:{workspaceDraft:{mode:"remove",id:s.id,name:s.name}}})}},n.createElement(ea,null),"Remove registration"))})}},n.createElement(Fr,null),n.createElement("div",null,n.createElement("strong",null,s.name),n.createElement("small",{title:s.path},fg(s.path)))),n.createElement("div",{className:"a-sidebar-workspace-actions"},n.createElement("span",null,N.total," chats"),n.createElement("button",{type:"button",className:"a-link","aria-label":"New chat in "+s.name,"data-action":"session.draft",onClick:()=>o("session.draft",{workspace:s.path})},n.createElement(Ln,null),"New chat")),n.createElement(Zc,{page:N,model:a,view:i,viewAct:o,now:d,showLocation:!1}))),n.createElement(ro,{id:"recent",title:"Recent",count:w.total,model:a,actions:n.createElement("button",{type:"button",className:"a-icon","aria-label":"Refresh workspaces and chats","data-action":"history.refresh",disabled:c,onClick:()=>o("history.refresh",{})},n.createElement(Mt,{className:c?"a-progress-spinner":void 0}))},n.createElement(Zc,{page:w,model:a,view:b,viewAct:x,now:d,showLocation:!0})),l.loading&&n.createElement("p",{role:"status"},"Finding existing chats…"),l.error&&n.createElement("p",{role:"alert",className:"a-danger"},l.error),!!l.issueCount&&n.createElement("p",{className:"a-caption",role:"status"},"Some saved folders or chats need attention."))}function Hx({host:e,workspaceHost:t,navigation:a}){var c;const r=fo(e,"chats"),o=ol(),i=Ku(n,t||e),s=((c=r.state.sidebarNavigation)==null?void 0:c.pinned)||{items:[],total:0,pages:1},l=r.state.recentShortcuts||[];return n.createElement("div",{className:"a-sidebar-navigation a-quiet-sidebar"},n.createElement(go,{model:r}),n.createElement("button",{type:"button",className:"a-nav-search-launch","data-action":"view.update",onClick:()=>a.browse("chats")},n.createElement(To,null),"Search chats"),n.createElement(ro,{id:"pinned",title:"Pinned",model:r},n.createElement(Gu,{page:s,model:r,now:o})),n.createElement(ro,{id:"workspaces",title:"Workspaces",model:r,actions:n.createElement("button",{type:"button",className:"a-icon","aria-label":"New workspace",onClick:()=>a.create()},n.createElement(Ln,null))},n.createElement(ji,{state:i,act:(t==null?void 0:t.dispatch)||r.act,compact:!0,heading:!1,onSelect:u=>a.browse("workspace",u.workspaceId)}),n.createElement("button",{type:"button",className:"a-sidebar-all a-link","data-action":"view.update",onClick:()=>a.browse("workspaces")},"All workspaces",n.createElement(en,null))),n.createElement(ro,{id:"recent",title:"Recent",model:r,actions:n.createElement("button",{type:"button",className:"a-icon","aria-label":"Refresh workspaces and chats","data-action":"history.refresh",disabled:r.refreshing,onClick:()=>r.act("history.refresh",{})},n.createElement(Mt,{className:r.refreshing?"a-progress-spinner":void 0}))},l.map(u=>n.createElement(Yu,{key:u.id,chat:u,model:r,now:o})),!l.length&&n.createElement("p",{className:"a-nav-empty"},"Your recent chats appear here."),n.createElement("button",{type:"button",className:"a-sidebar-all a-link","data-action":"view.update",onClick:()=>a.browse("chats")},"All chats",n.createElement(en,null))),r.history.loading&&n.createElement("p",{className:"a-caption",role:"status"},"Finding existing chats…"),!!r.history.issueCount&&n.createElement("p",{className:"a-caption",role:"status"},"Some saved folders or chats need attention. ",n.createElement("button",{className:"a-link",onClick:()=>a.browse("chats")},"Review chats")),r.history.error&&n.createElement("p",{role:"alert"},r.history.error))}function Vx(e){const t=v.useContext(zi);return t?n.createElement(Hx,{...e,navigation:t}):n.createElement(Bx,{...e})}function Ja(e){var s,l,c,u,d;const t=((s=e==null?void 0:e.view)==null?void 0:s.workSurface)||"chat",a=t==="workspace"?(l=e==null?void 0:e.view)==null?void 0:l.workWorkspaceId:t==="chat"?e==null?void 0:e.selectedWorkspaceId:null,r=((u=(c=e==null?void 0:e.workspaces)==null?void 0:c.find(p=>p.id===a))==null?void 0:u.path)||"",o=(d=e==null?void 0:e.view)==null?void 0:d.newSessionDraft,i=(o==null?void 0:o.workspace)??r;return{title:"",workspace:r,bundle:"",selection:{},...o,location:(o==null?void 0:o.location)||{kind:i?"workspace":"managed"}}}function ws(e){var t;return JSON.stringify([e.workspace,e.bundle||"",...((t=e.location)==null?void 0:t.kind)==="managed"?["managed"]:[]])}function Ag(e){var a;const t=Ja(e);return((a=e.draftDefaults)==null?void 0:a[ws(t)])||{}}function Wx(){return n.createElement("section",{className:"a-new-chat-setup","aria-label":"New chat"},n.createElement("img",{src:"/branding/icons/amplifier-icon-128.png",alt:""}),n.createElement("h2",null,"What shall we work on?"),n.createElement("p",null,"Bring an idea, a question, or a file."))}const Ha=crypto.randomUUID();let Yi;function $i(e){if(!e.startsWith("/api/"))return e;const t=new URL(e,location.origin);return t.searchParams.set("clientId",Ha),t.pathname+t.search}function Zx(e){if(!Yi){let t;try{t=sessionStorage.getItem("amplifier.clientId")||void 0}catch{}Yi=St("/api/clients/attach",{method:"POST",signal:e,body:{clientId:Ha,resumeClientId:t,kind:"web",protocolVersion:1}}).then(a=>{try{sessionStorage.setItem("amplifier.clientId",Ha)}catch{}return a}).catch(a=>{throw Yi=null,a})}return Yi}let pi;function ks(){return pi?pi.seconds+(performance.now()-pi.received)/1e3:Date.now()/1e3}async function St(e,t={}){var u,d,p;const a={...e.startsWith("/api/")?{"X-Amplifier-Client":Ha,"X-Amplifier-State-Transport":"delta-v1"}:{},...t.headers};let r=t.body;r&&typeof r=="object"&&!(r instanceof FormData)&&(a["Content-Type"]="application/json",r=JSON.stringify(r));const o=await fetch(e,{...t,body:r,headers:a,credentials:"same-origin"}),i=Date.parse((d=(u=o.headers)==null?void 0:u.get)==null?void 0:d.call(u,"date"));Number.isFinite(i)&&(!pi||i/1e3>ks())&&(pi={seconds:i/1e3,received:performance.now()});const s=await o.text();let l;try{l=s?JSON.parse(s):{}}catch{throw new Error(`The server returned an unexpected response (${o.status}).`)}const c=o.ok&&l.accepted===!1?Number.isInteger(l.status)&&l.status>=400&&l.status<600?l.status:400:o.status;if(!o.ok||l.accepted===!1)throw Object.assign(new Error(typeof l.error=="string"?l.error:((p=l.error)==null?void 0:p.message)||l.message||`Request failed (${c})`),{code:l.code,state:l.state,receipt:l.receipt,status:c});return l}function gm(e,t,a="application/json"){const r=new Blob([typeof t=="string"?t:JSON.stringify(t,null,2)],{type:a}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=e,i.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function Jx(e){var t,a;if(e)for(const r of e.querySelectorAll('button[aria-label],a[aria-label],[role="button"][aria-label]')){if(!((t=r.classList)!=null&&t.contains("a-icon"))&&!((a=r.querySelector)!=null&&a.call(r,"svg")))continue;const o=r.getAttribute("aria-label");o&&(!r.title||r.dataset.iconTitle==="auto")&&(r.title=o,r.dataset.iconTitle="auto")}}function Kx(e){const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode(o){if(o.nodeType===Node.ELEMENT_NODE){const i=getComputedStyle(o);return o.dataset.viewSource||i.display==="none"||i.visibility==="hidden"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}return o.textContent.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a,r="";for(;(a=t.nextNode())&&r.length<6e4;)r+=a.textContent.trim()+` -`;return r.slice(0,6e4)}function jl(e,t,{interfaceOnly:a=!1}={}){var s,l,c;if(!e)return{clientId:t};const r=u=>!!u.getClientRects().length&&getComputedStyle(u).visibility!=="hidden",o=[...e.querySelectorAll("button,input,textarea,select,a,[role=separator]")].filter(r).map(u=>{var d,p,m,h;return{id:u.id||null,action:u.dataset.action||((d=u.closest("[data-action]"))==null?void 0:d.dataset.action)||null,...u.closest("[data-shell-component]")?{component:{instanceId:u.closest("[data-shell-component]").dataset.shellComponent,slot:u.closest("[data-shell-component]").dataset.shellSlot,command:u.dataset.shellCommand||null}}:{},label:u.dataset.viewLabel||u.getAttribute("aria-label")||((m=(p=u.labels)==null?void 0:p[0])==null?void 0:m.textContent)||((h=u.textContent)==null?void 0:h.trim().slice(0,160)),type:u.getAttribute("role")||u.type||u.tagName.toLowerCase(),...u.getAttribute("role")==="separator"?{minimum:Number(u.getAttribute("aria-valuemin")),maximum:Number(u.getAttribute("aria-valuemax")),current:Number(u.getAttribute("aria-valuenow"))}:{},value:u.type==="password"||u.dataset.private==="true"?"[redacted]":u.value,disabled:!!u.disabled||!!u.closest("[inert]"),...u.hasAttribute("aria-expanded")?{expanded:u.getAttribute("aria-expanded")==="true"}:{},focused:document.activeElement===u}}),i=Object.fromEntries(["navigation","conversation","canvas"].flatMap(u=>{const d=e.querySelector(`[data-part="${u}"]`);if(!d)return[];const p=d.getBoundingClientRect();return[[u,{x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),visible:r(d),interactive:r(d)&&!d.closest("[inert]")}]]}));return{clientId:t,panes:i,webApp:{standalone:!!((s=window.matchMedia)!=null&&s.call(window,"(display-mode: standalone)").matches||navigator.standalone),secureContext:window.isSecureContext,serviceWorkerControlled:!!((l=navigator.serviceWorker)!=null&&l.controller),online:navigator.onLine},visibleText:a?Kx(e):e.innerText.slice(0,6e4),...a?{visibleTextScope:"interface",conversationSource:"Selected session messages, execution and activity in app state"}:{},controls:o,selectedText:((c=window.getSelection())==null?void 0:c.toString().slice(0,1e4))||"",viewport:{width:innerWidth,height:innerHeight,scrollX,scrollY},url:location.pathname}}function Yx({name:e,children:t}){const[a,r]=v.useState(!1),o=v.useRef(null),i=v.useRef(null),s=v.useId(),l=e==="app.status"?"Additional status":"Additional controls",c=e==="app.status"?mo:tl;return v.useEffect(()=>{if(!a)return;const u=d=>{var p;(p=o.current)!=null&&p.contains(d.target)||r(!1)};return document.addEventListener("pointerdown",u),()=>document.removeEventListener("pointerdown",u)},[a]),v.useEffect(()=>{const u=matchMedia("(max-width:760px)"),d=()=>{var p;u.matches&&((p=o.current)!=null&&p.contains(document.activeElement))&&document.activeElement!==i.current&&r(!0)};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),n.createElement("div",{className:"a-slot-overflow","data-open":a,ref:o,onKeyDown:u=>{var d;u.key==="Escape"&&a&&(u.stopPropagation(),u.preventDefault(),r(!1),(d=i.current)==null||d.focus())}},n.createElement("button",{ref:i,type:"button",className:"a-icon a-slot-overflow-toggle","aria-label":l,title:l,"aria-expanded":a,"aria-controls":s,onClick:()=>r(u=>!u)},n.createElement(c,null)),n.createElement("div",{className:"a-slot-overflow-items",id:s,role:"group","aria-label":l},t))}const $l=(e,t)=>Object.fromEntries(t.map(a=>[a,e==null?void 0:e[a]]));function Gx(e){var a,r;if(!e)return null;const t=(a=e.sessions)==null?void 0:a.find(o=>o.id===e.selectedSessionId);return JSON.stringify([e.shellDataKey??e.revision,e.shellChangeToken,e.selectedSessionId,e.selectedWorkspaceId,!!((r=e.runtime)!=null&&r.available),$l(e.view,["workSurface","workWorkspaceId"]),$l(t,["id","title","status","autoName","bundle","workspaceId","naming"]),$l(e.canvas,["id","kind","title","open"])])}const _g=v.createContext(null);function Qu(){return v.useContext(_g)}const Qx={"builtin.workspaces":Ux,"builtin.chats":Vx},vm={instances:[{id:"workspaces",package:"builtin.workspaces",slot:"navigation",hideWhen:{instanceId:"chats",navChatScope:"all"}},{id:"chats",package:"builtin.chats",slot:"navigation"}],presentation:{}},bm=Object.freeze({view:{},workspaces:[],chatNavigation:{items:[],total:0,pages:1,scope:{}},workspaceExplorer:{rows:[]},library:{bounded:!0},sharedHistory:{}}),$o=typeof location<"u"&&new URLSearchParams(location.search).get("shell")==="recovery";function xs(e){return e&&typeof e=="object"&&!Object.isFrozen(e)&&(Object.values(e).forEach(xs),Object.freeze(e)),e}function ym(e,t){return Object.fromEntries(((e==null?void 0:e.resolvedInstances)||[]).map(a=>{var i,s;const r=t[a.id],o=((s=(i=e.snapshots)==null?void 0:i[a.id])==null?void 0:s.generation)||0;return[a.id,(r==null?void 0:r.package)===a.package&&r.generation===o?r.status:"inactive"]}))}function Xx(e,t,a){var k;const[r,o]=v.useState(null),[i,s]=v.useState(""),[l,c]=v.useState([]),u=v.useRef(Promise.resolve()),d=v.useRef({data:null,dispatch:t}),p=v.useRef(new Map),m=v.useRef(null),h=v.useRef(!1);d.current.dispatch=t,d.current.state=e;const f=v.useCallback(()=>document.hidden?(h.current=!0,Promise.resolve()):m.current?(h.current=!0,m.current):(h.current=!1,m.current=St("/api/shell?clientId="+encodeURIComponent(a)+($o?"&recovery=1":"")).then(T=>{var I;d.current.data=T,o(T),s("");for(const F of p.current.values()){const z=((I=T.snapshots)==null?void 0:I[F.id])||bm;if((z.generation||0)!==F.generation)continue;const U={...z,view:{...z.view,...Object.assign({},...F.pending.map(H=>H.patch))}};JSON.stringify(U)!==JSON.stringify(F.snapshot)&&(F.snapshot=xs(U),F.listeners.forEach(H=>H()))}}).catch(T=>s(T.message)).finally(()=>{if(m.current=null,h.current)return h.current=!1,f()}),m.current),[a]),g=Gx(e);v.useEffect(()=>{e&&f()},[g,f]),v.useEffect(()=>{const T=F=>{F.detail.shellClientId===a&&f()},I=()=>{document.hidden||f()};return window.addEventListener("amplifier-shell",T),window.addEventListener("amplifier-reconnected",I),document.addEventListener("visibilitychange",I),()=>{window.removeEventListener("amplifier-shell",T),window.removeEventListener("amplifier-reconnected",I),document.removeEventListener("visibilitychange",I)}},[a,f]);const y=v.useCallback(T=>{var z,U,H,te,j;const I=((H=(U=(z=d.current.data)==null?void 0:z.snapshots)==null?void 0:U[T.id])==null?void 0:H.generation)||0,F=T.id+":"+I;if(!p.current.has(F)){const _={id:T.id,generation:I,listeners:new Set,pending:[],snapshot:xs(((j=(te=d.current.data)==null?void 0:te.snapshots)==null?void 0:j[T.id])||bm)};let P=Promise.resolve();const G=(W,D)=>{const ne=W==="shell.view.update"?{patch:D.patch}:null;ne&&(_.pending.push(ne),_.snapshot=xs({..._.snapshot,view:{..._.snapshot.view,...ne.patch}}),_.listeners.forEach(ie=>ie()));const q=async()=>{var ie,ke;try{const me=await d.current.dispatch(W,{...D,generation:I});return W==="shell.command"&&D.action==="session.select"&&!((ke=(ie=d.current.state)==null?void 0:ie.view)!=null&&ke.navPinned)&&await d.current.dispatch("view.update",{patch:{navExpanded:!1}}),{accepted:me.accepted,result:me.result}}finally{ne&&(_.pending=_.pending.filter(me=>me!==ne)),await f()}},Z=P.then(q,q);return P=Z.catch(()=>{}),Z};_.api=Object.freeze({apiVersion:"1.0",clientId:a,instanceId:T.id,getSnapshot:()=>_.snapshot,subscribe:W=>(_.listeners.add(W),()=>{var D,ne,q;_.listeners.delete(W),!_.listeners.size&&(((q=(ne=(D=d.current.data)==null?void 0:D.snapshots)==null?void 0:ne[T.id])==null?void 0:q.generation)||0)!==I&&p.current.delete(F)}),setDirty:W=>G("shell.view.update",{clientId:a,instanceId:T.id,patch:{},dirty:W}),dispatch:(W,D={})=>W==="view.update"?G("shell.view.update",{clientId:a,instanceId:T.id,patch:D.patch||{}}):G("shell.command",{clientId:a,instanceId:T.id,action:W,args:D})}),p.current.set(F,_)}return p.current.get(F).api},[a,f]),E=v.useRef({}),b=v.useRef(new Map),S=v.useRef(null),w=$o?vm:(r==null?void 0:r.effectiveComposition)||vm,N=l.length?{...w,presentation:{...w.presentation,...Object.assign({},...l.map(T=>T.patch))}}:w,x=v.useCallback(async T=>{var I;await t("shell.recover",{clientId:a,target:T,expectedRevision:((I=d.current.data)==null?void 0:I.revision)||0}),await f(),$o&&(location.href=location.pathname)},[a,t,f]),A=v.useCallback(T=>{const I={patch:{...T}};c(U=>[...U,I]);const F=async()=>{try{d.current.data||await f();const U=d.current.data;if(!U)throw Error("Shell settings are not available yet.");const H={...U.effectiveComposition,presentation:{...U.effectiveComposition.presentation,...T}},te=await t("shell.changes.prepare",{clientId:a,expectedRevision:U.revision,composition:H},{presentation:!0});await t("shell.changes.apply",{clientId:a,expectedRevision:U.revision,changeId:te.result.id},{presentation:!0}),await f()}finally{c(U=>U.filter(H=>H!==I))}},z=u.current.then(F,F);return u.current=z.catch(()=>{}),z},[a,t,f]),C=v.useCallback((T,I="")=>{var z;const F=d.current.data;if(!(!F||$o))return St("/api/actions",{method:"POST",body:{action:"shell.report",args:{clientId:a,revision:F.revision,previewId:((z=F.preview)==null?void 0:z.id)||null,instances:T,message:I}}}).catch(()=>{})},[a]),O=v.useCallback(T=>{var z,U,H;const I=((H=(U=(z=d.current.data)==null?void 0:z.snapshots)==null?void 0:U[T.id])==null?void 0:H.generation)||0,F=T.id+":"+T.package+":"+I;for(const te of b.current.keys())te.startsWith(T.id+":")&&te!==F&&b.current.delete(te);return b.current.has(F)||(E.current[T.id]={package:T.package,generation:I,status:"loading"},b.current.set(F,(te,j="")=>{var P,G,W;const _=d.current.data;!((P=_==null?void 0:_.resolvedInstances)!=null&&P.some(D=>D.id===T.id&&D.package===T.package))||(((W=(G=_.snapshots)==null?void 0:G[T.id])==null?void 0:W.generation)||0)!==I||(E.current[T.id]={package:T.package,generation:I,status:te},clearTimeout(S.current),S.current=setTimeout(()=>C(ym(d.current.data,E.current),j),50))})),b.current.get(F)},[C]);return v.useEffect(()=>(clearTimeout(S.current),S.current=setTimeout(()=>C(ym(r,E.current)),80),()=>clearTimeout(S.current)),[r==null?void 0:r.revision,(k=r==null?void 0:r.preview)==null?void 0:k.id,C]),{data:r,error:i,composition:N,hostFor:y,recover:x,report:C,statusFor:O,refresh:f,setPresentation:A,ready:!!r,recovery:$o,clientId:a}}class Pg extends n.Component{constructor(){super(...arguments);Ke(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a){this.props.report("error",a.message)}render(){return this.state.error?n.createElement("p",{role:"alert"},"This component could not render. ",this.state.error.message):this.props.children}}function eS({View:e,host:t,report:a,workspaceHost:r,paired:o}){return v.useEffect(()=>{a("ready")},[e,a]),n.createElement(e,{host:t,workspaceHost:r,paired:o})}function Og({instance:e,metadata:t,host:a,report:r,workspaceHost:o,paired:i}){const[s,l]=v.useState(null),[c,u]=v.useState(""),d=Qx[e.package];v.useEffect(()=>{let m=!0;if(u(""),!d){if(!(t!=null&&t.url)){u((t==null?void 0:t.error)||"Package is unavailable."),r("error");return}return r("loading"),import(t.url).then(h=>{const f=h.default({React:n});if(typeof f!="function")throw Error("Invalid module factory.");m&&l({package:e.package,View:f})}).catch(h=>{m&&(u(h.message),r("error",h.message))}),()=>{m=!1}}},[e.package,t==null?void 0:t.url,t==null?void 0:t.error,d,r]);const p=d||((s==null?void 0:s.package)===e.package?s.View:null);return c?n.createElement("p",{role:"alert"},"Component unavailable: ",c):p?n.createElement(Pg,{key:e.package+":"+a.getSnapshot().generation,report:r},n.createElement(eS,{View:p,host:a,report:r,workspaceHost:o,paired:i})):n.createElement("p",{role:"status"},"Loading component…")}function tS({shell:e}){const t=e.composition.instances.filter(a=>a.slot==="navigation");return e.ready?n.createElement(n.Fragment,null,(e.error||e.recovery)&&n.createElement("p",{role:"alert"},e.recovery?"Recovery mode: optional components are disabled.":e.error),n.createElement("div",{className:"a-shell-modules"},t.map((a,r)=>{var o,i,s,l,c,u,d,p,m,h,f;return n.createElement("section",{className:"a-shell-instance","data-shell-instance":a.id,"data-shell-package":a.package,hidden:!!a.hideWhen&&!((c=(l=(s=(i=(o=e.data)==null?void 0:o.snapshots)==null?void 0:i[a.id])==null?void 0:s.view)==null?void 0:l.workspaceDraft)!=null&&c.mode)&&((m=(p=(d=(u=e.data)==null?void 0:u.snapshots)==null?void 0:d[a.hideWhen.instanceId])==null?void 0:p.view)==null?void 0:m.navChatScope)===a.hideWhen.navChatScope,style:{order:r},key:a.id},n.createElement(Og,{instance:a,metadata:(f=(h=e.data)==null?void 0:h.packages)==null?void 0:f[a.package],host:e.hostFor(a),report:e.statusFor(a),paired:a.package==="builtin.workspaces"&&e.composition.instances.some(g=>{var y;return g.id===((y=a.hideWhen)==null?void 0:y.instanceId)&&g.package==="builtin.chats"}),workspaceHost:a.package==="builtin.chats"&&e.composition.instances.some(g=>{var y;return g.package==="builtin.workspaces"&&((y=g.hideWhen)==null?void 0:y.instanceId)===a.id})?e.hostFor(e.composition.instances.find(g=>{var y;return g.package==="builtin.workspaces"&&((y=g.hideWhen)==null?void 0:y.instanceId)===a.id})):void 0}))})),n.createElement("details",{className:"a-shell-recovery"},n.createElement("summary",null,"Shell controls"),n.createElement("button",{type:"button",onClick:()=>e.recover("lastGood")},"Restore last working shell"),n.createElement("button",{type:"button",onClick:()=>e.recover("default")},"Restore default shell"),n.createElement("a",{href:"?shell=recovery"},"Open recovery mode"))):n.createElement("p",{role:"status"},"Loading navigation…")}function nS({children:e,report:t}){return v.useEffect(()=>{t("ready")},[t]),e}function Ur({name:e,instanceId:t,children:a}){var s;const r=Qu();if(!r)return a||null;const o=(((s=r.data)==null?void 0:s.resolvedInstances)||[]).filter(l=>l.slot===e&&(!t||l.id===t));if(!o.length)return null;const i=o.map(l=>{var c,u,d,p,m,h,f,g,y,E,b;return{builtin:l.package===((d=(u=(c=r.data)==null?void 0:c.slots)==null?void 0:u[e])==null?void 0:d.default),element:l.package===((h=(m=(p=r.data)==null?void 0:p.slots)==null?void 0:m[e])==null?void 0:h.default)?n.createElement(Pg,{key:l.id+":"+(((y=(g=(f=r.data)==null?void 0:f.snapshots)==null?void 0:g[l.id])==null?void 0:y.generation)||0),report:r.statusFor(l)},n.createElement(nS,{report:r.statusFor(l)},a)):n.createElement("div",{className:"a-shell-contribution","data-shell-component":l.id,"data-shell-slot":e,key:l.id},n.createElement(Og,{instance:l,metadata:(b=(E=r.data)==null?void 0:E.packages)==null?void 0:b[l.package],host:r.hostFor(l),report:r.statusFor(l)}))}});return["app.actions","app.status"].includes(e)&&i.some(l=>!l.builtin)?n.createElement(n.Fragment,null,i.filter(l=>l.builtin).map(l=>l.element),n.createElement(Yx,{name:e},i.filter(l=>!l.builtin).map(l=>l.element))):i.map(l=>l.element)}const Ls=v.createContext(void 0);function yr({children:e,inline:t=!1}){const a=v.useContext(Ls);return t||a===void 0?e:a?Mi.createPortal(e,a):null}function aS({children:e,label:t}){const a=v.useContext(Ls),[r,o]=v.useState(null);return a===void 0?e:n.createElement(n.Fragment,null,n.createElement(yr,null,n.createElement("div",{ref:o,className:"a-canvas-view-tools",role:"group","aria-label":t})),n.createElement(Ls.Provider,{value:r},e))}const rS=(e,t)=>t.sessionId===e.selectedSessionId&&t.workspaceId===e.selectedWorkspaceId;function vo(e){return(e.canvasArtifacts||[]).filter(t=>rS(e,t))}function Em({state:e,message:t,act:a}){const r=vo(e).flatMap(o=>{var i;return(o.publications||[{messageId:o.messageId,version:((i=o.app)==null?void 0:i.revision)||o.revision||1}]).filter(s=>s.messageId===t.id).map(s=>({row:o,version:s.version}))});return r.length?n.createElement("div",{className:"a-chat-artifacts","aria-label":"Saved artifacts for this turn"},r.map(({row:o,version:i})=>{var s,l;return n.createElement("button",{type:"button",key:o.id+":"+i,className:"a-artifact-link","data-action":"canvas.select",onClick:()=>a("canvas.select",{id:o.id,version:i})},o.kind==="browser"?n.createElement(vr,null):n.createElement(No,null),n.createElement("span",null,((l=(((s=o.app)==null?void 0:s.versions)||o.versions||[]).find(c=>c.version===i))==null?void 0:l.title)||o.title," · Version ",i),n.createElement(Dr,null))})):null}function oS({state:e,act:t}){const a=vo(e).filter(r=>r.tabOpen);return a.length?n.createElement("div",{className:"a-canvas-tabs",role:"tablist","aria-label":"Open canvas items"},a.map(r=>{var o,i;return n.createElement("div",{className:`a-canvas-tab ${r.id===((o=e.canvas)==null?void 0:o.id)?"is-active":""}`,key:r.id},n.createElement("button",{type:"button",role:"tab","aria-selected":r.id===((i=e.canvas)==null?void 0:i.id),"data-action":"canvas.select",onClick:()=>t("canvas.select",{id:r.id})},r.kind==="browser"?n.createElement(vr,null):n.createElement(No,null),n.createElement("span",null,r.title)),n.createElement("button",{type:"button",className:"a-icon","aria-label":`Close tab ${r.title}`,"data-action":"canvas.tabClose",onClick:()=>t("canvas.tabClose",{id:r.id})},n.createElement(nn,null)))})):null}function iS({state:e,act:t}){var i;const a=((i=e.view)==null?void 0:i.canvasDraft)||{},r=vo(e),o=nl(r,a.filter||"",s=>[s.title,s.kind,s.path||"",s.url||""]);return n.createElement("section",{className:"a-canvas-library","aria-label":"Saved canvas artifacts"},n.createElement("h3",null,"Saved in this chat ",n.createElement("small",null,r.length)),n.createElement("input",{type:"search","aria-label":"Filter saved artifacts",placeholder:"Find artifacts · * ? patterns",value:a.filter||"","data-action":"view.update",onChange:s=>t("view.update",{patch:{canvasDraft:{...a,filter:s.target.value}}})}),o.slice().reverse().map(s=>n.createElement("button",{key:s.id,type:"button",className:"a-saved-artifact","data-action":"canvas.select",onClick:async()=>{await t("canvas.select",{id:s.id}),t("view.update",{patch:{canvasDraft:{...a,library:!1}}})}},s.kind==="browser"?n.createElement(vr,null):n.createElement(No,null),n.createElement("span",null,n.createElement("strong",null,s.title),n.createElement("small",null,s.kind," · ",s.kind==="browser"?"Saved address":s.app?"Interactive surface":"Saved snapshot")),n.createElement(Dr,null))),!o.length&&n.createElement("p",null,r.length?"No matching artifacts.":"Files and visuals you open will stay here, even after closing their tabs."))}function sS({state:e,act:t}){var s;const a=((s=e.view)==null?void 0:s.canvasDraft)||{},[r,o]=v.useState(a.url||""),i=v.useRef(null);return v.useEffect(()=>{(i.current===null||a.url===i.current)&&(o(a.url||""),i.current=null)},[a.url]),n.createElement("form",{className:"a-canvas-address",onSubmit:l=>{l.preventDefault(),t("canvas.show",{kind:"browser",url:r})}},n.createElement("label",{htmlFor:"canvas-browser-url"},"App or website address"),n.createElement("div",null,n.createElement("input",{id:"canvas-browser-url",type:"url",required:!0,placeholder:"http://localhost:3000",value:r,"data-action":"view.update",onChange:l=>{o(l.target.value),i.current=l.target.value,t("view.update",{patch:{canvasDraft:{...a,url:l.target.value}}})}}),n.createElement("button",{className:"a-primary",type:"submit","data-action":"canvas.show",disabled:!r.trim()},n.createElement(Dr,null),"Open")))}function lS(e,t){const a=new URL(e),r=new URL(t),o=l=>l==="localhost"||l.endsWith(".localhost")||l==="[::1]"||/^127\.\d+\.\d+\.\d+$/.test(l),i=r.protocol==="https:"&&a.protocol==="http:"&&!o(a.hostname),s=o(a.hostname)&&!o(r.hostname);return{blocked:i,localWarning:s,message:i?"This HTTP page cannot be embedded inside the HTTPS app. Open it in your browser, or serve the page over HTTPS.":s?"This address points to the device viewing the app. For a service running on the Amplifier host, use that host’s LAN or Tailnet address.":"Some sites block embedding or require a separate browser tab. The app cannot verify the contents of this external frame."}}function cS({canvas:e,act:t}){var o,i,s,l;const a=lS(e.url,typeof location>"u"?"http://localhost":location.href),r=v.useRef(t);return r.current=t,v.useEffect(()=>{const c=(d,p)=>r.current("canvas.report",{id:e.id,part:"preview",status:d,message:p});if(a.blocked){c("error",a.message);return}c("pending","Opening external preview; page contents cannot be verified.");const u=setTimeout(()=>c("unverified","Preview could not be verified. If it is blank, open it in your browser or check the address and site embedding policy."),12e3);return()=>clearTimeout(u)},[e.id,(o=e.view)==null?void 0:o.reload,a.blocked,a.message]),n.createElement("div",{className:"a-browser-preview"},n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},n.createElement(vr,null),n.createElement("span",{className:"a-browser-url",title:e.url},e.url),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Reload browser preview","data-action":"canvas.view",onClick:()=>t("canvas.view",{id:e.id,patch:{reload:Date.now()}})},n.createElement(sx,null)))),a.blocked?n.createElement("div",{className:"a-browser-blocked",role:"alert"},n.createElement(vr,null),n.createElement("h3",null,"Open this page in your browser"),n.createElement("p",null,a.message),n.createElement("a",{className:"a-soft","data-action":"canvas.openExternal",href:e.url,target:"_blank",rel:"noopener noreferrer"},"Open in browser ",n.createElement(sa,{size:16}))):n.createElement("iframe",{key:`${e.id}-${((i=e.view)==null?void 0:i.reload)||0}`,title:e.title||"App preview",className:"a-canvas-html",sandbox:"allow-scripts allow-forms",referrerPolicy:"no-referrer",src:e.url,onLoad:()=>t("canvas.report",{id:e.id,part:"preview",status:"unverified",message:"Frame navigation finished. Browser security prevents confirming whether this external page loaded or permits embedding."})}),n.createElement("div",{className:"a-browser-help"},n.createElement("a",{"data-action":"canvas.openExternal",href:e.url,target:"_blank",rel:"noopener noreferrer"},"Open in browser ",n.createElement(sa,{size:13})),n.createElement("button",{className:"a-link",type:"button","data-action":"canvas.view","aria-expanded":!!((s=e.view)!=null&&s.help),onClick:()=>{var c;return t("canvas.view",{id:e.id,patch:{help:!((c=e.view)!=null&&c.help)}})}},"Preview help"),(((l=e.view)==null?void 0:l.help)||a.localWarning)&&n.createElement("p",null,a.message," The service must stay running and be reachable from this device. Authentication, frame policies, redirects, and sandbox restrictions can require opening it separately.")))}function Mg({state:e,session:t,act:a}){const r=bg(e,t);return r?n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>a("view.update",{patch:{panel:"subagent-history",subagentHistory:{sessionId:t.id,filter:"",index:0}}})},n.createElement(Wa,null),"Subagent history (",r,")"):null}function uS({state:e,session:t,act:a}){var p,m;const r=((p=e.view)==null?void 0:p.subagentHistory)||{},o=((m=e.sessions)==null?void 0:m.find(h=>h.id===r.sessionId))||t,i=r.filter||"",s=Rx(e,o),{pages:l,index:c}=s,u=h=>a("view.update",{patch:{subagentHistory:{sessionId:o==null?void 0:o.id,filter:i,index:c,...h}}}),d=async h=>{const f=await a("session.select",{id:h});f&&f.accepted!==!1&&await a("view.update",{patch:{panel:null}})};return n.createElement("div",{"data-part":"subagent-history"},n.createElement("p",null,"Saved subagent conversations from ",(o==null?void 0:o.title)||"this conversation",". Open one to read its work."),n.createElement("label",{htmlFor:"subagent-history-filter"},"Find subagent conversations"),n.createElement("input",{id:"subagent-history-filter",type:"search",value:i,placeholder:"Search or pattern, e.g. *research*","data-action":"view.update",onChange:h=>u({filter:h.target.value,index:0})}),n.createElement("p",{className:"a-caption",role:"status"},s.pending?"Loading subagent conversations…":`${s.total} of ${s.unfilteredTotal} subagent conversations`),n.createElement("div",{className:"a-subagent-history-list","aria-busy":!!s.pending},s.items.map(h=>n.createElement("button",{key:h.id,type:"button",className:"a-soft","data-action":"session.select",onClick:()=>d(h.id),title:h.description||h.nativeIdentity||h.id},n.createElement(Wa,null),n.createElement("span",null,h.title||"Subagent conversation"),n.createElement(en,null)))),!s.total&&!s.pending&&n.createElement("p",null,i?"No matching subagent conversations.":"No saved subagent conversations for this chat."),l>1&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:c===0,onClick:()=>u({index:c-1})},n.createElement(Fk,null),"Previous subagents"),n.createElement("span",{className:"a-caption"},s.start+1,"–",s.end," of ",s.total),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:c===l-1,onClick:()=>u({index:c+1})},"More subagents",n.createElement(en,null))))}function dS({state:e,act:t,changeDraft:a}){var c;const r=(c=e.sessions)==null?void 0:c.find(u=>u.id===e.selectedSessionId),o=vo(e),i=[...new Map(((r==null?void 0:r.messages)||[]).flatMap(u=>u.attachments||[]).map(u=>[u.id||u.name,u])).values()],s=(r==null?void 0:r.workers)||[],l=s.filter(u=>["queued","starting","working","running","stopping"].includes(u.status)).length;return n.createElement("div",{className:"a-chat-overview",role:"region","aria-label":"Chat overview",tabIndex:0},n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(No,null),n.createElement("h3",null,"Outputs"),n.createElement("span",null,o.length)),o.length?n.createElement(iS,{state:e,act:t}):n.createElement("p",null,"Files and visuals from this chat will appear here."),n.createElement("div",{className:"a-overview-actions"},n.createElement("button",{className:"a-link",type:"button",onClick:()=>a({open:!0,browser:!1,library:!0})},n.createElement(nr,null),"Open file"),n.createElement("button",{className:"a-link",type:"button",onClick:()=>a({browser:!0,open:!1,library:!0})},n.createElement(vr,null),"Open website"))),n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(Fu,null),n.createElement("h3",null,"Sources")),i.length?n.createElement("ul",null,i.map(u=>n.createElement("li",{key:u.id||u.name},u.name||"Attachment"))):n.createElement("p",null,"No attachments in the loaded messages.")),n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(Wa,null),n.createElement("h3",null,"Agents"),l>0&&n.createElement("span",null,l," working")),s.length?n.createElement("ul",null,s.map(u=>n.createElement("li",{key:u.id},u.name||u.instruction||"Worker"," ",n.createElement("small",null,u.status)))):n.createElement("p",null,"Delegated work will appear here."),n.createElement(Mg,{state:e,session:r,act:t}),n.createElement("button",{className:"a-link",type:"button",onClick:()=>t("view.update",{patch:{panel:"coordination"}})},"View tasks and workers")),n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(mo,null),n.createElement("h3",null,"Activity")),n.createElement("p",null,(r==null?void 0:r.status)||"Idle"),n.createElement("button",{className:"a-link",type:"button",onClick:()=>t("view.update",{patch:{panel:"runtime"}})},"Chat controls and details")))}const Jc=new Set;function pS(e,t){const a={sessionId:e,checkpoint:t};return Jc.add(a),()=>Jc.delete(a)}async function Bl(e,t){const a=[...Jc].filter(o=>o.sessionId===e).map(o=>Promise.resolve().then(()=>o.checkpoint(t)).catch(()=>{}));let r;try{await Promise.race([Promise.all(a),new Promise(o=>{r=setTimeout(o,1e3)})])}finally{clearTimeout(r)}}const Bo=e=>Object.fromEntries(["viewId","resourceId","resourceRevision","generation"].map(t=>[t,e[t]])),mS=["bg","surface","soft","ink","muted","line","accent","tint","green","danger"];function wm(){const e=document.getElementById("amp-one"),t=getComputedStyle(e||document.documentElement);return{version:1,tokens:Object.fromEntries(mS.map(a=>[a,t.getPropertyValue("--a-"+a).trim()])),scheme:t.colorScheme==="dark"?"dark":t.colorScheme==="light"?"light":matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",reducedMotion:matchMedia("(prefers-reduced-motion: reduce)").matches,contrast:matchMedia("(prefers-contrast: more)").matches?"more":"normal"}}function hS({canvas:e,dispatch:t}){const[a,r]=v.useState(e),[o,i]=v.useState(""),[s,l]=v.useState(""),[c,u]=v.useState(!1),[d,p]=v.useState(null),m=v.useRef(),h=v.useRef(e),f=v.useRef(a),g=v.useRef(!1),y=v.useRef(0),E=v.useRef(0),b=v.useRef(crypto.randomUUID()),S=v.useRef(new Map),w=v.useRef(Promise.resolve()),N=v.useRef(),x=v.useRef();(e.app.revision!==h.current.app.revision||e.app.stateRevision>=h.current.app.stateRevision)&&(h.current=e),f.current=a;const A=e.app,C=v.useRef(new Map),O=H=>{E.current=0,b.current=crypto.randomUUID(),S.current.clear(),p(null),i(""),l(""),N.current=null,x.current=null,r(H)},k=(H=!1)=>{var P,G;const te=h.current;if(te.app.revision!==f.current.app.revision)return;const j={id:te.id,app:te.app,visible:!!te.open,theme:wm()},_=JSON.stringify([b.current,te.app.revision,te.app.stateRevision,j.visible,j.theme]);!H&&_===N.current||(N.current=_,(G=(P=m.current)==null?void 0:P.contentWindow)==null||G.postMessage({type:"canvas-app-host",id:te.id,channel:b.current,snapshot:j},"*"))},T=(H,te=E.current)=>{if(te!==E.current)return Promise.resolve();g.current=H,u(H);const j=Bo(f.current),_=b.current,P=w.current.catch(()=>{}).then(()=>t("canvas.views.dirty",{...j,dirty:H,editVersion:te}));return w.current=P,P.catch(G=>{throw _===b.current&&(g.current=!0,u(!0),i(G.message)),G})};v.useEffect(()=>{e.app.revision!==a.app.revision&&!g.current&&!y.current?O(e):k()},[e]),v.useEffect(()=>{const H=pS(e.sessionId,D=>new Promise(ne=>{var ie,ke;const q=D||crypto.randomUUID(),Z=setTimeout(()=>{C.current.delete(q),ne()},900);C.current.set(q,()=>{clearTimeout(Z),ne()}),(ke=(ie=m.current)==null?void 0:ie.contentWindow)==null||ke.postMessage({type:"canvas-app-host",id:h.current.id,channel:b.current,checkpoint:q},"*")})),te=async D=>{var ke,me,_e,Je,De,ue,ye,M;const ne=D.data;if(D.source!==((ke=m.current)==null?void 0:ke.contentWindow)||(ne==null?void 0:ne.type)!=="canvas-app"||ne.id!==h.current.id)return;if(ne.op==="ready"){k(!0);return}if(ne.channel!==b.current)return;if(ne.op==="observation"){const Y=ne.observation;if(!Y||JSON.stringify(Y).length>48e4)return;try{await St("/api/actions",{method:"POST",body:{action:"canvas.views.observe",args:{...Y,...Bo(f.current),...ne.checkpoint?{checkpointId:ne.checkpoint}:{}},id:crypto.randomUUID()}})}catch{}(me=C.current.get(ne.checkpoint))==null||me(),C.current.delete(ne.checkpoint);return}if(ne.op==="status"){const Y=ne.status==="error"?"error":"ready",se=String(ne.message||"").slice(0,1e3),Fe=Y+":"+se;if(Fe===x.current)return;x.current=Fe,t("canvas.views.status",{...Bo(f.current),status:Y,message:se}).catch(()=>{}),l(Y==="error"?se:"");return}if(ne.op==="editing"&&h.current.readOnlyVersion)return;if(ne.op==="editing"){Number.isSafeInteger(ne.editVersion)&&ne.editVersion>E.current&&(E.current=ne.editVersion,T(!0).catch(()=>{}));return}if(!["state","event","request","dirty"].includes(ne.op)||typeof ne.requestId!="string"||ne.requestId.length>80)return;const q=Y=>{var se,Fe;return(Fe=(se=m.current)==null?void 0:se.contentWindow)==null?void 0:Fe.postMessage({type:"canvas-app-host",id:h.current.id,channel:b.current,requestId:ne.requestId,...Y},"*")};if(h.current.readOnlyVersion){q({error:"This saved version is read-only. Select Latest to interact."});return}if(JSON.stringify(ne).length>32e4){q({error:"This change exceeds the surface message size limit."});return}if(ne.revision!==f.current.app.revision){q({error:"This design changed. Inspect the current surface before retrying."});return}if(S.current.has(ne.requestId)){const Y=S.current.get(ne.requestId);Y&&q(Y);return}if(S.current.size>=128){const Y=[...S.current].find(([,se])=>se!==null);if(Y)S.current.delete(Y[0]);else{q({error:"Wait for pending surface changes to finish."});return}}S.current.set(ne.requestId,null),y.current++;const Z=ne.editVersion,ie=b.current;try{let Y;if(ne.op==="dirty")await T(!!((_e=ne.args)!=null&&_e.dirty),Z),Y={app:h.current.app};else{const Fe=ne.op==="state"?{patch:(Je=ne.args)==null?void 0:Je.patch}:ne.op==="event"?{name:(De=ne.args)==null?void 0:De.name,payload:(ue=ne.args)==null?void 0:ue.payload}:{name:(ye=ne.args)==null?void 0:ye.name,input:(M=ne.args)==null?void 0:M.input};Y=(await t("canvas.apps."+ne.op,{...Fe,id:f.current.id,sessionId:f.current.sessionId,expectedRevision:f.current.app.revision,expectedStateRevision:ne.stateRevision},{id:b.current+":"+ne.requestId})).result,Y.app.revision===h.current.app.revision&&Y.app.stateRevision>=h.current.app.stateRevision&&(h.current={...h.current,app:Y.app}),(ne.op==="state"||ne.op==="event")&&Number.isSafeInteger(ne.commit)&&ne.commit===Z&&Z===E.current&&await T(!1,Z)}if(ie!==b.current)return;const se={snapshot:{id:h.current.id,app:Y.app,theme:wm()}};S.current.set(ne.requestId,se),q(se),i("")}catch(Y){if(ie!==b.current)return;const se={error:Y.message};S.current.set(ne.requestId,se),q(se),i(Y.message)}finally{y.current--,ie===b.current&&!y.current&&!g.current&&h.current.app.revision!==f.current.app.revision&&O(h.current)}};window.addEventListener("message",te);let j;const _=()=>{cancelAnimationFrame(j),j=requestAnimationFrame(()=>k())},P=new MutationObserver(_);P.observe(document.head,{subtree:!0,childList:!0,characterData:!0});const G=document.getElementById("amp-one");G&&P.observe(G,{attributes:!0,subtree:!0,childList:!0,characterData:!0});const W=["prefers-color-scheme: dark","prefers-reduced-motion: reduce","prefers-contrast: more"].map(D=>matchMedia("("+D+")"));return W.forEach(D=>D.addEventListener("change",_)),()=>{H();for(const D of C.current.values())D();C.current.clear(),window.removeEventListener("message",te),P.disconnect(),cancelAnimationFrame(j),W.forEach(D=>D.removeEventListener("change",_))}},[t]);const I=()=>({id:e.id,sessionId:e.sessionId,expectedRevision:h.current.app.revision,expectedStateRevision:h.current.app.stateRevision}),F=async(H,te)=>{try{const j=await t(H,{...I(),...te});return i(""),j}catch(j){i(j.message)}},z=async H=>{const te=await t("canvas.apps.inspect",{id:e.id,sessionId:e.sessionId,requestId:H.id});p({request:H,input:te.result.requestInput})},U=$i(`/api/canvas/${a.id}/app-host?`+new URLSearchParams(Bo(a)));return n.createElement("section",{className:"a-canvas-app","aria-label":"Interactive conversation surface"},c&&n.createElement("p",{className:"a-canvas-unsaved",role:"status"},"Unsaved input"),n.createElement(yr,null,n.createElement("div",{className:"a-canvas-app-bar"},n.createElement("span",null,"Revision ",A.revision),n.createElement("details",null,n.createElement("summary",null,"History & shared state"),n.createElement("p",null,"Restoring a design keeps compatible current inputs and never repeats actions."),A.versions.map(H=>n.createElement("button",{type:"button",key:H.version,disabled:H.version===A.revision||c||e.readOnlyVersion,onClick:()=>F("canvas.apps.restore",{version:H.version})},"Restore revision ",H.version)),n.createElement("pre",{"aria-label":"Shared surface state"},JSON.stringify(A.state,null,2))))),(o||s)&&n.createElement("div",{className:"a-canvas-app-errors",role:"alert"},s&&n.createElement("p",null,s),o&&o!==s&&n.createElement("p",null,o)),a.app.revision!==A.revision&&n.createElement("p",{role:"status"},"A new design is ready. Your unfinished input is still here. ",n.createElement("button",{type:"button",onClick:async()=>{try{await t("canvas.views.dirty",{...Bo(h.current),dirty:!1}),g.current=!1,u(!1),O(h.current)}catch(H){i(H.message)}}},"Discard unfinished input and load revision ",A.revision)),A.requests.filter(H=>H.status==="pending").map(H=>n.createElement("div",{className:"a-canvas-app-request",key:H.id},n.createElement("span",null,H.action==="theme.preview"?"Preview on this device":H.action==="theme.apply"?"Apply to the shared shell":"Revert this device’s last theme change",": ",H.summary),n.createElement("button",{type:"button",onClick:()=>z(H).catch(te=>i(te.message))},"Review theme change"),n.createElement("button",{type:"button",onClick:()=>F("canvas.apps.resolve",{requestId:H.id,approve:!1})},"Decline"))),d&&A.requests.some(H=>H.id===d.request.id&&H.status==="pending")&&n.createElement("section",{className:"a-canvas-app-review","aria-label":"Review requested theme change"},n.createElement("strong",null,d.request.summary),n.createElement("p",null,d.request.action==="theme.apply"?"Applying changes the shell for all connected clients.":"This action uses this device’s theme controls."),n.createElement("pre",null,d.input.css||"End the preview, or undo the last applied theme if it is still current."),n.createElement("button",{type:"button",onClick:async()=>{await F("canvas.apps.resolve",{requestId:d.request.id,approve:!0})&&p(null)}},"Approve theme change"),n.createElement("button",{type:"button",onClick:()=>p(null)},"Back")),e.readOnlyVersion&&n.createElement("p",{role:"status"},"Saved design, read only.",e.historicalStateUnavailable?" Inputs were not recorded for this older design.":" Inputs show the state saved when this version was created."),n.createElement("iframe",{key:a.app.revision,title:e.title,ref:m,src:U,sandbox:"allow-scripts allow-same-origin",onLoad:()=>k(!0)}))}const fS="modulepreload",gS=function(e){return"/"+e},km={},zg=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let s=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=s(a.map(u=>{if(u=gS(u),u in km)return;km[u]=!0;const d=u.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":fS,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((h,f)=>{m.addEventListener("load",h),m.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return o.then(s=>{for(const l of s||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},xm=4e3;function vS(e,t=0){return()=>a=>{const r=o=>{var i;o.children=(i=o.children)==null?void 0:i.map(s=>{var u,d,p,m,h,f;const l=(d=(u=s.position)==null?void 0:u.start)==null?void 0:d.offset,c=(m=(p=s.position)==null?void 0:p.end)==null?void 0:m.offset;if(s.type==="text"&&Number.isInteger(l)&&Number.isInteger(c))return{type:"emphasis",data:{hName:"span",hProperties:{"data-canvas-source-start":t+l,"data-canvas-source-end":t+c}},children:[s]};if(["inlineCode","code"].includes(s.type)&&Number.isInteger(l)&&Number.isInteger(c)){const g=e.slice(l,c),y=((h=/^`+/.exec(g))==null?void 0:h[0].length)||0;let E=l;if(s.type==="inlineCode"){E+=y;const b=e.slice(E,c-y);b.startsWith(" ")&&b.endsWith(" ")&&b.trim()&&E++}else/^ {0,3}(`{3,}|~{3,})/.test(g)?E+=g.indexOf(` -`)+1:E+=/^ */.exec(g)[0].length;E+s.value.length<=c&&e.slice(E,E+s.value.length)===s.value&&(s.data={...s.data,hProperties:{...(f=s.data)==null?void 0:f.hProperties,"data-canvas-source-start":t+E,"data-canvas-source-end":t+E+s.value.length,"data-canvas-literal":"true"}})}return s.children&&r(s),s})};r(a)}}const bS=/\\[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~]|&(?:#[xX][0-9a-fA-F]{1,6}|#[0-9]{1,7}|[A-Za-z][A-Za-z0-9]+);|\r\n/g;function yS(e,t,a){const r=[0];let o="",i=0;const s=(l,c,u)=>{o+=l;for(let d=1;d<=l.length;d++)r.push(d===l.length?u:c)};for(const l of e.matchAll(bS)){for(let u=i;uString(r??"").toLowerCase().includes(t);const a=[];for(let r=0;rl!==u.some(([p,m])=>d>=p&&d<=m)),r=i;continue}}a.push(i=>i===o)}return r=>{const o=[...String(r??"").toLowerCase()];let i=Array(o.length+1).fill(!1);i[0]=!0;for(const s of a){const l=Array(o.length+1).fill(!1);l[0]=s==="*"&&i[0];for(let c=1;c<=o.length;c++)l[c]=s==="*"?i[c]||l[c-1]:i[c-1]&&(s==="?"||s(o[c-1]));i=l}return i[o.length]}}function nl(e,t,a){const r=xx(t);return e.filter(o=>a(o).some(r))}function Uu(e){return e.runtimeSessionId||e.nativeIdentity||e.id}function ju(e,t){var r,o,i,s,l,c,u,d,p,m,h;if(e.activity)return e.activity;if((r=e.approvals)!=null&&r.some(f=>f.status==null||f.status==="pending"))return{kind:"attention",label:"Approval requested"};if((o=e.questions)!=null&&o.some(f=>f.status==="pending"&&f.required))return{kind:"attention",label:"Answer requested"};if((i=e.questions)!=null&&i.some(f=>{var g;return["unknown","rejected"].includes((g=f.delivery)==null?void 0:g.status)}))return{kind:"attention",label:"Check answer delivery"};if(e.status==="blocked"||((u=(c=(l=(s=t==null?void 0:t.runtimeControl)==null?void 0:s[e.id])==null?void 0:l["task.get"])==null?void 0:c.task)==null?void 0:u.status)==="blocked")return{kind:"attention",label:"Work blocked"};if(["starting","working","running","stopping"].includes(e.status))return{kind:"working",label:e.status==="starting"?"Starting":e.status==="stopping"?"Stopping":"Working"};const a=(p=(d=t==null?void 0:t.attention)==null?void 0:d.items)==null?void 0:p.some(f=>f.id==="session:"+e.id&&f.sessionId===e.id&&f.read);return(e.error||["error","failed"].includes(e.status))&&!a?{kind:"attention",label:"Needs attention"}:(h=(m=t==null?void 0:t.attention)==null?void 0:m.sessions)!=null&&h[e.id]?{kind:"unread",label:"New response"}:{kind:"idle",label:"Idle"}}function $u(e,t=Date.now()/1e3){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return{short:"—",long:"Activity time unavailable"};const a=Math.max(0,t-e);if(a<60)return{short:"now",long:"Just now"};for(const[r,o,i]of[["minute",60,3600],["hour",3600,86400],["day",86400,604800],["week",604800,1/0]])if(a2?"…/"+a.slice(-2).join("/"):t}function Sx(e){const t=e.pathLabel||"",a=e.name||"";return e.customName?t||e.path:t.endsWith("/"+a)?t.slice(0,-a.length-1):fg(e.path)}const Vc=100;function al(e){return(e.workspaces||[]).filter(t=>t.available===!0&&!!t.path)}function ho(e){var t;return(e==null?void 0:e.sessionKind)==="root"?!0:(e==null?void 0:e.sessionKind)==="worker"||(e==null?void 0:e.sessionKind)==="internal"?!1:(t=e==null?void 0:e.forkTranscript)!=null&&t.length||e!=null&&e.editOrigin?!0:!(e!=null&&e.nativeParentId)}function gg(e=[],t){if(!t)return[];const a=t.nativeIdentity||t.runtimeSessionId||t.id;return e.filter(r=>r.id!==t.id&&!ho(r)&&(r.parentId===t.id||r.nativeParentId===a&&(t.nativeProject?r.nativeProject===t.nativeProject:t.workspaceId?r.workspaceId===t.workspaceId:!!t.workspace&&r.workspace===t.workspace)))}function Cx(e){return[e.navigationActivityAt,e.recentActivityAt,e.createdAt].find(t=>typeof t=="number"&&Number.isFinite(t)&&t>=0)??0}function vg(e,t,a="workspace"){const r=al(e),o=new Map(r.map(h=>[h.id,h])),i=new Map(r.map(h=>[h.path,h])),s=new Set(e.pinnedSessionIds||[]),l=e.conversationOrganization||{},c=l.archived||{},u=e.view||{},d=u.navArchive||"active",p=u.navSort||"activity",m=new Map((e.pinnedSessionIds||[]).map((h,f)=>[h,f]));return(e.sessions||[]).map((h,f)=>({chat:h,position:f,workspace:o.get(h.workspaceId)||i.get(h.workspace)})).filter(h=>{var f,g,E;return ho(h.chat)&&(h.workspace||((f=h.chat.location)==null?void 0:f.kind)==="managed")&&(a==="all"||((g=h.chat.location)==null?void 0:g.kind)!=="managed"&&((E=h.workspace)==null?void 0:E.id)===(t==null?void 0:t.id))}).filter(({chat:h})=>{var f;return a!=="all"||u.navLocationFilter!=="managed"||((f=h.location)==null?void 0:f.kind)==="managed"}).filter(({chat:h})=>d==="all"||d==="archived"===Object.hasOwn(c,h.id)).map(h=>{var f,g,E,y,b;return{...h.chat,workspace:((f=h.workspace)==null?void 0:f.path)||h.chat.workspace,workspaceId:((g=h.chat.location)==null?void 0:g.kind)==="managed"?null:h.workspace.id,workspaceName:((E=h.chat.location)==null?void 0:E.kind)==="managed"?"No workspace":h.workspace.name||"",workspaceLabel:((y=h.chat.location)==null?void 0:y.kind)==="managed"?"No workspace":(b=h.workspace)==null?void 0:b.label,pinned:s.has(h.chat.id),recentActivityAt:Cx(h.chat),position:h.position}}).sort((h,f)=>Number(f.pinned)-Number(h.pinned)||(h.pinned?m.get(h.id)-m.get(f.id):p==="name"?(h.title||"Untitled conversation").toLowerCase()<(f.title||"Untitled conversation").toLowerCase()?-1:(h.title||"Untitled conversation").toLowerCase()>(f.title||"Untitled conversation").toLowerCase()?1:0:p==="created"?(f.createdAt||0)-(h.createdAt||0):f.recentActivityAt-h.recentActivityAt)||h.position-f.position)}function Es(e,t,{section:a=null}={}){var C,O;const r=e.view||{},o=r.navChatScope==="all"?"all":"workspace",i=r.navFilter||"",s=e.selectedSessionId??null;t=al(e).find(k=>k.id===((t==null?void 0:t.id)??e.selectedWorkspaceId));const l={mode:o,workspaceId:o==="all"?null:(t==null?void 0:t.id)??null,filter:i,selectedSessionId:s};a&&(l.section=a),r.navSort&&r.navSort!=="activity"&&(l.sort=r.navSort),o==="all"&&r.navLocationFilter==="managed"&&(l.locationFilter="managed");const c=r.navStatusFilter||"all";c!=="all"&&(l.statusFilter=c),r.navArchive&&r.navArchive!=="active"&&(l.archive=r.navArchive);const u=a?(C=e.sidebarNavigation)==null?void 0:C[a]:e.chatNavigation,d=k=>((k==null?void 0:k.sort)||"activity")===(l.sort||"activity"),p=k=>((k==null?void 0:k.locationFilter)||"all")===(l.locationFilter||"all"),m=r.navChatPage,h=m&&p(m)&&d(m)&&Object.entries(l).every(([k,T])=>m[k]===T),f=a==="pinned"?Math.max(0,Math.min(((u==null?void 0:u.pages)||1)-1,r.navPinnedPage||0)):h&&Number.isSafeInteger(m.index)?Math.max(0,Math.min(((u==null?void 0:u.pages)||1)-1,m.index)):null;if(u!=null&&u.scope&&p(u.scope)&&d(u.scope)&&Array.isArray(u.items)&&Object.entries(l).every(([k,T])=>u.scope[k]===T)&&(f===null||u.index===f))return u;if((O=e.library)!=null&&O.bounded)return{items:[],total:0,index:0,pages:1,start:0,end:0,scope:l,pending:!0};let g=nl(vg(e,t,o),i,k=>[k.title||"Untitled conversation",k.description||"",k.id,Uu(k),k.workspace,k.workspaceName]);(a==="pinned"||a==="recent")&&(g=g.filter(k=>k.pinned===(a==="pinned")));const E={attention:0,working:0,unread:0,idle:0};g=g.map(k=>({...k,activity:ju(k,e)}));for(const k of g)E[k.activity.kind]++;c!=="all"&&(g=g.filter(k=>k.activity.kind===c));const y=a?g.length>50?40:50:Vc,b=o==="all"?0:Math.floor(Math.max(0,g.findIndex(k=>k.id===s))/y),S=a==="pinned"?r.navPinnedPage||0:h&&Number.isSafeInteger(m.index)?m.index:b,w=Math.max(1,Math.ceil(g.length/y)),N=Math.max(0,Math.min(w-1,S)),x=N*y,A=Math.min(g.length,x+y);return{items:g.slice(x,A),total:g.length,index:N,pages:w,start:x,end:A,scope:l,activityCounts:E}}function Nx(e){var i,s,l;if(!e)return{items:[],total:0};if(Array.isArray((i=e.headerChatNavigation)==null?void 0:i.items))return e.headerChatNavigation;const t=(s=e.workspaces)==null?void 0:s.find(c=>c.id===e.selectedWorkspaceId),a=(l=e.sessions)==null?void 0:l.find(c=>c.id===e.selectedSessionId),r=vg({...e,view:{...e.view,navArchive:"active",navCollection:null}},t),o=r.slice(0,Vc);return a&&ho(a)&&!o.some(c=>c.id===a.id)&&o.splice(Math.max(0,Vc-1),1,a),{items:o,total:r.length}}function bg(e,t){var r;if(Number.isSafeInteger(t==null?void 0:t.subagentCount)&&t.subagentCount>=0)return t.subagentCount;const a=e.subagentNavigation;return t&&((r=a==null?void 0:a.scope)==null?void 0:r.sessionId)===t.id&&Number.isSafeInteger(a.unfilteredTotal)?a.unfilteredTotal:gg(e.sessions,t).length}function Rx(e,t){var h,f;const a=((h=e.view)==null?void 0:h.subagentHistory)||{},r=a.filter||"",o={sessionId:t==null?void 0:t.id,filter:r},i=e.subagentNavigation,s=Number.isSafeInteger(a.index)?a.index:0;if(i!=null&&i.scope&&Array.isArray(i.items)&&Object.entries(o).every(([g,E])=>i.scope[g]===E)&&i.index===Math.max(0,Math.min(i.pages-1,s)))return i;if((f=e.library)!=null&&f.bounded)return{items:[],total:0,unfilteredTotal:bg(e,t),index:0,pages:1,start:0,end:0,scope:o,pending:!0};const l=gg(e.sessions,t),c=nl(l,r,g=>[g.title,g.description,g.id,g.nativeIdentity]),u=Math.max(1,Math.ceil(c.length/50)),d=Math.max(0,Math.min(u-1,s)),p=d*50,m=Math.min(c.length,p+50);return{items:c.slice(p,m),total:c.length,unfilteredTotal:l.length,index:d,pages:u,start:p,end:m,scope:o}}function yg(e,t,a){if(t===a||!e.includes(t)||!e.includes(a))return e;const r=e.filter(o=>o!==t);return r.splice(e.indexOf(a),0,t),r}const Eg=v.createContext(!0),Ji=new WeakMap;function Bu(e="(max-width: 760px)"){const[t,a]=v.useState(()=>typeof matchMedia=="function"&&matchMedia(e).matches);return v.useEffect(()=>{if(typeof matchMedia!="function")return;const r=matchMedia(e),o=()=>a(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[e]),t}function rl(e,t,a){const r=v.useRef(a);r.current=a,v.useEffect(()=>{var d;const o=e.current;if(!t||!o)return;const i=document.activeElement,s=[];let l=o;for(;l!=null&&l.parentElement&&l.id!=="amp-one";){for(const p of l.parentElement.children){if(p===l||p.tagName==="STYLE"||p.matches(".a-navigation-scrim,.a-details-scrim,.a-toolbar-scrim"))continue;const m=Ji.get(p)||{count:0,original:p.inert};m.count++,Ji.set(p,m),s.push(p),p.inert=!0}l=l.parentElement}const c=()=>[...o.querySelectorAll('button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href],[tabindex="0"]')].filter(p=>p.getClientRects().length&&!p.closest("[inert]"));(d=c()[0])==null||d.focus({preventScroll:!0});const u=p=>{if(p.defaultPrevented)return;if(p.key==="Escape"){p.preventDefault(),r.current();return}if(p.key!=="Tab")return;const m=c(),h=m[0],f=m.at(-1);if(!h){p.preventDefault();return}p.shiftKey&&(document.activeElement===h||!o.contains(document.activeElement))?(p.preventDefault(),f.focus()):!p.shiftKey&&(document.activeElement===f||!o.contains(document.activeElement))&&(p.preventDefault(),h.focus())};return document.addEventListener("keydown",u),()=>{var p;document.removeEventListener("keydown",u);for(const m of s){const h=Ji.get(m);h&&!--h.count&&(m.inert=h.original,Ji.delete(m))}i!=null&&i.isConnected&&!i.closest("[inert]")&&((p=i.focus)==null||p.call(i,{preventScroll:!0}))}},[t,e])}function ol(){const[e,t]=v.useState(()=>Date.now()/1e3);return v.useEffect(()=>{if(typeof window>"u")return;const a=setInterval(()=>t(Date.now()/1e3),3e4);return()=>clearInterval(a)},[]),e}function Hu({activity:e}){return n.createElement("span",{className:"a-navigation-status","data-kind":e.kind,"aria-label":e.label,title:e.label},e.kind==="working"?n.createElement(Ro,{className:"a-progress-spinner"}):e.kind==="attention"?n.createElement(zn,null):e.kind==="unread"?n.createElement("span",{className:"a-navigation-unread"}):n.createElement(Fi,null))}function Tx({at:e,now:t}){const a=$u(e,t);return n.createElement("span",{className:"a-navigation-age","data-view-source":"activity-time",title:a.long,"aria-label":"Last activity: "+a.long},a.short)}function Ms({label:e,value:t}){const[a,r]=v.useState("");return v.useEffect(()=>r(""),[t]),n.createElement("div",{className:"a-navigation-copy"},n.createElement("div",null,n.createElement("span",null,e),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy "+e.toLowerCase(),onClick:async()=>{try{await navigator.clipboard.writeText(t),r("Copied")}catch{r("Select the text and copy it manually.")}}},a==="Copied"?n.createElement(Pt,null):n.createElement(rr,null))),n.createElement("code",null,t),a&&n.createElement("small",{role:"status"},a))}function wg({row:e,now:t,actions:a}){const r=e.activityCounts||{};return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-navigation-detail-heading"},n.createElement(nr,null),n.createElement("span",null,"Workspace details")),n.createElement("h3",null,e.customName||e.name),n.createElement("dl",null,n.createElement("dt",null,"Chats"),n.createElement("dd",null,e.chatCount??0),n.createElement("dt",null,"Activity"),n.createElement("dd",null,r.working||0," working · ",r.attention||0," need attention"),n.createElement("dt",null,"Last activity"),n.createElement("dd",null,$u(e.recentActivityAt,t).long)),n.createElement(Ms,{label:"Full workspace path",value:e.path}),a&&n.createElement("div",{className:"a-navigation-actions"},a))}function Vu({className:e="",label:t,children:a,details:r,expanded:o=!1,...i}){var k;const s=Bu(),l=v.useContext(Eg),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),p=v.useRef(null),m=v.useRef(null),h=v.useRef(!1),f=v.useId(),[g,E]=v.useState(!1),[y,b]=v.useState(!1),[S,w]=v.useState({left:0,top:0}),N=()=>{clearTimeout(p.current),clearTimeout(m.current)},x=(T=!1)=>{var I;N(),E(!1),b(!1),T&&((I=d.current)==null||I.focus({preventScroll:!0}))};rl(u,l&&s&&g,()=>x(!0));const A=(T=!1)=>{var I;N(),!((I=c.current)!=null&&I.closest('[data-reordering="true"]'))&&(!T&&document.querySelector('.a-navigation-flyout[data-locked="true"]')||(document.dispatchEvent(new CustomEvent("amplifier-navigation-details",{detail:f})),h.current=T,b(T),E(!0)))};v.useEffect(()=>()=>N(),[]),v.useEffect(()=>{l||x()},[l]),v.useEffect(()=>{o&&A(!0)},[o]),v.useEffect(()=>{if(!g)return;const T=z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),x(y))},I=z=>{var q,W;!((q=c.current)!=null&&q.contains(z.target))&&!((W=u.current)!=null&&W.contains(z.target))&&x()},F=z=>{z.detail!==f&&x()};return document.addEventListener("keydown",T,!0),document.addEventListener("pointerdown",I),document.addEventListener("amplifier-navigation-details",F),()=>{document.removeEventListener("keydown",T,!0),document.removeEventListener("pointerdown",I),document.removeEventListener("amplifier-navigation-details",F)}},[g,y,f]),v.useEffect(()=>{var T,I;g&&y&&h.current&&(h.current=!1,(I=(T=u.current)==null?void 0:T.querySelector("button"))==null||I.focus({preventScroll:!0}))},[g,y]),v.useLayoutEffect(()=>{if(!g||!u.current||!c.current)return;const T=()=>{const z=(c.current.closest(".a-nav-slot")?c.current:d.current||c.current).getBoundingClientRect(),q=u.current.getBoundingClientRect(),W=10,X=z.right+8,U=X+q.width<=innerWidth-W?X:Math.max(W,z.left-q.width-8),_={left:Math.min(U,innerWidth-q.width-W),top:Math.max(W,Math.min(z.top,innerHeight-q.height-W))};w(P=>P.left===_.left&&P.top===_.top?P:_)};T();const I=new ResizeObserver(T);return I.observe(u.current),I.observe(c.current),window.addEventListener("resize",T),document.addEventListener("scroll",T,!0),()=>{I.disconnect(),window.removeEventListener("resize",T),document.removeEventListener("scroll",T,!0)}},[g,r]);const C=T=>{var I,F;T.relatedTarget instanceof Node&&((I=c.current)!=null&&I.contains(T.relatedTarget)||(F=u.current)!=null&&F.contains(T.relatedTarget))||(clearTimeout(p.current),y||(m.current=setTimeout(()=>x(),250)))},O=((k=c.current)==null?void 0:k.closest(".a-nav-slot"))||(typeof document<"u"?document.getElementById("amp-one"):null);return n.createElement("div",{...i,ref:c,className:e+(g?" is-peeking":""),onPointerEnter:T=>{clearTimeout(m.current),!s&&T.pointerType!=="touch"&&!g&&(p.current=setTimeout(()=>A(),550))},onPointerLeave:C,onClick:T=>{T.target.closest("[data-navigation-select]")&&x()}},a,n.createElement("button",{ref:d,type:"button",className:"a-icon a-navigation-more","aria-label":"Details and actions for "+t,"aria-expanded":g,"aria-controls":g?f:void 0,onClick:()=>g&&y?x():A(!0)},n.createElement(Di,null)),g&&O&&Mi.createPortal(n.createElement(n.Fragment,null,s&&n.createElement("div",{className:"a-details-scrim",onClick:()=>x(!0)}),n.createElement("section",{ref:u,id:f,role:"dialog","aria-modal":s||void 0,"aria-label":"Details for "+t,className:"a-navigation-flyout","data-locked":y,style:S,onPointerEnter:()=>clearTimeout(m.current),onPointerLeave:C,onFocus:()=>{clearTimeout(m.current),y||b(!0)}},r({close:x}))),O))}function hm(e,t,a){if(!e.includes(t))return e;const r=e.filter(o=>o!==t);return r.splice(Math.max(0,Math.min(a,r.length)),0,t),r}function kg({items:e,ids:t,onChange:a,busy:r=!1,renderItem:o,className:i="",rowClassName:s="",floatingClassName:l="",action:c="view.update",savedHint:u="",onDraggingChange:d}){var U;const p=v.useRef(null),m=v.useRef(null),h=v.useRef(new Map),f=v.useRef(!1),g=v.useRef(!0),[E,y]=v.useState(null),[b,S]=v.useState(null),[w,N]=v.useState(""),x=E||t,A=new Map(e.map(_=>[_.id,_])),C=_=>{var P;return(P=globalThis.requestAnimationFrame)==null?void 0:P.call(globalThis,()=>{var G,Z;return(Z=(G=p.current)==null?void 0:G.querySelector(`[data-order-id="${CSS.escape(_)}"] .a-reorder-grip`))==null?void 0:Z.focus({preventScroll:!0})})},O=()=>{p.current&&(h.current=new Map([...p.current.querySelectorAll("[data-order-id]")].map(_=>[_.dataset.orderId,_.getBoundingClientRect()])))};v.useEffect(()=>(g.current=!0,()=>{g.current=!1,m.current=null}),[]),v.useLayoutEffect(()=>{var _;if(!(!p.current||window.matchMedia("(prefers-reduced-motion: reduce)").matches))for(const P of p.current.querySelectorAll("[data-order-id]")){const G=h.current.get(P.dataset.orderId);P.getAnimations().forEach(D=>D.cancel());const Z=P.getBoundingClientRect();G&&P.dataset.orderId!==((_=m.current)==null?void 0:_.id)&&G.top!==Z.top&&P.animate([{transform:`translateY(${G.top-Z.top}px)`},{transform:"translateY(0)"}],{duration:150,easing:"ease-out"})}},[x.join("\0")]);const k=async(_,P)=>{var G;if(!(r||f.current)){if(_.join("\0")===t.join("\0")){y(null);return}f.current=!0,y(_);try{await a(_,{id:P,to:_.indexOf(P)}),g.current&&N(`${(G=A.get(P))==null?void 0:G.label} moved to position ${_.indexOf(P)+1}.${u?" "+u:""}`)}catch(Z){g.current&&N(Z.message||"Could not change order.")}finally{f.current=!1,g.current&&(y(null),C(P))}}},T=_=>{var G;const P=m.current;P&&(O(),m.current=null,S(null),d==null||d(!1),(G=p.current)!=null&&G.hasPointerCapture(P.pointerId)&&p.current.releasePointerCapture(P.pointerId),P.active&&!_&&P.valid?k(P.preview,P.id):(y(null),N("Reorder cancelled."),C(P.id)))};v.useEffect(()=>{if(typeof document>"u")return;const _=P=>{P.key==="Escape"&&m.current&&(P.preventDefault(),P.stopPropagation(),T(!0))};return document.addEventListener("keydown",_,!0),()=>document.removeEventListener("keydown",_,!0)}),v.useEffect(()=>{m.current&&m.current.original.join("\0")!==t.join("\0")&&T(!0)},[t.join("\0")]);const I=(_,P)=>{if(r||f.current||_.button!==0)return;_.preventDefault(),document.dispatchEvent(new CustomEvent("amplifier-navigation-details",{detail:"reordering"}));const G=_.currentTarget.closest("[data-order-id]"),Z=G.getBoundingClientRect(),D=p.current.getBoundingClientRect();let ne=p.current.parentElement;for(;ne&&!(ne.scrollHeight>ne.clientHeight&&/(auto|scroll)/.test(getComputedStyle(ne).overflowY));)ne=ne.parentElement;const H=[...p.current.querySelectorAll("[data-order-id]")];m.current={id:P,pointerId:_.pointerId,x:_.clientX,y:_.clientY,box:Z,bounds:D,scroll:ne,scrollTop:(ne==null?void 0:ne.scrollTop)||0,centers:H.map(j=>{const ie=j.getBoundingClientRect();return(ie.top+ie.bottom)/2}),original:[...t],preview:[...t],active:!1,valid:!0},p.current.setPointerCapture(_.pointerId)},F=_=>{const P=m.current;if(!P||!P.active&&Math.hypot(_.clientX-P.x,_.clientY-P.y)<5)return;P.active||d==null||d(!0),P.active=!0,_.preventDefault();const{box:G,bounds:Z,scroll:D}=P;if(D){const Ee=D.getBoundingClientRect();_.clientYEe.bottom-35&&(D.scrollTop+=12)}const ne=((D==null?void 0:D.scrollTop)||0)-P.scrollTop;P.valid=_.clientX>=Z.left-24&&_.clientX<=Z.right+24&&_.clientY>=Z.top-ne-28&&_.clientY<=Z.bottom-ne+28;let H=0,j=1/0;P.centers.forEach((Ee,me)=>{const _e=Math.abs(_.clientY+ne-Ee);_e{O(),k(hm(t,_,P),_)},q=(_,P=!1)=>n.createElement("button",{type:"button",className:"a-icon a-order-grip a-reorder-grip","aria-disabled":r||f.current||void 0,draggable:!1,"data-action":c,"aria-label":"Reorder "+_.label,title:"Drag, or use Up/Down (Alt + Up/Down also works)",tabIndex:P?-1:0,onPointerDown:G=>I(G,_.id),onKeyDown:G=>{["ArrowUp","ArrowDown"].includes(G.key)&&(G.preventDefault(),z(_.id,t.indexOf(_.id)+(G.key==="ArrowUp"?-1:1)))}},n.createElement(Vk,null)),W=b&&A.get(b.id),X=((U=p.current)==null?void 0:U.closest(".a-settings-experience,.a-nav-slot"))||p.current;return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-reorder-list "+i,ref:p,"data-reordering":!!b||void 0,onPointerMove:F,onPointerUp:()=>T(!1),onPointerCancel:()=>T(!0),onLostPointerCapture:()=>{m.current&&T(!0)},onDragStart:_=>_.preventDefault()},x.map((_,P)=>{const G=A.get(_)||{id:_,label:_};return n.createElement("div",{key:_,"data-order-id":_,className:`a-reorder-item ${s}${(b==null?void 0:b.id)===_?" a-order-placeholder":""}`},(b==null?void 0:b.id)===_&&b.valid&&n.createElement("span",{className:"a-order-insertion","aria-hidden":"true"}),o(G,{handle:q(G),index:P,move:Z=>z(_,Z),floating:!1}))})),W&&X&&Mi.createPortal(n.createElement("div",{className:"a-order-floating a-reorder-floating "+l,"aria-hidden":"true",inert:!0,style:{left:b.left,top:b.top,width:b.width}},o(W,{handle:q(W,!0),index:x.indexOf(b.id),move:()=>{},floating:!0})),X),n.createElement("span",{className:"a-sr-only",role:"status","aria-live":"polite"},w))}function Da({state:e={},section:t,page:a,count:r,settings:o=!1}){var s,l,c,u,d,p;const i=r??(o?(s=e.attention)==null?void 0:s.settingsUnread:a?(c=(l=e.attention)==null?void 0:l.pages)==null?void 0:c[a]:t?(d=(u=e.attention)==null?void 0:u.sections)==null?void 0:d[t]:(p=e.attention)==null?void 0:p.unread);return i>0?n.createElement("span",{className:"a-attention-badge",role:"status","aria-label":`${i} unread items`},i):null}function xg(e,t,a){const r=JSON.stringify(e.filter(o=>o&&!o.read).map(o=>[o.id,o.fingerprint]));n.useEffect(()=>{const o=e.filter(m=>m&&!m.read),i=a.current;if(!o.length||!i)return;let s,l=!1,c=!1;const u=()=>l&&!document.hidden&&document.hasFocus()&&i.getClientRects().length>0&&!i.closest("[inert], [hidden], details:not([open])"),d=()=>{clearTimeout(s),!c&&u()&&(s=setTimeout(()=>{u()&&(c=!0,Promise.resolve(br(t,o)).catch(()=>{c=!1}))},750))},p=new IntersectionObserver(m=>{l=m[0].isIntersecting,d()});return p.observe(i),document.addEventListener("visibilitychange",d),window.addEventListener("focus",d),window.addEventListener("blur",d),()=>{clearTimeout(s),p.disconnect(),document.removeEventListener("visibilitychange",d),window.removeEventListener("focus",d),window.removeEventListener("blur",d)}},[r,t,a])}function Ui({item:e,act:t,children:a,className:r}){const o=n.useRef(null);return xg(e?[e]:[],t,o),n.createElement("div",{ref:o,className:r},a)}function zs({state:e,act:t,page:a,items:r,showItems:o=!1}){var s;const i=r||(((s=e.attention)==null?void 0:s.items)||[]).filter(l=>l.page===a&&!l.read);return!i.length||a==="updates"?null:n.createElement("div",{className:"a-attention-review"},i.map(l=>n.createElement(Ui,{key:l.id,item:l,act:t},n.createElement("p",null,n.createElement("strong",null,l.title),l.detail&&n.createElement(n.Fragment,null," · ",l.detail)))))}const br=(e,t)=>e("attention.read",{ids:t.map(a=>a.id),fingerprints:Object.fromEntries(t.map(a=>[a.id,a.fingerprint]))});function Ix({state:e,act:t}){var l;const[a,r]=n.useState(!1),o=((l=e.attention)==null?void 0:l.items)||[],i=o.filter(c=>a||!c.read);async function s(c){c.sessionId?(await t("session.select",{id:c.sessionId}),await t("view.update",{patch:{panel:null}})):c.requestId?(await t("view.update",{patch:{panel:"feedback"}}),await br(t,[c])):await t("view.update",{patch:{panel:"settings",settingsSection:c.section,settingsExpanded:[c.page]}})}return n.createElement("section",{className:"a-activity-inbox","aria-label":"Activity to review"},n.createElement("p",null,"Finished work and items that need your attention. Read status is shared with your agent and other devices."),o.some(c=>c.read)&&n.createElement("button",{className:"a-link",type:"button",onClick:()=>r(!a)},a?"Hide reviewed items":"Show reviewed items"),i.length?n.createElement(n.Fragment,null,i.map(c=>n.createElement("div",{className:"a-attention-item",key:c.id},n.createElement("button",{className:"a-attention-open",type:"button","data-action":c.sessionId?"session.select":"view.update",onClick:()=>s(c)},n.createElement("strong",null,c.title),n.createElement("span",null,c.label||c.detail))))):n.createElement("p",null,"All caught up."))}function Ax(e){var t,a;return(a=(t=e==null?void 0:e.attention)==null?void 0:t.items)==null?void 0:a.find(r=>r.id==="completion:"+e.selectedSessionId&&!r.read)}function _x(e,t,a,r=!0){var s,l,c,u;const o=Ax(e),i=!!((s=e==null?void 0:e.view)!=null&&s.panel)||!!((l=e==null?void 0:e.view)!=null&&l.canvasFocused)||!!((c=e==null?void 0:e.view)!=null&&c.navExpanded)&&matchMedia("(max-width:760px)").matches||!!((u=e==null?void 0:e.canvas)!=null&&u.open)&&matchMedia("(max-width:760px)").matches;n.useEffect(()=>{if(!r||!o||i||!a.current)return;const d=a.current;let p;const m=()=>!document.hidden&&document.hasFocus()&&d.clientHeight>0&&getComputedStyle(d).visibility!=="hidden"&&!d.closest("[inert]")&&d.scrollHeight-d.scrollTop-d.clientHeight<40,h=()=>{clearTimeout(p),m()&&(p=setTimeout(()=>{m()&&br(t,[o])},900))};d.addEventListener("scroll",h,{passive:!0}),document.addEventListener("visibilitychange",h),window.addEventListener("focus",h),window.addEventListener("blur",h);const f=new ResizeObserver(h);f.observe(d);for(const g of d.children)f.observe(g);return h(),()=>{clearTimeout(p),f.disconnect(),d.removeEventListener("scroll",h),document.removeEventListener("visibilitychange",h),window.removeEventListener("focus",h),window.removeEventListener("blur",h)}},[o==null?void 0:o.id,o==null?void 0:o.fingerprint,i,t,a,r])}const Ul=new WeakMap,Sg=e=>{var t;return(t=e==null?void 0:e.closest)==null?void 0:t.call(e,"[data-activity-region],.a-model-popover,.a-location-picker,.a-settings-page-body,.a-card,section,form")};function Wu(e){if(!e)return()=>{};const t=Ul.get(e)||{tokens:new Set,busy:e.getAttribute("aria-busy")},a=Symbol();t.tokens.add(a),Ul.set(e,t),e.setAttribute("data-region-pending",""),e.setAttribute("aria-busy","true");let r=!1;return()=>{r||(r=!0,t.tokens.delete(a),t.tokens.size||(e.removeAttribute("data-region-pending"),t.busy===null?e.removeAttribute("aria-busy"):e.setAttribute("aria-busy",t.busy),Ul.delete(e)))}}function Zu(e,t){v.useEffect(()=>t?Wu(e.current):void 0,[t])}function Xt({busy:e=!1,name:t,children:a,className:r="",as:o="div",...i}){const s=v.useRef(null);return Zu(s,e),n.createElement(o,{...i,ref:s,className:r,"data-activity-region":t||""},a)}function Wc(e,t,a){var o;const r=v.useRef(null);return a||(r.current={key:e,value:t}),a&&((o=r.current)==null?void 0:o.key)===e?r.current.value:t}const Ki=[];function il(e,t,a){const r=v.useRef(a);r.current=a,v.useEffect(()=>{if(!e||!t.current)return;let o=!1;const i={};Ki.push(i);const s=d=>!!t.current&&!d.composedPath().includes(t.current),l=d=>{o=s(d)},c=d=>{o&&s(d)&&r.current()},u=d=>{d.key==="Escape"&&Ki.at(-1)===i&&(d.preventDefault(),d.stopImmediatePropagation(),r.current())};return document.addEventListener("pointerdown",l,!0),document.addEventListener("click",c,!0),document.addEventListener("keydown",u,!0),()=>{Ki.splice(Ki.indexOf(i),1),document.removeEventListener("pointerdown",l,!0),document.removeEventListener("click",c,!0),document.removeEventListener("keydown",u,!0)}},[e,t])}function nt({phase:e,message:t,detail:a}){const r=v.useRef(null),o=["working","queued","pending","checking","staging","validating","activating"].includes(e),i=["error","failed"].includes(e),s=o?Ro:i?Uk:e==="neutral"?ug:qk;return v.useEffect(()=>o&&t?Wu(Sg(r.current)):void 0,[o,!!t]),t?n.createElement("div",{ref:r,className:`a-check-result ${o||e==="neutral"?"pending":i?"error":"success"}`,role:i?"alert":"status","aria-live":"polite"},n.createElement(s,{"aria-hidden":"true",className:o?"a-progress-spinner":void 0}),n.createElement("div",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a))):null}const Ju=v.createContext(null);function Pa({id:e,title:t,summary:a,state:r,act:o,children:i}){var m,h,f;const s=v.useContext(Ju),l={setup:["loaded-modules","providers","routing","defaults","conversation"],capabilities:["smart-tools","add-bundles","app-bundles","loaded-modules","registries","share-bundle"],maintenance:["ready-conversations","updates","diagnostics","history","permissions","notifications","automation","repair","reset"]},c=s||((h=(m=r.view)==null?void 0:m.settingsExpanded)==null?void 0:h.find(g=>{var E,y;return!((E=r.view)!=null&&E.settingsSection)||((y=l[r.view.settingsSection])==null?void 0:y.includes(g))})),u=c===e,d=v.useRef();if(v.useEffect(()=>{var g,E,y;u&&!s&&((g=d.current)==null||g.focus({preventScroll:!0}),(y=(E=d.current)==null?void 0:E.closest(".a-dialog"))==null||y.scrollTo(0,0))},[u,s]),s)return u?n.createElement("section",{className:"a-settings-page","data-settings-page":e},n.createElement("div",{id:"settings-group-"+e,className:"a-settings-page-body"},i)):null;if(c&&!u)return null;const p=()=>o("view.update",{patch:{settingsExpanded:u?[]:[e]}});return u?n.createElement("section",{className:"a-settings-page",key:e},n.createElement("button",{type:"button",className:"a-link a-settings-back","data-action":"view.update",onClick:p},n.createElement(Sa,null),"Back to ",{setup:"Setup",capabilities:"Capabilities",maintenance:"Maintenance"}[((f=r.view)==null?void 0:f.settingsSection)||"setup"]),n.createElement("h3",{ref:d,tabIndex:-1},t),n.createElement(zs,{state:r,act:o,page:e}),n.createElement("div",{id:"settings-group-"+e,className:"a-settings-page-body"},i)):n.createElement("section",{className:"a-settings-group"},n.createElement("button",{type:"button",className:"a-settings-group-title","aria-label":t+(a?" "+a:""),"data-action":"view.update",onClick:p},n.createElement("span",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a)),n.createElement(Da,{state:r,page:e}),n.createElement(en,{"aria-hidden":"true"})))}function Cg({id:e,accept:t,disabled:a,action:r,onFile:o,label:i="Choose file",hint:s}){const l=v.useRef(),[c,u]=v.useState(!1),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(!1),E=v.useRef(!1);async function y(b){if(!(!b||a||E.current)){E.current=!0,g(!0),h(""),p(b.name);try{await o(b)}catch(S){h(S.message)}finally{E.current=!1,g(!1)}}}return n.createElement(Xt,{busy:f,name:e,className:`a-file-drop ${c?"drag-over":""}`,onDragOver:b=>{b.preventDefault(),a||u(!0)},onDragLeave:()=>u(!1),onDrop:b=>{var S;b.preventDefault(),u(!1),y((S=b.dataTransfer.files)==null?void 0:S[0])}},n.createElement(mg,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("button",{type:"button",className:"a-soft",disabled:a||f,"data-operation-pending":f||void 0,"aria-busy":f||void 0,"data-action":r,onClick:()=>{var b;return(b=l.current)==null?void 0:b.click()}},i),n.createElement("small",null,d||s||"Drop a file here, or browse to choose one.")),n.createElement("input",{ref:l,id:e,className:"a-file-input",type:"file",accept:t,disabled:a,"data-action":r,"aria-label":i,onChange:b=>{var S;y((S=b.target.files)==null?void 0:S[0]),b.target.value=""}}),m&&n.createElement(nt,{phase:"error",message:m}))}function Px(e){var a;const t=(a=(e.getData("text/uri-list")||e.getData("text/plain")||"").split(` +`).find(r=>r.trim()&&!r.startsWith("#")))==null?void 0:a.trim();if(!t)return null;if(t.startsWith("file://"))try{return decodeURIComponent(new URL(t).pathname)}catch{return null}return t}function Ox({id:e,parent:t,act:a,status:r,listing:o,onCreated:i}){const[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(null),[m,h]=v.useState(""),f=v.useRef(!1);v.useEffect(()=>{u(""),l(!1),h("")},[t]),v.useEffect(()=>{!d||(r==null?void 0:r.commandId)!==d||(r.phase==="error"&&(h(r.error||"Could not create the folder."),p(null),f.current=!1),r.phase==="ready"&&(o==null?void 0:o.createdBy)===d&&(p(null),f.current=!1,u(""),l(!1),i(o.path)))},[d,r==null?void 0:r.commandId,r==null?void 0:r.phase,o==null?void 0:o.createdBy]);async function g(){if(!(!c.trim()||f.current)){f.current=!0,h(""),p("sending");try{const E=await a("locations.create",{controlId:e,path:t,name:c.trim()});if(!(E!=null&&E.accepted)||!E.operationId)throw Error((E==null?void 0:E.error)||"Folder creation was not accepted.");p(E.operationId)}catch(E){f.current=!1,p(null),h(E.message)}}}return n.createElement("div",{className:"a-create-folder"},s?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:e+"-folder-name"},"New folder name"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:e+"-folder-name",value:c,maxLength:255,autoFocus:!0,disabled:!!d,onChange:E=>u(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),g())}}),n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.create",disabled:!!d||!c.trim(),onClick:g},d?"Creating…":"Create folder"),n.createElement("button",{type:"button",className:"a-soft",disabled:!!d,onClick:()=>{l(!1),u(""),h("")}},"Cancel"))):n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:!!d,onClick:()=>l(!0)},n.createElement(Hk,null),"New folder"),m&&n.createElement(nt,{phase:"error",message:m}))}function Ma({id:e,value:t,onChange:a,state:r,act:o,placeholder:i,action:s="view.update",directory:l=!1,multiline:c=!1}){var k,T,I,F,z;const[u,d]=v.useState(!1),[p,m]=v.useState(""),[h,f]=v.useState(""),g=(k=r.view)==null?void 0:k.locationPicker,E=(g==null?void 0:g.controlId)===e,y=((T=r.locationListing)==null?void 0:T.controlId)===e?r.locationListing:null;v.useEffect(()=>{E&&f(g.path??(y==null?void 0:y.path)??"")},[E,g==null?void 0:g.path,y==null?void 0:y.path]);const b=v.useRef(null);il(E,b,()=>o("view.update",{patch:{locationPicker:null}}));const S=(I=r.actionStatus)==null?void 0:I["locations.list"],w=((F=S==null?void 0:S.target)==null?void 0:F.controlId)===e?S:null,N=["working","queued"].includes(w==null?void 0:w.phase),x=Wc(e,y,N),A=q=>(f(q||""),m(""),o("view.update",{patch:{locationPicker:{controlId:e,path:q||""}}}),o("locations.list",{controlId:e,...q?{path:q}:{},directoriesOnly:l})),C=q=>{a(c?[t,q].filter(Boolean).join(` +`):q),o("view.update",{patch:{locationPicker:null}})},O=c?"textarea":"input";return n.createElement("div",{ref:b,className:`a-path-field ${u?"drag-over":""}`,onDragOver:q=>{q.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:q=>{q.preventDefault(),d(!1);const W=Px(q.dataTransfer);W?(m(""),a(c?[t,W].filter(Boolean).join(` +`):W)):m("Your browser hides the full path of dropped files. Use Browse, or drop a copied file or folder path.")}},n.createElement("div",{className:"a-inline-form"},n.createElement(O,{id:e,value:t,placeholder:i,"data-action":s,onChange:q=>a(q.target.value)}),n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.list",onClick:()=>A(!c&&(t!=null&&t.startsWith("/"))?t:void 0)},n.createElement(nr,null),"Browse")),p&&n.createElement(nt,{phase:"error",message:p})," ",E&&n.createElement(Xt,{busy:N,name:e+"-locations",className:"a-location-picker"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,l?"Choose a folder":"Choose a file or folder"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close location picker","data-action":"view.update",onClick:()=>o("view.update",{patch:{locationPicker:null}})},n.createElement(nn,null))),n.createElement("label",{htmlFor:e+"-browse-path"},"Folder path"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:e+"-browse-path",value:h,placeholder:"Type a path, e.g. ~/Projects","data-action":"view.update",onChange:q=>{f(q.target.value),o("view.update",{patch:{locationPicker:{...g,path:q.target.value}}})},onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),A(q.currentTarget.value))}}),n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.list",onClick:()=>A(h)},"Go")),(w==null?void 0:w.phase)==="error"&&n.createElement(nt,{phase:"error",message:w.error})," ",N&&!x&&n.createElement(nt,{phase:"working",message:"Loading locations…"}),x&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-settings-row"},n.createElement("button",{type:"button",className:"a-soft","data-action":"locations.list",disabled:x.parent===x.path,onClick:()=>A(x.parent)},n.createElement(Li,null),"Up"),n.createElement("code",{className:"a-wrap"},x.path)),n.createElement(Ox,{id:e,parent:x.path,act:o,status:(z=r.actionStatus)==null?void 0:z["locations.create"],listing:y,onCreated:q=>{f(q),o("view.update",{patch:{locationPicker:{controlId:e,path:q}}})}}),n.createElement("div",{className:"a-location-list"},x.entries.map(q=>n.createElement("button",{type:"button",className:"a-location-entry",key:q.path,"data-action":q.directory?"locations.list":s,onClick:()=>q.directory?A(q.path):C(q.path)},q.directory&&n.createElement(nr,null),q.name,q.directory&&n.createElement(en,null))),!x.entries.length&&n.createElement("p",null,"No ",l?"folders":"files"," here.")),x.truncated&&n.createElement("p",null,"Showing the first 300 items. Enter a more specific path above."),n.createElement("button",{type:"button",className:"a-primary","data-action":s,onClick:()=>C(x.path)},"Use this folder"))))}function Ng({id:e,value:t,onChange:a,state:r,act:o,action:i="view.update"}){var d,p,m,h;const s=((p=(d=r.view)==null?void 0:d.bundleSources)==null?void 0:p.includes(e))||!1,l=f=>{var g,E;return o("view.update",{patch:{bundleSources:f?[...new Set([...((g=r.view)==null?void 0:g.bundleSources)||[],e])]:(((E=r.view)==null?void 0:E.bundleSources)||[]).filter(y=>y!==e)}})};v.useEffect(()=>{o("bundles.list",{})},[]);const c=r.registeredBundles||[{name:"work",label:"Work",value:"work"}],u=c.find(f=>f.value===t);return n.createElement(Xt,{busy:["queued","working"].includes((h=(m=r.actionStatus)==null?void 0:m["bundles.list"])==null?void 0:h.phase),name:"bundles-"+e,className:"a-bundle-picker"},n.createElement("select",{id:e,"aria-label":"Registered root bundles",value:u?t:":custom:","data-action":i,onChange:f=>{f.target.value===":custom:"?l(!0):a(f.target.value)}},n.createElement("option",{value:":custom:"},t&&!u?t:"Choose a bundle"),c.map(f=>n.createElement("option",{value:f.value,key:f.value},f.label||f.name))),(u==null?void 0:u.description)&&n.createElement("p",{className:"a-caption"},u.description),n.createElement("button",{type:"button",className:"a-link","aria-expanded":s,"data-action":"view.update",onClick:()=>l(!s)},s?"Hide source":"Use a bundle source or file"),s&&n.createElement(Ma,{action:i,id:e+"-source",value:t,onChange:a,state:r,act:o,placeholder:"Bundle name, git URL or file path"}))}const Rg=e=>{var t;return((t=e==null?void 0:e.result)==null?void 0:t.accepted)!==void 0?e.result:e};function sl({state:e,act:t,mode:a="create",fromDraft:r=!1,onDone:o,onCancel:i}){var T,I;const[s,l]=v.useState(a),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(null),[E,y]=v.useState(!1),[b,S]=v.useState(""),w=v.useRef(!1),N=v.useRef(null),x=v.useId();v.useEffect(()=>{var F,z;(z=(F=N.current)==null?void 0:F.querySelector("input"))==null||z.focus()},[s]);const A=F=>z=>{F(z),g(null),S("")},C=async(F,z)=>{const q=Rg(await t(F,z));if(!q||q.accepted===!1)throw Error((q==null?void 0:q.error)||"Could not save. Your choices are kept.");return q.result},O=async F=>{if(F.preventDefault(),!w.current){w.current=!0,y(!0),S("");try{if(s==="attach"){const W=await C("workspace.add",{path:d,fromDraft:r});o==null||o(W);return}const z=f||await C("workspace.prepare",{name:c,...m.trim()?{root:m.trim()}:{}});if(g(z),z.disposition!=="create")return;const q=await C("workspace.create",{planId:z.planId,fromDraft:r});o==null||o(q)}catch(z){S(z.message)}finally{w.current=!1,y(!1)}}},k=async()=>{if(!w.current){w.current=!0,y(!0),S("");try{const F=await C("workspace.add",{path:f.path,fromDraft:r});o==null||o(F)}catch(F){S(F.message)}finally{w.current=!1,y(!1)}}};return n.createElement("form",{ref:N,className:"a-workspace-setup",onSubmit:O,"aria-label":s==="attach"?"Use existing folder":"Create workspace","aria-busy":E},n.createElement("div",{className:"a-workspace-setup-heading"},n.createElement("h3",null,s==="attach"?"Use an existing folder":"New workspace"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Cancel workspace setup",disabled:E,onClick:i},n.createElement(nn,null))),s==="create"?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:x+"-name"},"Workspace name"),n.createElement("input",{id:x+"-name",value:c,maxLength:200,required:!0,disabled:E,placeholder:"e.g. Launch plan",onChange:F=>A(u)(F.target.value)}),n.createElement("details",null,n.createElement("summary",null,"More options"),n.createElement("label",{htmlFor:x+"-root"},"Create in"),n.createElement(Ma,{id:x+"-root",value:m,placeholder:((T=e.workspaceDefaults)==null?void 0:T.root)||"Default workspace folder",directory:!0,state:e,act:t,onChange:A(h)}),n.createElement("p",{className:"a-caption"},"A new folder will be created here. Change the default in Settings → Workspaces."))):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:x+"-folder"},"Folder on ",((I=e.workspaceDefaults)==null?void 0:I.hostLabel)||"this host"),n.createElement(Ma,{id:x+"-folder",value:d,directory:!0,state:e,act:t,onChange:A(p),placeholder:"~/dev/my-project"}),n.createElement("p",{className:"a-caption"},"Work with files here. Existing Amplifier chats will appear automatically.")),f&&f.disposition!=="create"&&n.createElement("p",{role:"status"},f.disposition==="open"?"This folder already has a workspace.":f.disposition==="attach"?"This folder already exists. Use it as a workspace?":"A file already uses this name. Choose another name.",n.createElement("span",{className:"a-workspace-destination"},f.path)),b&&n.createElement("p",{role:"alert",className:"a-danger"},b),n.createElement("div",{className:"a-workspace-setup-actions"},n.createElement("button",{type:"button",className:"a-link",disabled:E,onClick:i},"Cancel"),f&&["open","attach"].includes(f.disposition)?n.createElement("button",{type:"button",className:"a-primary",disabled:E,onClick:k},f.disposition==="open"?"Open workspace":"Use folder"):n.createElement("button",{type:"submit",className:"a-primary",disabled:E||!(s==="create"?c.trim():d.trim())},E?"Saving…":s==="create"?"Create workspace":"Use folder")),n.createElement("button",{type:"button",className:"a-link",disabled:E,onClick:()=>{l(s==="create"?"attach":"create"),g(null),S("")}},s==="create"?"Use an existing folder":"Create a new workspace"))}function Mx({state:e,act:t,setup:a,onChange:r}){var W,X;const[o,i]=v.useState(null),[s,l]=v.useState([]),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(!1),[f,g]=v.useState(0),[E,y]=v.useState(!0),[b,S]=v.useState(0),[w,N]=v.useState(0),[x,A]=v.useState(!1),C=v.useRef(null),O=v.useRef(!1),k=v.useRef(null),T=v.useId(),I=40;v.useEffect(()=>{var U;o||(U=C.current)==null||U.focus()},[o]),v.useEffect(()=>{if(o)return;let U=!0;y(!0),p(""),l([]);const _=setTimeout(()=>{Promise.resolve(t("workspace.list",{query:c,offset:f*I,limit:I})).then(P=>{const G=Rg(P);if(!(G!=null&&G.accepted))throw Error((G==null?void 0:G.error)||"Could not load workspaces.");U&&(l(G.result.items),h(G.result.nextOffset!=null),S(G.result.total||0),k.current&&(k.current.scrollTop=0))}).catch(P=>{U&&p(P.message)}).finally(()=>{U&&y(!1)})},c?150:0);return()=>{U=!1,clearTimeout(_)}},[c,f,(W=e.workspaces)==null?void 0:W.length,o,w]);const F=async U=>{if(!O.current){O.current=!0,A(!0),p("");try{await r({workspace:U,location:{kind:U?"workspace":"managed"}})}catch(_){p(_.message)}finally{O.current=!1,A(!1)}}},z=((X=a.location)==null?void 0:X.kind)==="managed"?"":a.workspace||"",q=U=>{const _=U.split("/").filter(Boolean);return _.pop(),_.length>3?"…/"+_.slice(-3).join("/"):"/"+_.join("/")};return o?n.createElement("div",{className:"a-workspace-picker"},n.createElement("button",{type:"button",className:"a-link a-picker-back",onClick:()=>i(null)},n.createElement(Sa,null),"Back to workspaces"),n.createElement("h3",null,o==="create"?"New workspace":"Use an existing folder"),n.createElement(sl,{state:e,act:t,mode:o,fromDraft:!0,onCancel:()=>i(null),onDone:U=>F(U.path)}),d&&n.createElement("p",{role:"alert"},d)):n.createElement("div",{className:"a-workspace-picker","aria-busy":x},n.createElement("button",{type:"button",className:"a-picker-choice","aria-pressed":!z,disabled:x,onClick:()=>F("")},n.createElement(Fi,null),n.createElement("span",null,n.createElement("strong",null,"No workspace"),n.createElement("small",null,"Keep this conversation on its own.")),!z&&n.createElement(Pt,null)),n.createElement("label",{className:"a-picker-search",htmlFor:T+"-search"},n.createElement(To,null),n.createElement("input",{ref:C,id:T+"-search",type:"search",maxLength:500,"aria-label":"Find a workspace",placeholder:"Search workspaces by name or folder",value:c,onChange:U=>{g(0),u(U.target.value)}})),n.createElement("div",{ref:k,className:"a-picker-results","aria-label":"Workspaces","aria-busy":E},E?n.createElement("p",{role:"status"},"Finding workspaces…"):d?n.createElement("p",{role:"alert"},d," ",n.createElement("button",{type:"button",className:"a-link",onClick:()=>N(w+1)},"Try again")):s.length?n.createElement("ul",null,s.map(U=>n.createElement("li",{key:U.id},n.createElement("button",{type:"button",className:"a-picker-choice","aria-label":U.name+" · "+U.path,"aria-pressed":z===U.path,disabled:x,title:U.path,onClick:()=>F(U.path)},n.createElement(Fr,null),n.createElement("span",null,n.createElement("strong",null,U.name),n.createElement("small",null,q(U.path))),z===U.path&&n.createElement(Pt,null))))):n.createElement("p",{role:"status"},c?"No matching workspaces. Try a name or part of its folder path.":"No workspaces yet. Create one or use an existing folder below.")),!E&&!d&&(f>0||m)&&n.createElement("div",{className:"a-picker-pages"},n.createElement("span",null,f*I+1,"–",f*I+s.length," of ",b),n.createElement("button",{type:"button",className:"a-link",disabled:!f,onClick:()=>g(f-1)},"Previous"),n.createElement("button",{type:"button",className:"a-link",disabled:!m,onClick:()=>g(f+1)},"Next")),n.createElement("div",{className:"a-picker-actions"},n.createElement("button",{type:"button",disabled:x,onClick:()=>i("create")},n.createElement(Ln,null),"New workspace"),n.createElement("button",{type:"button",disabled:x,onClick:()=>i("attach")},n.createElement(nr,null),"Use existing folder")))}function zx({state:e,act:t}){var u,d,p,m,h,f;const[a,r]=v.useState(((d=(u=e.settings)==null?void 0:u.workspaces)==null?void 0:d.defaultRoot)||""),[o,i]=v.useState(""),[s,l]=v.useState(!1),c=async g=>{g.preventDefault(),l(!0);try{const E=await t("settings.update",{patch:{workspaces:{defaultRoot:a.trim()}}});if(!E||E.accepted===!1)throw Error((E==null?void 0:E.error)||"Could not save.");i("Saved. Existing workspaces stay where they are.")}catch(E){i(E.message)}finally{l(!1)}};return n.createElement("form",{className:"a-workspace-setup",onSubmit:c},n.createElement("h3",null,"Where new workspaces live"),n.createElement("p",null,"Name a workspace and Amplifier creates its folder here."),n.createElement("label",{htmlFor:"default-workspace-root"},"Default workspace folder on ",((p=e.workspaceDefaults)==null?void 0:p.hostLabel)||"this host"),n.createElement(Ma,{id:"default-workspace-root",value:a,directory:!0,state:e,act:t,onChange:r,placeholder:(m=e.workspaceDefaults)==null?void 0:m.root}),n.createElement("p",{className:"a-caption"},"Leave blank to use Amplifier’s workspace folder. This only affects new workspaces."),n.createElement("button",{className:"a-primary",disabled:s},"Save"),o&&n.createElement("p",{role:"status"},o),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:!!((f=(h=e.settings)==null?void 0:h.workspaces)!=null&&f.showPaths),onChange:g=>t("settings.update",{patch:{workspaces:{showPaths:g.target.checked}}})}),"Show folder paths in the sidebar"))}function ji({state:e,act:t,onOpen:a,onEdit:r,heading:o=!0,previewLimit:i=1/0,compact:s=!1,onSelect:l}){var q,W,X,U,_,P,G;const c=ol(),u=e.workspaceExplorer||{},d=s?e.workspaceShortcuts||[]:u.rows||[],p=u.breadcrumbs||[],[m,h]=v.useState(!1),g=!m&&!u.filter&&u.mode==="recent"&&(u.page||1)===1?d.slice(0,i):d,[E,y]=v.useState(u.filter||""),b=v.useRef(null);v.useEffect(()=>{b.current=null,y(u.filter||"")},[e.selectedWorkspaceId]),v.useEffect(()=>{(b.current===null||b.current===u.filter)&&(b.current=null,y(u.filter||""))},[u.filter]);const[S,w]=v.useState(0),N=v.useRef(null);Zu(N,S>0||!!((q=e.sharedHistory)!=null&&q.loading));const x=async Z=>{w(D=>D+1);try{return await t("view.update",{patch:Z})}finally{w(D=>D-1)}},A=Z=>(b.current=null,y(""),x({navWorkspacePath:Z,navWorkspaceFilter:"",navWorkspacePage:1,navWorkspaceAncestorsOpen:!1,navWorkspaceMode:"folders"})),C=Z=>{b.current=Z,y(Z),Promise.resolve(x({navWorkspaceFilter:Z,navWorkspacePage:1})).then(D=>{b.current===Z&&(!D||D.accepted===!1?(b.current=null,y(u.filter||"")):b.current=null)}).catch(()=>{b.current===Z&&(b.current=null,y(u.filter||""))})},O=async Z=>{if(l)return l(Z);const D=await t("workspace.select",{id:Z.workspaceId});D&&D.accepted!==!1&&await(a==null?void 0:a())},k=p.length>3?p.slice(0,-2):[],T=k.length?p.slice(-2):p,I=u.page||1,F=u.pages||1,z=Z=>Z.name===Z.path&&Z.path.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||Z.name;return n.createElement("section",{ref:N,"data-activity-region":"workspace-folders",className:"a-workspace-explorer","data-part":"workspace-explorer","data-compact":s,"data-show-paths":!!((X=(W=e.settings)==null?void 0:W.workspaces)!=null&&X.showPaths),"aria-label":"Workspace folders"},!s&&n.createElement("div",{className:"a-workspace-modes",role:"group","aria-label":"Workspace list"},n.createElement("button",{type:"button","aria-pressed":u.mode==="recent","data-action":"view.update",onClick:()=>x({navWorkspaceMode:"recent",navWorkspacePage:1})},"Recent"),n.createElement("button",{type:"button","aria-pressed":!s&&u.mode!=="recent","data-action":"view.update",onClick:()=>x({navWorkspaceMode:"folders",navWorkspacePage:1})},"Browse folders")),o&&!s&&n.createElement("div",{className:"a-workspace-explorer-heading"},n.createElement("strong",null,"Workspaces"),n.createElement("span",null,u.totalWorkspaces||0)),!s&&n.createElement("div",{className:"a-nav-search a-workspace-search"},n.createElement(To,null),n.createElement("input",{type:"search","aria-label":"Filter workspaces",placeholder:"Find workspace · * ? patterns",value:E,"data-action":"view.update",onChange:Z=>C(Z.target.value)})),!s&&u.mode!=="recent"&&!u.filter&&n.createElement("div",{className:"a-workspace-location"},n.createElement("button",{type:"button",className:"a-icon","aria-label":"Go to parent workspace folder",disabled:u.parentPath==null,"data-action":"view.update",onClick:()=>A(u.parentPath)},n.createElement(Sa,null)),n.createElement("nav",{className:"a-workspace-breadcrumbs","aria-label":"Workspace folder path"},k.length>0&&n.createElement("div",{className:"a-workspace-ancestors","data-open":!!((U=e.view)!=null&&U.navWorkspaceAncestorsOpen)},n.createElement("button",{type:"button",className:"a-workspace-ancestor-toggle","aria-label":"Show ancestor folders","aria-expanded":!!((_=e.view)!=null&&_.navWorkspaceAncestorsOpen),"data-action":"view.update",onClick:()=>{var Z;return x({navWorkspaceAncestorsOpen:!((Z=e.view)!=null&&Z.navWorkspaceAncestorsOpen)})}},n.createElement(Di,null)),((P=e.view)==null?void 0:P.navWorkspaceAncestorsOpen)&&n.createElement("div",null,k.map(Z=>n.createElement("button",{key:Z.path,type:"button","data-action":"view.update","aria-label":"Browse "+(Z.path||"all workspace folders"),onClick:()=>A(Z.path)},Z.path||"All workspace folders")))),T.map((Z,D)=>n.createElement(n.Fragment,{key:Z.path},(D>0||k.length>0)&&n.createElement(en,{"aria-hidden":"true"}),n.createElement("button",{type:"button","data-action":"view.update","aria-current":D===T.length-1?"location":void 0,title:Z.path||"All workspace folders","aria-label":"Browse "+(Z.path||"all workspace folders"),onClick:()=>A(Z.path)},z(Z)))))),n.createElement("div",{className:"a-workspace-folders"},g.map(Z=>{var me,_e,Je,De;const D=!!Z.workspaceId,ne=D&&Z.workspaceId===(((me=e.view)==null?void 0:me.workWorkspaceId)||e.selectedWorkspaceId),H="Browse "+Z.path,j=Z.activityCounts||{},ie=j.attention?{kind:"attention",label:`${j.attention} chats need attention`}:j.working?{kind:"working",label:`${j.working} chats working`}:Z.unread?{kind:"unread",label:`${Z.unread} chats with unread activity`}:null,Ee=n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-workspace-select","data-navigation-select":!0,"data-action":D?"workspace.select":"view.update","aria-label":D?"Open chats in "+Z.path:H,"aria-pressed":D?ne:void 0,onClick:()=>D?O(Z):A(Z.path)},ie?n.createElement(Hu,{activity:ie}):D?n.createElement(Bk,null):n.createElement(Fr,null),n.createElement("span",{className:"a-workspace-label"},n.createElement("span",null,Z.customName||Z.name),n.createElement("small",{className:"a-workspace-result-path",title:Z.path},(Je=(_e=e.settings)==null?void 0:_e.workspaces)!=null&&Je.showPaths?Z.path:Sx(Z))),n.createElement("span",{className:"a-workspace-count","aria-label":`${D?Z.chatCount:Z.descendantWorkspaceCount} ${D?"chats":"workspaces"}`},D?Z.chatCount:Z.descendantWorkspaceCount),!D&&Z.canBrowse&&n.createElement(en,{className:"a-workspace-arrow"})),!s&&D&&Z.canBrowse&&n.createElement("button",{type:"button",className:"a-workspace-drill","data-action":"view.update","aria-label":H,title:`${Z.descendantWorkspaceCount} nested workspaces`,onClick:()=>A(Z.path)},n.createElement(en,null)));return D?n.createElement(Vu,{className:`a-workspace-row is-workspace ${ne?"is-selected":""}`,key:Z.path,"data-workspace-path":Z.path,"data-qualified":!Z.customName&&((De=Z.pathLabel)==null?void 0:De.includes("/")),label:Z.customName||Z.name,details:({close:ue})=>{var ye;return n.createElement(wg,{row:Z,now:c,actions:n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-link","data-action":"workspace.select",onClick:()=>{ue(),O(Z)}},n.createElement(Fi,null),"Open chats"),n.createElement("button",{type:"button","data-action":"view.update",onClick:()=>{ue(),A(Z.parentPath??hg(Z.path))}},n.createElement(Fr,null),"Browse parent"),r&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button","data-action":"view.update",onClick:()=>{ue(),r({mode:"rename",id:Z.workspaceId,name:Z.customName||Z.name})}},n.createElement(qi,null),"Rename"),n.createElement("button",{type:"button",className:"a-danger",disabled:((ye=e.library)==null?void 0:ye.workspaceCount)<2,"data-action":"view.update",onClick:()=>{ue(),r({mode:"remove",id:Z.workspaceId,name:Z.customName||Z.name})}},n.createElement(ea,null),"Remove")))})}},Ee):n.createElement("div",{className:"a-workspace-row",key:Z.path,"data-workspace-path":Z.path},Ee)})),g.lengthh(!0)},"More workspaces",n.createElement(en,null)),!d.length&&!((G=e.sharedHistory)!=null&&G.loading)&&n.createElement("p",{className:"a-nav-empty"},u.filter?"No matching workspaces.":"Create a workspace to start a chat."),!s&&F>1&&g.length===d.length&&n.createElement("div",{className:"a-nav-pagination a-workspace-pagination"},n.createElement("span",null,"Page ",I," of ",F),n.createElement("div",null,n.createElement("button",{type:"button",className:"a-link","aria-label":"Show previous workspace folders","data-action":"view.update",disabled:I<=1,onClick:()=>x({navWorkspacePage:I-1})},"Previous"),n.createElement("button",{type:"button",className:"a-link","aria-label":"Show more workspace folders","data-action":"view.update",disabled:I>=F,onClick:()=>x({navWorkspacePage:I+1})},"More",n.createElement(en,null)))))}function Lx({state:e,act:t}){const a=e.view||{},r=e.conversationOrganization||{};return n.createElement("div",{"aria-label":"Conversation library filters"},n.createElement("label",null,"Conversations",n.createElement("select",{"aria-label":"Active or archived conversations",value:a.navArchive||"active","data-action":"view.update",onChange:o=>t("view.update",{patch:{navArchive:o.target.value}})},n.createElement("option",{value:"active"},"Active"),n.createElement("option",{value:"archived"},"Archived (",r.archivedCount||0,")"),n.createElement("option",{value:"all"},"Active and archived"))))}function Dx({state:e,session:t,act:a}){var u;const r=Object.hasOwn(((u=e.conversationOrganization)==null?void 0:u.archived)||{},t.id),[o,i]=v.useState(!1),[s,l]=v.useState("");async function c(){i(!0),l("");try{const d=await a(r?"session.restore":"session.archive",{id:t.id});if(!(d!=null&&d.accepted))throw Error("The change was not saved.")}catch(d){l(d.message)}finally{i(!1)}}return n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Conversation library"),n.createElement("p",null,"Archive keeps this conversation and its files. Work already running continues."),n.createElement("button",{type:"button",className:"a-soft",disabled:o,"data-action":r?"session.restore":"session.archive",onClick:c},r?n.createElement(Pk,null):n.createElement(wi,null),r?"Restore conversation":"Archive conversation"),s&&n.createElement("p",{role:"alert",className:"a-danger"},s))}function Fx({session:e,act:t}){const[a,r]=v.useState(null),[o,i]=v.useState([]),[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(604800),m=v.useRef(0),[h,f]=v.useState(null);v.useEffect(()=>(m.current++,r(null),i([]),f(null),u(""),l(!1),()=>{m.current++}),[e.id]);async function g(b,S,w){const N=m.current;l(!0),u("");try{const x=await t(b,S);if(!(x!=null&&x.result))throw Error("The snapshot action did not return a result.");N===m.current&&w(x.result)}catch(x){N===m.current&&u(x.message)}finally{N===m.current&&l(!1)}}const E=b=>i(S=>[b,...S.filter(w=>w.id!==b.id)]),y=(b=0)=>g("session.shareList",{sessionId:e.id,offset:b},S=>{i(w=>b?[...w,...S.items.filter(N=>!w.some(x=>x.id===N.id))]:S.items),f(S.nextOffset)});return n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Share a snapshot"),n.createElement("p",null,"A snapshot includes visible conversation text and voice exchanges. File contents and interactive artifacts are not embedded."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.sharePreview",onClick:()=>g("session.sharePreview",{sessionId:e.id},r)},n.createElement(dx,null),"Preview snapshot"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.shareList",onClick:()=>y()},"Show shared snapshots")),a&&n.createElement(n.Fragment,null,n.createElement("pre",{className:"a-state-view","aria-label":"Snapshot preview",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",maxHeight:320}},a.text),a.nextOffset!==null&&n.createElement("button",{type:"button",className:"a-link",disabled:s,"data-action":"session.shareRead",onClick:()=>g("session.shareRead",{id:a.id,offset:a.nextOffset},b=>r(S=>({...S,text:S.text+b.text,nextOffset:b.nextOffset})))},"Read more of this snapshot"),n.createElement("p",null,"Anyone with the link can read this snapshot while this host is reachable. Later edits stay private to the original chat. You can revoke the link."),n.createElement("label",{htmlFor:"share-expiry"},"Link expires after"),n.createElement("select",{id:"share-expiry",value:d,onChange:b=>p(Number(b.target.value))},n.createElement("option",{value:86400},"One day"),n.createElement("option",{value:604800},"One week"),n.createElement("option",{value:2592e3},"Thirty days")),n.createElement("button",{type:"button",className:"a-primary",disabled:s,"data-action":"session.shareCreate",onClick:()=>g("session.shareCreate",{id:a.id,contentHash:a.contentHash,visibility:"anyone_with_link",expiresInSeconds:d},b=>{E(b),r(null)})},"Create share link")),o.map(b=>n.createElement("div",{className:"a-selection-card",key:b.id},n.createElement("strong",null,b.title),n.createElement("p",null,b.status,b.expiresAt?" · expires "+new Date(b.expiresAt*1e3).toLocaleString():""),b.path&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"share-"+b.id},"Snapshot link"),n.createElement("input",{id:"share-"+b.id,readOnly:!0,value:new URL(b.path,window.location.origin).href}),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>navigator.clipboard.writeText(new URL(b.path,window.location.origin).href).catch(()=>u("Copy was unavailable. Select the link and copy it."))},n.createElement(rr,null),"Copy link"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.shareRevoke",onClick:()=>g("session.shareRevoke",{id:b.id},E)},"Revoke link")))),h!==null&&n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"session.shareList",onClick:()=>y(h)},"Load older snapshots"),c&&n.createElement("p",{role:"alert",className:"a-danger"},c))}function Tg({id:e,act:t,cancel:a}){var E;const[r,o]=v.useState(null),[i,s]=v.useState(!1),[l,c]=v.useState(""),[u,d]=v.useState(!1),p=v.useRef(0),m=v.useRef(!1);async function h(){var b;const y=++p.current;o(null),c(""),s(!0);try{const S=await t("session.deletePreview",{id:e});if(!(S!=null&&S.accepted)||!((b=S.result)!=null&&b.confirmationToken))throw Error((S==null?void 0:S.error)||"Could not review this chat for deletion.");y===p.current&&o(S.result)}catch(S){y===p.current&&c(S.message)}finally{y===p.current&&s(!1)}}v.useEffect(()=>(h(),()=>{p.current++}),[e]);async function f(){var b;if(!r||m.current)return;const y=p.current;m.current=!0,s(!0),c("");try{const S=await t("session.delete",{id:e,confirmationToken:r.confirmationToken});if(!(S!=null&&S.accepted))throw Error((S==null?void 0:S.error)||"Deletion was not confirmed. Review the chat again before retrying.");y===p.current&&((b=S.result)!=null&&b.cleanupPending?(d(!0),o(null)):a())}catch(S){y===p.current&&(c(S.message),o(null))}finally{m.current=!1,y===p.current&&s(!1)}}const g=r==null?void 0:r.summary;return n.createElement("div",{className:"a-chat-delete","aria-busy":i},r?n.createElement(n.Fragment,null,n.createElement("p",null,"Permanently delete ",n.createElement("strong",null,r.title||"this chat"),"?"),n.createElement("p",null,r.description),g&&n.createElement("p",{className:"a-caption"},g.conversationCount," saved conversation",g.conversationCount===1?"":"s"," · ",g.fileCount," file",g.fileCount===1?"":"s"," · ",g.attachmentCount," attachment",g.attachmentCount===1?"":"s"," · ",g.artifactCount," artifact",g.artifactCount===1?"":"s"," · ",g.shareCount," published link",g.shareCount===1?"":"s"),n.createElement("p",null,n.createElement("strong",null,"This cannot be undone.")),!!((E=r.preserved)!=null&&E.length)&&n.createElement("p",{className:"a-caption"},"Kept: ",r.preserved.join("; "),".")):i?n.createElement("p",{role:"status"},"Checking what will be deleted…"):null,u&&n.createElement("p",{role:"status"},"The chat has been removed. File cleanup is pending and will be retried automatically."),l&&n.createElement("p",{role:"alert",className:"a-danger"},l),n.createElement("div",{className:"a-dialog-actions"},r?n.createElement("button",{type:"button",className:"a-soft a-danger","data-action":"session.delete",disabled:i,onClick:f},i?"Deleting…":"Delete permanently"):!i&&!u&&n.createElement("button",{type:"button",className:"a-soft","data-action":"session.deletePreview",onClick:h},"Review again"),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:m.current,onClick:a},u?"Close":"Keep chat")))}function Ku(e,t){return e.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}const ia=(e,t)=>e("view.update",{patch:t});function qx({chat:e,act:t,cancel:a,inputId:r="nav-workspace-name"}){var y,b;const[o,i]=v.useState(e.title||""),[s,l]=v.useState(!1),[c,u]=v.useState(""),d=v.useRef(!1),p=v.useRef(!1),m=((y=e.naming)==null?void 0:y.status)==="working",h=e.configurationBusy,f=e.autoName??(e.titleSource!=="manual"&&e.nativeNameSource!=="manual");v.useEffect(()=>{p.current||i(e.title||"")},[e.title]);const g=async S=>{S.preventDefault();const w=o.trim();if(!(!w||d.current)){d.current=!0,l(!0),u("");try{const N=await t("session.rename",{id:e.id,title:w});N&&N.accepted!==!1?a():u((N==null?void 0:N.error)||"Could not rename. Your text is kept; try again.")}catch(N){u(N.message||"Could not rename. Please try again.")}finally{d.current=!1,l(!1)}}};async function E(){if(!(d.current||m||h||o!==(e.title||""))){d.current=!0,l(!0),u("");try{const S=await t("session.naming",{id:e.id,regenerate:!0});if(!S||S.accepted===!1)throw Error((S==null?void 0:S.error)||"Could not generate a name. Your current name is kept.")}catch(S){u(S.message)}finally{d.current=!1,l(!1)}}}return n.createElement("form",{"aria-busy":s||m,className:"a-nav-chat a-nav-chat-rename","data-session-id":e.id,onSubmit:g},n.createElement("input",{id:r,maxLength:200,"aria-label":`New name for ${e.title||"conversation"}`,value:o,disabled:s,required:!0,autoFocus:!0,onChange:S=>{p.current=S.target.value!==(e.title||""),i(S.target.value),u("")}}),n.createElement("button",{type:"submit",className:"a-icon a-nav-chat-edit","aria-label":"Save conversation name",disabled:s||!o.trim(),"data-action":"session.rename"},n.createElement(Pt,null)),n.createElement("button",{type:"button",className:"a-icon a-nav-chat-edit","aria-label":"Cancel conversation rename",disabled:s,"data-action":"view.update",onClick:a},n.createElement(nn,null)),n.createElement("button",{type:"button",className:"a-link","data-action":"session.naming",disabled:s||m||h||o!==(e.title||""),onClick:E},n.createElement(Mt,null),m?"Naming…":"Auto name now"),n.createElement("small",{className:"a-nav-name-help"},"Generate one name. Future automatic naming stays ",f?"on":"off",".",h?" Finish changing the conversation configuration first.":o!==(e.title||"")?" Save or cancel your edit first.":""),m&&n.createElement("small",{role:"status"},"Generating chat name…"),(c||((b=e.naming)==null?void 0:b.error))&&n.createElement("small",{role:"alert",className:"a-danger"},c||e.naming.error))}function fo(e,t){var k,T,I;const a=Ku(n,e),r=e.dispatch,o=e.instanceId==="workspaces"?"nav-workspace":"nav-"+e.instanceId,i=a.view||{},s=i.workspaceDraft||{},l=(t==="chats"?(k=s.mode)!=null&&k.startsWith("chat-"):!((T=s.mode)!=null&&T.startsWith("chat-")))?s:{},c=v.useRef(null),u=v.useRef(l),d=v.useRef(0),p=v.useRef(!1),[m,h]=v.useState(!1),[f,g]=v.useState("");v.useEffect(()=>{u.current=l},[l]);const E=a.sharedHistory||{},y=!!(E.loading||E.refreshing),b=al(a),S=b.find(F=>F.id===a.selectedWorkspaceId),w=(I=a.library)!=null&&I.bounded?a.library.workspaceCount:b.length,N=i.navChatScope==="all",x=F=>{d.current++,u.current=F,g(""),ia(r,{workspaceDraft:F})},A=F=>x({...l,...F}),C=F=>r("session.select",{id:F}),O=async F=>{var q;if(F.preventDefault(),p.current)return;const z=d.current;p.current=!0,h(!0),g("");try{let W;l.mode==="add"?W=await r("workspace.create",{path:l.path||"",...(q=l.name)!=null&&q.trim()?{name:l.name.trim()}:{}}):l.mode==="rename"?W=await r("workspace.rename",{id:l.id,name:l.name||""}):l.mode==="chat-rename"?W=await r("session.rename",{id:l.id,title:l.name||""}):l.mode==="remove"&&(W=await r("workspace.remove",{id:l.id})),W&&W.accepted!==!1?d.current===z&&x({}):g((W==null?void 0:W.error)||"Could not save. Check the folder or name and try again.")}catch(W){g(W.message||"Could not save. Please try again.")}finally{p.current=!1,h(!1)}};return v.useEffect(()=>{var F,z,q,W,X;l.mode&&((z=(F=c.current)==null?void 0:F.scrollIntoView)==null||z.call(F,{block:"nearest"}),(X=(W=(q=c.current)==null?void 0:q.querySelector)==null?void 0:W.call(q,"input"))==null||X.focus())},[l.mode,l.id]),{state:a,act:r,prefix:o,view:i,draft:l,form:c,saving:m,formError:f,history:E,refreshing:y,workspace:S,workspaceCount:w,allChats:N,setDraft:x,updateDraft:A,choose:C,submit:O}}function go({model:e}){var p;const{state:t,act:a,prefix:r,draft:o,form:i,saving:s,formError:l,setDraft:c,updateDraft:u,submit:d}=e;return o.mode==="add"?n.createElement(sl,{state:t,act:a,onDone:()=>c({}),onCancel:()=>c({})}):n.createElement(n.Fragment,null,o.mode==="chat-delete"&&n.createElement("div",{className:"a-nav-form"},n.createElement("strong",null,"Delete chat?"),n.createElement(Tg,{key:o.id,id:o.id,act:a,cancel:()=>c({})}))," ",o.mode&&o.mode!=="chat-rename"&&o.mode!=="chat-delete"&&n.createElement("form",{ref:i,className:"a-nav-form","aria-busy":s,onSubmit:d},n.createElement("div",{className:"a-nav-form-title"},n.createElement("strong",null,o.mode==="add"?"New workspace":o.mode==="rename"?"Rename workspace":o.mode==="chat-rename"?"Rename chat":"Remove workspace?"),n.createElement("button",{className:"a-icon",type:"button","aria-label":"Cancel navigation edit","data-action":"view.update",onClick:()=>c({})},n.createElement(nn,null))),o.mode==="add"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Choose an existing folder, or enter a path to create one. Your first chat opens here."),n.createElement("label",{htmlFor:r+"-path"},"Folder"),n.createElement(Ma,{id:r+"-path",value:o.path||"",onChange:m=>u({path:m}),directory:!0,state:t,act:a,placeholder:"~/Projects/my-project"})),["add","rename","chat-rename"].includes(o.mode)?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:r+"-name"},o.mode==="add"?"Name (optional)":"Name"),n.createElement("input",{id:r+"-name",maxLength:200,value:o.name||"",required:o.mode!=="add","data-action":"view.update",onChange:m=>u({name:m.target.value})})):n.createElement("p",null,"Remove ",o.name," from this list? Its files and chats will stay on disk."),n.createElement("button",{type:"submit",disabled:s||o.mode==="add"&&!((p=o.path)!=null&&p.trim()),className:o.mode==="remove"?"a-soft a-danger":"a-primary","data-action":o.mode==="add"?"workspace.create":o.mode==="rename"?"workspace.rename":o.mode==="remove"?"workspace.remove":"session.rename"},s?"Saving…":o.mode==="add"?"Create workspace":o.mode==="remove"?"Remove registration":"Save name"),l&&n.createElement("p",{role:"alert",className:"a-danger"},l)))}function Ux({host:e,paired:t=!1}){const a=fo(e,"workspaces"),{state:r,act:o,allChats:i,workspace:s,workspaceCount:l,setDraft:c}=a;return t?n.createElement(go,{model:a}):n.createElement(n.Fragment,null,n.createElement(go,{model:a})," ",!i&&n.createElement(ji,{state:r,act:o}),!i&&s&&n.createElement("div",{className:"a-nav-workspace-path"},n.createElement("span",{className:"a-workspace-full-path",title:s.path||"Project folder unavailable"},s.path||"Project folder unavailable"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Rename workspace","data-action":"view.update",onClick:()=>c({mode:"rename",id:s.id,name:s.name})},n.createElement(qi,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Remove workspace registration",disabled:l<2,"data-action":"view.update",onClick:()=>c({mode:"remove",id:s.id,name:s.name})},n.createElement(ea,null))))}function jx({host:e,onOpen:t}){const a=fo(e,"workspaces");return n.createElement(ji,{state:a.state,act:a.act,onOpen:t,onEdit:a.setDraft,heading:!1,previewLimit:8})}function $x({chat:e,model:t,now:a,close:r}){var C,O,k,T;const{state:o,act:i,draft:s,setDraft:l,choose:c,prefix:u}=t,d=ju(e,o),p=e.title||"Untitled conversation",m=((C=e.location)==null?void 0:C.kind)==="managed",h=o.pinnedSessionIds||[],f=h.indexOf(e.id),[g,E]=v.useState(""),[y,b]=v.useState(""),[S,w]=v.useState(!1),N=(k=(O=o.attention)==null?void 0:O.items)==null?void 0:k.find(I=>I.id==="session:"+e.id&&I.sessionId===e.id&&!I.read),x=async()=>{if(!(S||!N)){w(!0),b("");try{await br(i,[N])}catch(I){b(I.message||"Could not mark this error reviewed.")}finally{w(!1)}}},A=async I=>{try{E(""),await i("session.pinOrder",{ids:yg(h,e.id,h[f+I])})}catch(F){E(F.message)}};return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-navigation-detail-heading"},n.createElement(Fi,null),"Chat details"),n.createElement("h3",null,p),n.createElement("div",{className:"a-navigation-detail-status"},n.createElement(Hu,{activity:d}),n.createElement("strong",null,d.label)),n.createElement("dl",null,n.createElement("dt",null,"Last activity"),n.createElement("dd",null,$u(e.recentActivityAt,a).long),n.createElement("dt",null,"Workspace"),n.createElement("dd",null,m?"No workspace":e.workspaceName||((T=e.workspace)==null?void 0:T.split(/[\\/]/).filter(Boolean).at(-1)))),n.createElement(Ms,{label:m?"Chat files":"Full workspace path",value:e.workspace||"Unavailable"}),n.createElement(Ms,{label:"Session ID",value:Uu(e)}),n.createElement("p",{className:"a-caption"},m?"Files stored in this chat’s managed folder.":"Saved in this folder’s native Amplifier history."),s.mode==="chat-rename"&&s.id===e.id?n.createElement(qx,{inputId:u+"-name",chat:e,act:i,cancel:()=>l({})}):n.createElement("div",{className:"a-navigation-actions"},n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",onClick:()=>{r(),c(e.id)}},n.createElement(Ok,null),"Open chat"),N&&n.createElement("button",{type:"button",className:"a-link","data-action":"attention.read",disabled:S,onClick:x},S?"Marking reviewed…":"Mark error reviewed"),y&&n.createElement("span",{role:"alert"},y),n.createElement("button",{type:"button","aria-label":`${e.pinned?"Unpin":"Pin"} ${p}`,"aria-pressed":!!e.pinned,"data-action":"session.pin",onClick:()=>i("session.pin",{id:e.id,pinned:!e.pinned})},n.createElement(qu,null),e.pinned?"Unpin":"Pin"),e.pinned&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button","aria-label":"Move "+p+" up","data-action":"session.pinOrder",disabled:f<1,onClick:()=>A(-1)},n.createElement(Li,null),"Move up"),n.createElement("button",{type:"button","aria-label":"Move "+p+" down","data-action":"session.pinOrder",disabled:f<0||f===h.length-1,onClick:()=>A(1)},n.createElement(sg,null),"Move down"),g&&n.createElement("span",{role:"alert"},g)),n.createElement("button",{type:"button","aria-label":"Rename "+p,"data-action":"view.update",onClick:()=>l({mode:"chat-rename",id:e.id,name:p})},n.createElement(qi,null),"Rename"),n.createElement("button",{type:"button","aria-label":(e.archived?"Restore ":"Archive ")+p,"data-action":e.archived?"session.restore":"session.archive",onClick:()=>i(e.archived?"session.restore":"session.archive",{id:e.id})},e.archived?"Restore":"Archive"),m&&!e.parentId&&n.createElement("button",{type:"button",className:"a-danger","aria-label":"Delete "+p,"data-action":"view.update",onClick:()=>{r(),l({mode:"chat-delete",id:e.id,name:p})}},n.createElement(ea,null),"Delete")))}function ro({id:e,title:t,count:a,model:r,actions:o,children:i}){const s=n.useId(),l=r.view.navSectionsCollapsed||[],c=l.includes(e);return n.createElement("section",{className:"a-sidebar-section","aria-label":t==="Pinned"?"Pinned chats":t==="Recent"?"Recent chats":t,"data-sidebar-section":e},n.createElement("div",{className:"a-sidebar-section-heading"},n.createElement("button",{type:"button","aria-expanded":!c,"aria-controls":s,"data-action":"view.update",onClick:()=>ia(r.act,{navSectionsCollapsed:c?l.filter(u=>u!==e):[...l,e]})},n.createElement("span",null,t),n.createElement(en,{className:c?"":"is-open"}),a!=null&&n.createElement("small",null,a)),o),n.createElement("div",{id:s,hidden:c},i))}function Yu({chat:e,model:t,now:a,showLocation:r=!0,handle:o,floating:i=!1}){const{state:s,choose:l}=t,c=e.title||"Untitled conversation",u=ju(e,s),d=n.createElement(n.Fragment,null,o,n.createElement("button",{className:"a-nav-chat-select",type:"button","data-navigation-select":!0,"data-action":"session.select","aria-current":e.id===s.selectedSessionId?"page":void 0,"aria-label":c,onClick:()=>l(e.id)},n.createElement(Hu,{activity:u}),n.createElement("span",{className:"a-nav-chat-label"},n.createElement("span",null,c),n.createElement("small",{className:"a-nav-chat-workspace",title:r?e.workspace:void 0},r?e.workspaceLabel||e.workspace:u.label)),n.createElement(Tx,{at:e.recentActivityAt,now:a}))),p="a-nav-chat "+(e.id===s.selectedSessionId?"is-selected":"");return i?n.createElement("div",{className:p},d,n.createElement(Di,{className:"a-navigation-more"})):n.createElement(Vu,{className:p,"data-session-id":e.id,label:c,details:({close:m})=>n.createElement($x,{chat:e,model:t,now:a,close:m})},d)}function Ig({page:e,onChange:t,label:a="conversations"}){return e.pages<2?null:n.createElement("div",{className:"a-nav-pagination"},n.createElement("span",null,e.start+1,"–",e.end," of ",e.total),n.createElement("div",null,n.createElement("button",{type:"button",className:"a-link","data-action":"view.update","aria-label":"Show previous "+a,disabled:e.index===0,onClick:()=>t(e.index-1)},"Previous"),n.createElement("button",{type:"button",className:"a-link","data-action":"view.update","aria-label":"Show more "+a,disabled:e.index===e.pages-1,onClick:()=>t(e.index+1)},"More",n.createElement(en,null))))}function Gu({page:e,model:t,now:a}){const[r,o]=v.useState(""),i=e.items.map(c=>({...c,label:c.title||"Untitled conversation"})),s=i.map(c=>c.id),l=async(c,{id:u,to:d})=>{var p;o("");try{const m=await t.act("session.pinOrder",{ids:yg(t.state.pinnedSessionIds||[],u,s[d])}),h=((p=m==null?void 0:m.result)==null?void 0:p.accepted)!==void 0?m.result:m;if((h==null?void 0:h.accepted)===!1)throw Error(h.error||"Could not reorder pins.")}catch(m){throw o(m.message||"Could not reorder pins. Please try again."),m}};return n.createElement(n.Fragment,null,n.createElement(kg,{items:i,ids:s,onChange:l,className:"a-pinned-chats",floatingClassName:"a-pinned-drag",action:"session.pinOrder",renderItem:(c,{handle:u,floating:d})=>n.createElement(Yu,{chat:c,model:t,now:a,handle:u,floating:d})}),r&&n.createElement("p",{role:"alert",className:"a-danger"},r),!e.total&&n.createElement("p",{className:"a-nav-empty"},"Pin a chat from its actions menu to keep it here."),n.createElement(Ig,{page:e,label:"pinned chats",onChange:c=>ia(t.act,{navPinnedPage:c})}))}function Zc({page:e,model:t,view:a,viewAct:r,now:o,showLocation:i}){const s=e.activityCounts||{};return n.createElement(n.Fragment,null,n.createElement("div",{className:"a-nav-search"},n.createElement(To,null),n.createElement("input",{"aria-label":"Filter conversations",maxLength:500,type:"search",value:a.navFilter||"",placeholder:i?"Find chats or paths · * ?":"Find chats · * ? patterns","data-action":"view.update",onChange:l=>ia(r,{navFilter:l.target.value})})),n.createElement("details",{className:"a-sidebar-filters"},n.createElement("summary",null,"Filters",a.navFilter||a.navArchive&&a.navArchive!=="active"||a.navStatusFilter&&a.navStatusFilter!=="all"||a.navLocationFilter==="managed"?" · active":""),n.createElement(Lx,{state:{...t.state,view:a},act:r}),n.createElement("label",{className:"a-managed-chat-filter"},"Sort",n.createElement("select",{"aria-label":"Sort conversations",value:a.navSort||"activity","data-action":"view.update",onChange:l=>ia(r,{navSort:l.target.value})},n.createElement("option",{value:"activity"},"Recent activity"),n.createElement("option",{value:"created"},"Newest created"),n.createElement("option",{value:"name"},"Name"))),i&&n.createElement("label",{className:"a-managed-chat-filter"},"Location",n.createElement("select",{"aria-label":"Filter chats by location",value:a.navLocationFilter||"all","data-action":"view.update",onChange:l=>ia(r,{navLocationFilter:l.target.value})},n.createElement("option",{value:"all"},"All locations"),n.createElement("option",{value:"managed"},"No workspace"))),n.createElement("div",{className:"a-navigation-filters",role:"group","aria-label":"Conversation activity filters"},n.createElement("button",{type:"button","aria-pressed":a.navStatusFilter==="attention","data-action":"view.update",onClick:()=>ia(r,{navStatusFilter:a.navStatusFilter==="attention"?"all":"attention"})},n.createElement(zn,null),s.attention??0," need attention"),n.createElement("button",{type:"button","aria-pressed":a.navStatusFilter==="working","data-action":"view.update",onClick:()=>ia(r,{navStatusFilter:a.navStatusFilter==="working"?"all":"working"})},n.createElement(Ro,null),s.working??0," working"),a.navStatusFilter&&a.navStatusFilter!=="all"&&n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>ia(r,{navStatusFilter:"all"})},"Clear"))),e.pending&&n.createElement("p",{role:"status"},"Loading conversations…"),n.createElement("div",{className:"a-nav-chats"},e.items.map(l=>n.createElement(Yu,{key:l.id,chat:l,model:t,now:o,showLocation:i}))),!e.total&&!e.pending&&n.createElement("p",{className:"a-nav-empty"},a.navFilter||a.navStatusFilter&&a.navStatusFilter!=="all"?"No matching chats.":"Your conversations will appear here."),n.createElement(Ig,{page:e,onChange:l=>ia(r,{navChatPage:{...e.scope,index:l}})}))}const fm={navArchive:"active",navCollection:null,navFilter:"",navStatusFilter:"all",navLocationFilter:"all",navSort:"activity"};function Bx({host:e,workspaceHost:t}){var T,I,F;const a=fo(e,"chats"),{state:r,act:o,view:i,workspace:s,history:l,refreshing:c}=a,u=Ku(n,t||e),d=ol(),p=(t==null?void 0:t.dispatch)||o,[m,h]=v.useState(!1),f=v.useRef(null),g=()=>{h(!1),requestAnimationFrame(()=>{var z;return(z=f.current)==null?void 0:z.focus()})},E=r.sidebarNavigation,y={...fm,navChatScope:((T=E==null?void 0:E.pinned)==null?void 0:T.scope.mode)||"all",navPinnedPage:i.navPinnedPage},b={...fm,...E==null?void 0:E.recentView,...i.navRecentView},S=Es({...r,view:y},s,{section:"pinned"}),w=Es({...r,view:{...b,navChatScope:y.navChatScope}},s,{section:"recent"}),N=Es({...r,view:{...i,navChatScope:"workspace"}},s,{section:"workspace"}),x=(z,q)=>{if(z!=="view.update")return o(z,q);const W={...b,...q.patch};return Object.hasOwn(q.patch,"navChatPage")||delete W.navChatPage,ia(o,{navRecentView:W})},A=i.navWorkspaceList!==!1||!s,C=()=>ia(o,{navWorkspaceList:!0}),O=()=>ia(o,{navWorkspaceList:!1,navChatScope:"workspace",navFilter:"",navStatusFilter:"all",navArchive:"active",navLocationFilter:"all"}),k=(I=u.workspaceExplorer)==null?void 0:I.selected;return n.createElement("div",{className:"a-sidebar-navigation"},n.createElement(go,{model:a}),n.createElement(ro,{id:"pinned",title:"Pinned",count:S.total,model:a},n.createElement(Gu,{page:S,model:a,now:d})),n.createElement(ro,{id:"workspaces",title:"Workspaces",count:(F=u.workspaceExplorer)==null?void 0:F.totalWorkspaces,model:a,actions:n.createElement("button",{ref:f,type:"button",className:"a-icon","aria-label":"New workspace","data-action":"view.update",onClick:()=>{h(!0),ia(o,{navSectionsCollapsed:(i.navSectionsCollapsed||[]).filter(z=>z!=="workspaces")})}},n.createElement(Ln,null))},m&&n.createElement(sl,{state:u,act:p,onDone:g,onCancel:g}),A?t?n.createElement(jx,{host:t,onOpen:O}):n.createElement(ji,{state:r,act:o,onOpen:O,onEdit:a.setDraft,heading:!1,previewLimit:8}):n.createElement("div",{className:"a-workspace-chat-view","aria-label":"Chats in "+s.name},n.createElement("button",{type:"button",className:"a-navigation-back","data-action":"view.update",onClick:C},n.createElement(Sa,null),"All workspaces"),n.createElement(Vu,{className:"a-navigation-workspace",label:s.name,details:({close:z})=>{var q;return n.createElement(wg,{row:k||{...s,chatCount:N.total},now:d,actions:n.createElement(n.Fragment,null,n.createElement("button",{type:"button","data-action":"view.update",onClick:()=>{z(),p("view.update",{patch:{workspaceDraft:{mode:"rename",id:s.id,name:s.name}}})}},n.createElement(qi,null),"Rename"),n.createElement("button",{type:"button",className:"a-danger",disabled:((q=u.library)==null?void 0:q.workspaceCount)<2,"data-action":"view.update",onClick:()=>{z(),p("view.update",{patch:{workspaceDraft:{mode:"remove",id:s.id,name:s.name}}})}},n.createElement(ea,null),"Remove registration"))})}},n.createElement(Fr,null),n.createElement("div",null,n.createElement("strong",null,s.name),n.createElement("small",{title:s.path},fg(s.path)))),n.createElement("div",{className:"a-sidebar-workspace-actions"},n.createElement("span",null,N.total," chats"),n.createElement("button",{type:"button",className:"a-link","aria-label":"New chat in "+s.name,"data-action":"session.draft",onClick:()=>o("session.draft",{workspace:s.path})},n.createElement(Ln,null),"New chat")),n.createElement(Zc,{page:N,model:a,view:i,viewAct:o,now:d,showLocation:!1}))),n.createElement(ro,{id:"recent",title:"Recent",count:w.total,model:a,actions:n.createElement("button",{type:"button",className:"a-icon","aria-label":"Refresh workspaces and chats","data-action":"history.refresh",disabled:c,onClick:()=>o("history.refresh",{})},n.createElement(Mt,{className:c?"a-progress-spinner":void 0}))},n.createElement(Zc,{page:w,model:a,view:b,viewAct:x,now:d,showLocation:!0})),l.loading&&n.createElement("p",{role:"status"},"Finding existing chats…"),l.error&&n.createElement("p",{role:"alert",className:"a-danger"},l.error),!!l.issueCount&&n.createElement("p",{className:"a-caption",role:"status"},"Some saved folders or chats need attention."))}function Hx({host:e,workspaceHost:t,navigation:a}){var c;const r=fo(e,"chats"),o=ol(),i=Ku(n,t||e),s=((c=r.state.sidebarNavigation)==null?void 0:c.pinned)||{items:[],total:0,pages:1},l=r.state.recentShortcuts||[];return n.createElement("div",{className:"a-sidebar-navigation a-quiet-sidebar"},n.createElement(go,{model:r}),n.createElement("button",{type:"button",className:"a-nav-search-launch","data-action":"view.update",onClick:()=>a.browse("chats")},n.createElement(To,null),"Search chats"),n.createElement(ro,{id:"pinned",title:"Pinned",model:r},n.createElement(Gu,{page:s,model:r,now:o})),n.createElement(ro,{id:"workspaces",title:"Workspaces",model:r,actions:n.createElement("button",{type:"button",className:"a-icon","aria-label":"New workspace",onClick:()=>a.create()},n.createElement(Ln,null))},n.createElement(ji,{state:i,act:(t==null?void 0:t.dispatch)||r.act,compact:!0,heading:!1,onSelect:u=>a.browse("workspace",u.workspaceId)}),n.createElement("button",{type:"button",className:"a-sidebar-all a-link","data-action":"view.update",onClick:()=>a.browse("workspaces")},"All workspaces",n.createElement(en,null))),n.createElement(ro,{id:"recent",title:"Recent",model:r,actions:n.createElement("button",{type:"button",className:"a-icon","aria-label":"Refresh workspaces and chats","data-action":"history.refresh",disabled:r.refreshing,onClick:()=>r.act("history.refresh",{})},n.createElement(Mt,{className:r.refreshing?"a-progress-spinner":void 0}))},l.map(u=>n.createElement(Yu,{key:u.id,chat:u,model:r,now:o})),!l.length&&n.createElement("p",{className:"a-nav-empty"},"Your recent chats appear here."),n.createElement("button",{type:"button",className:"a-sidebar-all a-link","data-action":"view.update",onClick:()=>a.browse("chats")},"All chats",n.createElement(en,null))),r.history.loading&&n.createElement("p",{className:"a-caption",role:"status"},"Finding existing chats…"),!!r.history.issueCount&&n.createElement("p",{className:"a-caption",role:"status"},"Some saved folders or chats need attention. ",n.createElement("button",{className:"a-link",onClick:()=>a.browse("chats")},"Review chats")),r.history.error&&n.createElement("p",{role:"alert"},r.history.error))}function Vx(e){const t=v.useContext(zi);return t?n.createElement(Hx,{...e,navigation:t}):n.createElement(Bx,{...e})}function Ja(e){var s,l,c,u,d;const t=((s=e==null?void 0:e.view)==null?void 0:s.workSurface)||"chat",a=t==="workspace"?(l=e==null?void 0:e.view)==null?void 0:l.workWorkspaceId:t==="chat"?e==null?void 0:e.selectedWorkspaceId:null,r=((u=(c=e==null?void 0:e.workspaces)==null?void 0:c.find(p=>p.id===a))==null?void 0:u.path)||"",o=(d=e==null?void 0:e.view)==null?void 0:d.newSessionDraft,i=(o==null?void 0:o.workspace)??r;return{title:"",workspace:r,bundle:"",selection:{},...o,location:(o==null?void 0:o.location)||{kind:i?"workspace":"managed"}}}function ws(e){var t;return JSON.stringify([e.workspace,e.bundle||"",...((t=e.location)==null?void 0:t.kind)==="managed"?["managed"]:[]])}function Ag(e){var a;const t=Ja(e);return((a=e.draftDefaults)==null?void 0:a[ws(t)])||{}}function Wx(){return n.createElement("section",{className:"a-new-chat-setup","aria-label":"New chat"},n.createElement("img",{src:"/branding/icons/amplifier-icon-128.png",alt:""}),n.createElement("h2",null,"What shall we work on?"),n.createElement("p",null,"Bring an idea, a question, or a file."))}const Ha=crypto.randomUUID();let Yi;function $i(e){if(!e.startsWith("/api/"))return e;const t=new URL(e,location.origin);return t.searchParams.set("clientId",Ha),t.pathname+t.search}function Zx(e){if(!Yi){let t;try{t=sessionStorage.getItem("amplifier.clientId")||void 0}catch{}Yi=St("/api/clients/attach",{method:"POST",signal:e,body:{clientId:Ha,resumeClientId:t,kind:"web",protocolVersion:1}}).then(a=>{try{sessionStorage.setItem("amplifier.clientId",Ha)}catch{}return a}).catch(a=>{throw Yi=null,a})}return Yi}let pi;function ks(){return pi?pi.seconds+(performance.now()-pi.received)/1e3:Date.now()/1e3}async function St(e,t={}){var u,d,p;const a={...e.startsWith("/api/")?{"X-Amplifier-Client":Ha,"X-Amplifier-State-Transport":"delta-v1"}:{},...t.headers};let r=t.body;r&&typeof r=="object"&&!(r instanceof FormData)&&(a["Content-Type"]="application/json",r=JSON.stringify(r));const o=await fetch(e,{...t,body:r,headers:a,credentials:"same-origin"}),i=Date.parse((d=(u=o.headers)==null?void 0:u.get)==null?void 0:d.call(u,"date"));Number.isFinite(i)&&(!pi||i/1e3>ks())&&(pi={seconds:i/1e3,received:performance.now()});const s=await o.text();let l;try{l=s?JSON.parse(s):{}}catch{throw new Error(`The server returned an unexpected response (${o.status}).`)}const c=o.ok&&l.accepted===!1?Number.isInteger(l.status)&&l.status>=400&&l.status<600?l.status:400:o.status;if(!o.ok||l.accepted===!1)throw Object.assign(new Error(typeof l.error=="string"?l.error:((p=l.error)==null?void 0:p.message)||l.message||`Request failed (${c})`),{code:l.code,state:l.state,receipt:l.receipt,status:c});return l}function gm(e,t,a="application/json"){const r=new Blob([typeof t=="string"?t:JSON.stringify(t,null,2)],{type:a}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=e,i.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function Jx(e){var t,a;if(e)for(const r of e.querySelectorAll('button[aria-label],a[aria-label],[role="button"][aria-label]')){if(!((t=r.classList)!=null&&t.contains("a-icon"))&&!((a=r.querySelector)!=null&&a.call(r,"svg")))continue;const o=r.getAttribute("aria-label");o&&(!r.title||r.dataset.iconTitle==="auto")&&(r.title=o,r.dataset.iconTitle="auto")}}function Kx(e){const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode(o){if(o.nodeType===Node.ELEMENT_NODE){const i=getComputedStyle(o);return o.dataset.viewSource||i.display==="none"||i.visibility==="hidden"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}return o.textContent.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a,r="";for(;(a=t.nextNode())&&r.length<6e4;)r+=a.textContent.trim()+` +`;return r.slice(0,6e4)}function jl(e,t,{interfaceOnly:a=!1}={}){var s,l,c;if(!e)return{clientId:t};const r=u=>!!u.getClientRects().length&&getComputedStyle(u).visibility!=="hidden",o=[...e.querySelectorAll("button,input,textarea,select,a,[role=separator]")].filter(r).map(u=>{var d,p,m,h;return{id:u.id||null,action:u.dataset.action||((d=u.closest("[data-action]"))==null?void 0:d.dataset.action)||null,...u.closest("[data-shell-component]")?{component:{instanceId:u.closest("[data-shell-component]").dataset.shellComponent,slot:u.closest("[data-shell-component]").dataset.shellSlot,command:u.dataset.shellCommand||null}}:{},label:u.dataset.viewLabel||u.getAttribute("aria-label")||((m=(p=u.labels)==null?void 0:p[0])==null?void 0:m.textContent)||((h=u.textContent)==null?void 0:h.trim().slice(0,160)),type:u.getAttribute("role")||u.type||u.tagName.toLowerCase(),...u.getAttribute("role")==="separator"?{minimum:Number(u.getAttribute("aria-valuemin")),maximum:Number(u.getAttribute("aria-valuemax")),current:Number(u.getAttribute("aria-valuenow"))}:{},value:u.type==="password"||u.dataset.private==="true"?"[redacted]":u.value,disabled:!!u.disabled||!!u.closest("[inert]"),...u.hasAttribute("aria-expanded")?{expanded:u.getAttribute("aria-expanded")==="true"}:{},focused:document.activeElement===u}}),i=Object.fromEntries(["navigation","conversation","canvas"].flatMap(u=>{const d=e.querySelector(`[data-part="${u}"]`);if(!d)return[];const p=d.getBoundingClientRect();return[[u,{x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),visible:r(d),interactive:r(d)&&!d.closest("[inert]")}]]}));return{clientId:t,panes:i,webApp:{standalone:!!((s=window.matchMedia)!=null&&s.call(window,"(display-mode: standalone)").matches||navigator.standalone),secureContext:window.isSecureContext,serviceWorkerControlled:!!((l=navigator.serviceWorker)!=null&&l.controller),online:navigator.onLine},visibleText:a?Kx(e):e.innerText.slice(0,6e4),...a?{visibleTextScope:"interface",conversationSource:"Selected session messages, execution and activity in app state"}:{},controls:o,selectedText:((c=window.getSelection())==null?void 0:c.toString().slice(0,1e4))||"",viewport:{width:innerWidth,height:innerHeight,scrollX,scrollY},url:location.pathname}}function Yx({name:e,children:t}){const[a,r]=v.useState(!1),o=v.useRef(null),i=v.useRef(null),s=v.useId(),l=e==="app.status"?"Additional status":"Additional controls",c=e==="app.status"?mo:tl;return v.useEffect(()=>{if(!a)return;const u=d=>{var p;(p=o.current)!=null&&p.contains(d.target)||r(!1)};return document.addEventListener("pointerdown",u),()=>document.removeEventListener("pointerdown",u)},[a]),v.useEffect(()=>{const u=matchMedia("(max-width:760px)"),d=()=>{var p;u.matches&&((p=o.current)!=null&&p.contains(document.activeElement))&&document.activeElement!==i.current&&r(!0)};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),n.createElement("div",{className:"a-slot-overflow","data-open":a,ref:o,onKeyDown:u=>{var d;u.key==="Escape"&&a&&(u.stopPropagation(),u.preventDefault(),r(!1),(d=i.current)==null||d.focus())}},n.createElement("button",{ref:i,type:"button",className:"a-icon a-slot-overflow-toggle","aria-label":l,title:l,"aria-expanded":a,"aria-controls":s,onClick:()=>r(u=>!u)},n.createElement(c,null)),n.createElement("div",{className:"a-slot-overflow-items",id:s,role:"group","aria-label":l},t))}const $l=(e,t)=>Object.fromEntries(t.map(a=>[a,e==null?void 0:e[a]]));function Gx(e){var a,r;if(!e)return null;const t=(a=e.sessions)==null?void 0:a.find(o=>o.id===e.selectedSessionId);return JSON.stringify([e.shellDataKey??e.revision,e.shellChangeToken,e.selectedSessionId,e.selectedWorkspaceId,!!((r=e.runtime)!=null&&r.available),$l(e.view,["workSurface","workWorkspaceId"]),$l(t,["id","title","status","autoName","bundle","workspaceId","naming"]),$l(e.canvas,["id","kind","title","open"])])}const _g=v.createContext(null);function Qu(){return v.useContext(_g)}const Qx={"builtin.workspaces":Ux,"builtin.chats":Vx},vm={instances:[{id:"workspaces",package:"builtin.workspaces",slot:"navigation",hideWhen:{instanceId:"chats",navChatScope:"all"}},{id:"chats",package:"builtin.chats",slot:"navigation"}],presentation:{}},bm=Object.freeze({view:{},workspaces:[],chatNavigation:{items:[],total:0,pages:1,scope:{}},workspaceExplorer:{rows:[]},library:{bounded:!0},sharedHistory:{}}),$o=typeof location<"u"&&new URLSearchParams(location.search).get("shell")==="recovery";function xs(e){return e&&typeof e=="object"&&!Object.isFrozen(e)&&(Object.values(e).forEach(xs),Object.freeze(e)),e}function ym(e,t){return Object.fromEntries(((e==null?void 0:e.resolvedInstances)||[]).map(a=>{var i,s;const r=t[a.id],o=((s=(i=e.snapshots)==null?void 0:i[a.id])==null?void 0:s.generation)||0;return[a.id,(r==null?void 0:r.package)===a.package&&r.generation===o?r.status:"inactive"]}))}function Xx(e,t,a){var k;const[r,o]=v.useState(null),[i,s]=v.useState(""),[l,c]=v.useState([]),u=v.useRef(Promise.resolve()),d=v.useRef({data:null,dispatch:t}),p=v.useRef(new Map),m=v.useRef(null),h=v.useRef(!1);d.current.dispatch=t,d.current.state=e;const f=v.useCallback(()=>document.hidden?(h.current=!0,Promise.resolve()):m.current?(h.current=!0,m.current):(h.current=!1,m.current=St("/api/shell?clientId="+encodeURIComponent(a)+($o?"&recovery=1":"")).then(T=>{var I;d.current.data=T,o(T),s("");for(const F of p.current.values()){const z=((I=T.snapshots)==null?void 0:I[F.id])||bm;if((z.generation||0)!==F.generation)continue;const q={...z,view:{...z.view,...Object.assign({},...F.pending.map(W=>W.patch))}};JSON.stringify(q)!==JSON.stringify(F.snapshot)&&(F.snapshot=xs(q),F.listeners.forEach(W=>W()))}}).catch(T=>s(T.message)).finally(()=>{if(m.current=null,h.current)return h.current=!1,f()}),m.current),[a]),g=Gx(e);v.useEffect(()=>{e&&f()},[g,f]),v.useEffect(()=>{const T=F=>{F.detail.shellClientId===a&&f()},I=()=>{document.hidden||f()};return window.addEventListener("amplifier-shell",T),window.addEventListener("amplifier-reconnected",I),document.addEventListener("visibilitychange",I),()=>{window.removeEventListener("amplifier-shell",T),window.removeEventListener("amplifier-reconnected",I),document.removeEventListener("visibilitychange",I)}},[a,f]);const E=v.useCallback(T=>{var z,q,W,X,U;const I=((W=(q=(z=d.current.data)==null?void 0:z.snapshots)==null?void 0:q[T.id])==null?void 0:W.generation)||0,F=T.id+":"+I;if(!p.current.has(F)){const _={id:T.id,generation:I,listeners:new Set,pending:[],snapshot:xs(((U=(X=d.current.data)==null?void 0:X.snapshots)==null?void 0:U[T.id])||bm)};let P=Promise.resolve();const G=(Z,D)=>{const ne=Z==="shell.view.update"?{patch:D.patch}:null;ne&&(_.pending.push(ne),_.snapshot=xs({..._.snapshot,view:{..._.snapshot.view,...ne.patch}}),_.listeners.forEach(ie=>ie()));const H=async()=>{var ie,Ee;try{const me=await d.current.dispatch(Z,{...D,generation:I});return Z==="shell.command"&&D.action==="session.select"&&!((Ee=(ie=d.current.state)==null?void 0:ie.view)!=null&&Ee.navPinned)&&await d.current.dispatch("view.update",{patch:{navExpanded:!1}}),{accepted:me.accepted,result:me.result}}finally{ne&&(_.pending=_.pending.filter(me=>me!==ne)),await f()}},j=P.then(H,H);return P=j.catch(()=>{}),j};_.api=Object.freeze({apiVersion:"1.0",clientId:a,instanceId:T.id,getSnapshot:()=>_.snapshot,subscribe:Z=>(_.listeners.add(Z),()=>{var D,ne,H;_.listeners.delete(Z),!_.listeners.size&&(((H=(ne=(D=d.current.data)==null?void 0:D.snapshots)==null?void 0:ne[T.id])==null?void 0:H.generation)||0)!==I&&p.current.delete(F)}),setDirty:Z=>G("shell.view.update",{clientId:a,instanceId:T.id,patch:{},dirty:Z}),dispatch:(Z,D={})=>Z==="view.update"?G("shell.view.update",{clientId:a,instanceId:T.id,patch:D.patch||{}}):G("shell.command",{clientId:a,instanceId:T.id,action:Z,args:D})}),p.current.set(F,_)}return p.current.get(F).api},[a,f]),y=v.useRef({}),b=v.useRef(new Map),S=v.useRef(null),w=$o?vm:(r==null?void 0:r.effectiveComposition)||vm,N=l.length?{...w,presentation:{...w.presentation,...Object.assign({},...l.map(T=>T.patch))}}:w,x=v.useCallback(async T=>{var I;await t("shell.recover",{clientId:a,target:T,expectedRevision:((I=d.current.data)==null?void 0:I.revision)||0}),await f(),$o&&(location.href=location.pathname)},[a,t,f]),A=v.useCallback(T=>{const I={patch:{...T}};c(q=>[...q,I]);const F=async()=>{try{d.current.data||await f();const q=d.current.data;if(!q)throw Error("Shell settings are not available yet.");const W={...q.effectiveComposition,presentation:{...q.effectiveComposition.presentation,...T}},X=await t("shell.changes.prepare",{clientId:a,expectedRevision:q.revision,composition:W},{presentation:!0});await t("shell.changes.apply",{clientId:a,expectedRevision:q.revision,changeId:X.result.id},{presentation:!0}),await f()}finally{c(q=>q.filter(W=>W!==I))}},z=u.current.then(F,F);return u.current=z.catch(()=>{}),z},[a,t,f]),C=v.useCallback((T,I="")=>{var z;const F=d.current.data;if(!(!F||$o))return St("/api/actions",{method:"POST",body:{action:"shell.report",args:{clientId:a,revision:F.revision,previewId:((z=F.preview)==null?void 0:z.id)||null,instances:T,message:I}}}).catch(()=>{})},[a]),O=v.useCallback(T=>{var z,q,W;const I=((W=(q=(z=d.current.data)==null?void 0:z.snapshots)==null?void 0:q[T.id])==null?void 0:W.generation)||0,F=T.id+":"+T.package+":"+I;for(const X of b.current.keys())X.startsWith(T.id+":")&&X!==F&&b.current.delete(X);return b.current.has(F)||(y.current[T.id]={package:T.package,generation:I,status:"loading"},b.current.set(F,(X,U="")=>{var P,G,Z;const _=d.current.data;!((P=_==null?void 0:_.resolvedInstances)!=null&&P.some(D=>D.id===T.id&&D.package===T.package))||(((Z=(G=_.snapshots)==null?void 0:G[T.id])==null?void 0:Z.generation)||0)!==I||(y.current[T.id]={package:T.package,generation:I,status:X},clearTimeout(S.current),S.current=setTimeout(()=>C(ym(d.current.data,y.current),U),50))})),b.current.get(F)},[C]);return v.useEffect(()=>(clearTimeout(S.current),S.current=setTimeout(()=>C(ym(r,y.current)),80),()=>clearTimeout(S.current)),[r==null?void 0:r.revision,(k=r==null?void 0:r.preview)==null?void 0:k.id,C]),{data:r,error:i,composition:N,hostFor:E,recover:x,report:C,statusFor:O,refresh:f,setPresentation:A,ready:!!r,recovery:$o,clientId:a}}class Pg extends n.Component{constructor(){super(...arguments);Ke(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a){this.props.report("error",a.message)}render(){return this.state.error?n.createElement("p",{role:"alert"},"This component could not render. ",this.state.error.message):this.props.children}}function eS({View:e,host:t,report:a,workspaceHost:r,paired:o}){return v.useEffect(()=>{a("ready")},[e,a]),n.createElement(e,{host:t,workspaceHost:r,paired:o})}function Og({instance:e,metadata:t,host:a,report:r,workspaceHost:o,paired:i}){const[s,l]=v.useState(null),[c,u]=v.useState(""),d=Qx[e.package];v.useEffect(()=>{let m=!0;if(u(""),!d){if(!(t!=null&&t.url)){u((t==null?void 0:t.error)||"Package is unavailable."),r("error");return}return r("loading"),import(t.url).then(h=>{const f=h.default({React:n});if(typeof f!="function")throw Error("Invalid module factory.");m&&l({package:e.package,View:f})}).catch(h=>{m&&(u(h.message),r("error",h.message))}),()=>{m=!1}}},[e.package,t==null?void 0:t.url,t==null?void 0:t.error,d,r]);const p=d||((s==null?void 0:s.package)===e.package?s.View:null);return c?n.createElement("p",{role:"alert"},"Component unavailable: ",c):p?n.createElement(Pg,{key:e.package+":"+a.getSnapshot().generation,report:r},n.createElement(eS,{View:p,host:a,report:r,workspaceHost:o,paired:i})):n.createElement("p",{role:"status"},"Loading component…")}function tS({shell:e}){const t=e.composition.instances.filter(a=>a.slot==="navigation");return e.ready?n.createElement(n.Fragment,null,(e.error||e.recovery)&&n.createElement("p",{role:"alert"},e.recovery?"Recovery mode: optional components are disabled.":e.error),n.createElement("div",{className:"a-shell-modules"},t.map((a,r)=>{var o,i,s,l,c,u,d,p,m,h,f;return n.createElement("section",{className:"a-shell-instance","data-shell-instance":a.id,"data-shell-package":a.package,hidden:!!a.hideWhen&&!((c=(l=(s=(i=(o=e.data)==null?void 0:o.snapshots)==null?void 0:i[a.id])==null?void 0:s.view)==null?void 0:l.workspaceDraft)!=null&&c.mode)&&((m=(p=(d=(u=e.data)==null?void 0:u.snapshots)==null?void 0:d[a.hideWhen.instanceId])==null?void 0:p.view)==null?void 0:m.navChatScope)===a.hideWhen.navChatScope,style:{order:r},key:a.id},n.createElement(Og,{instance:a,metadata:(f=(h=e.data)==null?void 0:h.packages)==null?void 0:f[a.package],host:e.hostFor(a),report:e.statusFor(a),paired:a.package==="builtin.workspaces"&&e.composition.instances.some(g=>{var E;return g.id===((E=a.hideWhen)==null?void 0:E.instanceId)&&g.package==="builtin.chats"}),workspaceHost:a.package==="builtin.chats"&&e.composition.instances.some(g=>{var E;return g.package==="builtin.workspaces"&&((E=g.hideWhen)==null?void 0:E.instanceId)===a.id})?e.hostFor(e.composition.instances.find(g=>{var E;return g.package==="builtin.workspaces"&&((E=g.hideWhen)==null?void 0:E.instanceId)===a.id})):void 0}))})),n.createElement("details",{className:"a-shell-recovery"},n.createElement("summary",null,"Shell controls"),n.createElement("button",{type:"button",onClick:()=>e.recover("lastGood")},"Restore last working shell"),n.createElement("button",{type:"button",onClick:()=>e.recover("default")},"Restore default shell"),n.createElement("a",{href:"?shell=recovery"},"Open recovery mode"))):n.createElement("p",{role:"status"},"Loading navigation…")}function nS({children:e,report:t}){return v.useEffect(()=>{t("ready")},[t]),e}function Ur({name:e,instanceId:t,children:a}){var s;const r=Qu();if(!r)return a||null;const o=(((s=r.data)==null?void 0:s.resolvedInstances)||[]).filter(l=>l.slot===e&&(!t||l.id===t));if(!o.length)return null;const i=o.map(l=>{var c,u,d,p,m,h,f,g,E,y,b;return{builtin:l.package===((d=(u=(c=r.data)==null?void 0:c.slots)==null?void 0:u[e])==null?void 0:d.default),element:l.package===((h=(m=(p=r.data)==null?void 0:p.slots)==null?void 0:m[e])==null?void 0:h.default)?n.createElement(Pg,{key:l.id+":"+(((E=(g=(f=r.data)==null?void 0:f.snapshots)==null?void 0:g[l.id])==null?void 0:E.generation)||0),report:r.statusFor(l)},n.createElement(nS,{report:r.statusFor(l)},a)):n.createElement("div",{className:"a-shell-contribution","data-shell-component":l.id,"data-shell-slot":e,key:l.id},n.createElement(Og,{instance:l,metadata:(b=(y=r.data)==null?void 0:y.packages)==null?void 0:b[l.package],host:r.hostFor(l),report:r.statusFor(l)}))}});return["app.actions","app.status"].includes(e)&&i.some(l=>!l.builtin)?n.createElement(n.Fragment,null,i.filter(l=>l.builtin).map(l=>l.element),n.createElement(Yx,{name:e},i.filter(l=>!l.builtin).map(l=>l.element))):i.map(l=>l.element)}const Ls=v.createContext(void 0);function yr({children:e,inline:t=!1}){const a=v.useContext(Ls);return t||a===void 0?e:a?Mi.createPortal(e,a):null}function aS({children:e,label:t}){const a=v.useContext(Ls),[r,o]=v.useState(null);return a===void 0?e:n.createElement(n.Fragment,null,n.createElement(yr,null,n.createElement("div",{ref:o,className:"a-canvas-view-tools",role:"group","aria-label":t})),n.createElement(Ls.Provider,{value:r},e))}const rS=(e,t)=>t.sessionId===e.selectedSessionId&&t.workspaceId===e.selectedWorkspaceId;function vo(e){return(e.canvasArtifacts||[]).filter(t=>rS(e,t))}function Em({state:e,message:t,act:a}){const r=vo(e).flatMap(o=>{var i;return(o.publications||[{messageId:o.messageId,version:((i=o.app)==null?void 0:i.revision)||o.revision||1}]).filter(s=>s.messageId===t.id).map(s=>({row:o,version:s.version}))});return r.length?n.createElement("div",{className:"a-chat-artifacts","aria-label":"Saved artifacts for this turn"},r.map(({row:o,version:i})=>{var s,l;return n.createElement("button",{type:"button",key:o.id+":"+i,className:"a-artifact-link","data-action":"canvas.select",onClick:()=>a("canvas.select",{id:o.id,version:i})},o.kind==="browser"?n.createElement(vr,null):n.createElement(No,null),n.createElement("span",null,((l=(((s=o.app)==null?void 0:s.versions)||o.versions||[]).find(c=>c.version===i))==null?void 0:l.title)||o.title," · Version ",i),n.createElement(Dr,null))})):null}function oS({state:e,act:t}){const a=vo(e).filter(r=>r.tabOpen);return a.length?n.createElement("div",{className:"a-canvas-tabs",role:"tablist","aria-label":"Open canvas items"},a.map(r=>{var o,i;return n.createElement("div",{className:`a-canvas-tab ${r.id===((o=e.canvas)==null?void 0:o.id)?"is-active":""}`,key:r.id},n.createElement("button",{type:"button",role:"tab","aria-selected":r.id===((i=e.canvas)==null?void 0:i.id),"data-action":"canvas.select",onClick:()=>t("canvas.select",{id:r.id})},r.kind==="browser"?n.createElement(vr,null):n.createElement(No,null),n.createElement("span",null,r.title)),n.createElement("button",{type:"button",className:"a-icon","aria-label":`Close tab ${r.title}`,"data-action":"canvas.tabClose",onClick:()=>t("canvas.tabClose",{id:r.id})},n.createElement(nn,null)))})):null}function iS({state:e,act:t}){var i;const a=((i=e.view)==null?void 0:i.canvasDraft)||{},r=vo(e),o=nl(r,a.filter||"",s=>[s.title,s.kind,s.path||"",s.url||""]);return n.createElement("section",{className:"a-canvas-library","aria-label":"Saved canvas artifacts"},n.createElement("h3",null,"Saved in this chat ",n.createElement("small",null,r.length)),n.createElement("input",{type:"search","aria-label":"Filter saved artifacts",placeholder:"Find artifacts · * ? patterns",value:a.filter||"","data-action":"view.update",onChange:s=>t("view.update",{patch:{canvasDraft:{...a,filter:s.target.value}}})}),o.slice().reverse().map(s=>n.createElement("button",{key:s.id,type:"button",className:"a-saved-artifact","data-action":"canvas.select",onClick:async()=>{await t("canvas.select",{id:s.id}),t("view.update",{patch:{canvasDraft:{...a,library:!1}}})}},s.kind==="browser"?n.createElement(vr,null):n.createElement(No,null),n.createElement("span",null,n.createElement("strong",null,s.title),n.createElement("small",null,s.kind," · ",s.kind==="browser"?"Saved address":s.app?"Interactive surface":"Saved snapshot")),n.createElement(Dr,null))),!o.length&&n.createElement("p",null,r.length?"No matching artifacts.":"Files and visuals you open will stay here, even after closing their tabs."))}function sS({state:e,act:t}){var s;const a=((s=e.view)==null?void 0:s.canvasDraft)||{},[r,o]=v.useState(a.url||""),i=v.useRef(null);return v.useEffect(()=>{(i.current===null||a.url===i.current)&&(o(a.url||""),i.current=null)},[a.url]),n.createElement("form",{className:"a-canvas-address",onSubmit:l=>{l.preventDefault(),t("canvas.show",{kind:"browser",url:r})}},n.createElement("label",{htmlFor:"canvas-browser-url"},"App or website address"),n.createElement("div",null,n.createElement("input",{id:"canvas-browser-url",type:"url",required:!0,placeholder:"http://localhost:3000",value:r,"data-action":"view.update",onChange:l=>{o(l.target.value),i.current=l.target.value,t("view.update",{patch:{canvasDraft:{...a,url:l.target.value}}})}}),n.createElement("button",{className:"a-primary",type:"submit","data-action":"canvas.show",disabled:!r.trim()},n.createElement(Dr,null),"Open")))}function lS(e,t){const a=new URL(e),r=new URL(t),o=l=>l==="localhost"||l.endsWith(".localhost")||l==="[::1]"||/^127\.\d+\.\d+\.\d+$/.test(l),i=r.protocol==="https:"&&a.protocol==="http:"&&!o(a.hostname),s=o(a.hostname)&&!o(r.hostname);return{blocked:i,localWarning:s,message:i?"This HTTP page cannot be embedded inside the HTTPS app. Open it in your browser, or serve the page over HTTPS.":s?"This address points to the device viewing the app. For a service running on the Amplifier host, use that host’s LAN or Tailnet address.":"Some sites block embedding or require a separate browser tab. The app cannot verify the contents of this external frame."}}function cS({canvas:e,act:t}){var o,i,s,l;const a=lS(e.url,typeof location>"u"?"http://localhost":location.href),r=v.useRef(t);return r.current=t,v.useEffect(()=>{const c=(d,p)=>r.current("canvas.report",{id:e.id,part:"preview",status:d,message:p});if(a.blocked){c("error",a.message);return}c("pending","Opening external preview; page contents cannot be verified.");const u=setTimeout(()=>c("unverified","Preview could not be verified. If it is blank, open it in your browser or check the address and site embedding policy."),12e3);return()=>clearTimeout(u)},[e.id,(o=e.view)==null?void 0:o.reload,a.blocked,a.message]),n.createElement("div",{className:"a-browser-preview"},n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},n.createElement(vr,null),n.createElement("span",{className:"a-browser-url",title:e.url},e.url),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Reload browser preview","data-action":"canvas.view",onClick:()=>t("canvas.view",{id:e.id,patch:{reload:Date.now()}})},n.createElement(sx,null)))),a.blocked?n.createElement("div",{className:"a-browser-blocked",role:"alert"},n.createElement(vr,null),n.createElement("h3",null,"Open this page in your browser"),n.createElement("p",null,a.message),n.createElement("a",{className:"a-soft","data-action":"canvas.openExternal",href:e.url,target:"_blank",rel:"noopener noreferrer"},"Open in browser ",n.createElement(sa,{size:16}))):n.createElement("iframe",{key:`${e.id}-${((i=e.view)==null?void 0:i.reload)||0}`,title:e.title||"App preview",className:"a-canvas-html",sandbox:"allow-scripts allow-forms",referrerPolicy:"no-referrer",src:e.url,onLoad:()=>t("canvas.report",{id:e.id,part:"preview",status:"unverified",message:"Frame navigation finished. Browser security prevents confirming whether this external page loaded or permits embedding."})}),n.createElement("div",{className:"a-browser-help"},n.createElement("a",{"data-action":"canvas.openExternal",href:e.url,target:"_blank",rel:"noopener noreferrer"},"Open in browser ",n.createElement(sa,{size:13})),n.createElement("button",{className:"a-link",type:"button","data-action":"canvas.view","aria-expanded":!!((s=e.view)!=null&&s.help),onClick:()=>{var c;return t("canvas.view",{id:e.id,patch:{help:!((c=e.view)!=null&&c.help)}})}},"Preview help"),(((l=e.view)==null?void 0:l.help)||a.localWarning)&&n.createElement("p",null,a.message," The service must stay running and be reachable from this device. Authentication, frame policies, redirects, and sandbox restrictions can require opening it separately.")))}function Mg({state:e,session:t,act:a}){const r=bg(e,t);return r?n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>a("view.update",{patch:{panel:"subagent-history",subagentHistory:{sessionId:t.id,filter:"",index:0}}})},n.createElement(Wa,null),"Subagent history (",r,")"):null}function uS({state:e,session:t,act:a}){var p,m;const r=((p=e.view)==null?void 0:p.subagentHistory)||{},o=((m=e.sessions)==null?void 0:m.find(h=>h.id===r.sessionId))||t,i=r.filter||"",s=Rx(e,o),{pages:l,index:c}=s,u=h=>a("view.update",{patch:{subagentHistory:{sessionId:o==null?void 0:o.id,filter:i,index:c,...h}}}),d=async h=>{const f=await a("session.select",{id:h});f&&f.accepted!==!1&&await a("view.update",{patch:{panel:null}})};return n.createElement("div",{"data-part":"subagent-history"},n.createElement("p",null,"Saved subagent conversations from ",(o==null?void 0:o.title)||"this conversation",". Open one to read its work."),n.createElement("label",{htmlFor:"subagent-history-filter"},"Find subagent conversations"),n.createElement("input",{id:"subagent-history-filter",type:"search",value:i,placeholder:"Search or pattern, e.g. *research*","data-action":"view.update",onChange:h=>u({filter:h.target.value,index:0})}),n.createElement("p",{className:"a-caption",role:"status"},s.pending?"Loading subagent conversations…":`${s.total} of ${s.unfilteredTotal} subagent conversations`),n.createElement("div",{className:"a-subagent-history-list","aria-busy":!!s.pending},s.items.map(h=>n.createElement("button",{key:h.id,type:"button",className:"a-soft","data-action":"session.select",onClick:()=>d(h.id),title:h.description||h.nativeIdentity||h.id},n.createElement(Wa,null),n.createElement("span",null,h.title||"Subagent conversation"),n.createElement(en,null)))),!s.total&&!s.pending&&n.createElement("p",null,i?"No matching subagent conversations.":"No saved subagent conversations for this chat."),l>1&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:c===0,onClick:()=>u({index:c-1})},n.createElement(Fk,null),"Previous subagents"),n.createElement("span",{className:"a-caption"},s.start+1,"–",s.end," of ",s.total),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",disabled:c===l-1,onClick:()=>u({index:c+1})},"More subagents",n.createElement(en,null))))}function dS({state:e,act:t,changeDraft:a}){var c;const r=(c=e.sessions)==null?void 0:c.find(u=>u.id===e.selectedSessionId),o=vo(e),i=[...new Map(((r==null?void 0:r.messages)||[]).flatMap(u=>u.attachments||[]).map(u=>[u.id||u.name,u])).values()],s=(r==null?void 0:r.workers)||[],l=s.filter(u=>["queued","starting","working","running","stopping"].includes(u.status)).length;return n.createElement("div",{className:"a-chat-overview",role:"region","aria-label":"Chat overview",tabIndex:0},n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(No,null),n.createElement("h3",null,"Outputs"),n.createElement("span",null,o.length)),o.length?n.createElement(iS,{state:e,act:t}):n.createElement("p",null,"Files and visuals from this chat will appear here."),n.createElement("div",{className:"a-overview-actions"},n.createElement("button",{className:"a-link",type:"button",onClick:()=>a({open:!0,browser:!1,library:!0})},n.createElement(nr,null),"Open file"),n.createElement("button",{className:"a-link",type:"button",onClick:()=>a({browser:!0,open:!1,library:!0})},n.createElement(vr,null),"Open website"))),n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(Fu,null),n.createElement("h3",null,"Sources")),i.length?n.createElement("ul",null,i.map(u=>n.createElement("li",{key:u.id||u.name},u.name||"Attachment"))):n.createElement("p",null,"No attachments in the loaded messages.")),n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(Wa,null),n.createElement("h3",null,"Agents"),l>0&&n.createElement("span",null,l," working")),s.length?n.createElement("ul",null,s.map(u=>n.createElement("li",{key:u.id},u.name||u.instruction||"Worker"," ",n.createElement("small",null,u.status)))):n.createElement("p",null,"Delegated work will appear here."),n.createElement(Mg,{state:e,session:r,act:t}),n.createElement("button",{className:"a-link",type:"button",onClick:()=>t("view.update",{patch:{panel:"coordination"}})},"View tasks and workers")),n.createElement("section",null,n.createElement("div",{className:"a-overview-title"},n.createElement(mo,null),n.createElement("h3",null,"Activity")),n.createElement("p",null,(r==null?void 0:r.status)||"Idle"),n.createElement("button",{className:"a-link",type:"button",onClick:()=>t("view.update",{patch:{panel:"runtime"}})},"Chat controls and details")))}const Jc=new Set;function pS(e,t){const a={sessionId:e,checkpoint:t};return Jc.add(a),()=>Jc.delete(a)}async function Bl(e,t){const a=[...Jc].filter(o=>o.sessionId===e).map(o=>Promise.resolve().then(()=>o.checkpoint(t)).catch(()=>{}));let r;try{await Promise.race([Promise.all(a),new Promise(o=>{r=setTimeout(o,1e3)})])}finally{clearTimeout(r)}}const Bo=e=>Object.fromEntries(["viewId","resourceId","resourceRevision","generation"].map(t=>[t,e[t]])),mS=["bg","surface","soft","ink","muted","line","accent","tint","green","danger"];function wm(){const e=document.getElementById("amp-one"),t=getComputedStyle(e||document.documentElement);return{version:1,tokens:Object.fromEntries(mS.map(a=>[a,t.getPropertyValue("--a-"+a).trim()])),scheme:t.colorScheme==="dark"?"dark":t.colorScheme==="light"?"light":matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",reducedMotion:matchMedia("(prefers-reduced-motion: reduce)").matches,contrast:matchMedia("(prefers-contrast: more)").matches?"more":"normal"}}function hS({canvas:e,dispatch:t}){const[a,r]=v.useState(e),[o,i]=v.useState(""),[s,l]=v.useState(""),[c,u]=v.useState(!1),[d,p]=v.useState(null),m=v.useRef(),h=v.useRef(e),f=v.useRef(a),g=v.useRef(!1),E=v.useRef(0),y=v.useRef(0),b=v.useRef(crypto.randomUUID()),S=v.useRef(new Map),w=v.useRef(Promise.resolve()),N=v.useRef(),x=v.useRef();(e.app.revision!==h.current.app.revision||e.app.stateRevision>=h.current.app.stateRevision)&&(h.current=e),f.current=a;const A=e.app,C=v.useRef(new Map),O=W=>{y.current=0,b.current=crypto.randomUUID(),S.current.clear(),p(null),i(""),l(""),N.current=null,x.current=null,r(W)},k=(W=!1)=>{var P,G;const X=h.current;if(X.app.revision!==f.current.app.revision)return;const U={id:X.id,app:X.app,visible:!!X.open,theme:wm()},_=JSON.stringify([b.current,X.app.revision,X.app.stateRevision,U.visible,U.theme]);!W&&_===N.current||(N.current=_,(G=(P=m.current)==null?void 0:P.contentWindow)==null||G.postMessage({type:"canvas-app-host",id:X.id,channel:b.current,snapshot:U},"*"))},T=(W,X=y.current)=>{if(X!==y.current)return Promise.resolve();g.current=W,u(W);const U=Bo(f.current),_=b.current,P=w.current.catch(()=>{}).then(()=>t("canvas.views.dirty",{...U,dirty:W,editVersion:X}));return w.current=P,P.catch(G=>{throw _===b.current&&(g.current=!0,u(!0),i(G.message)),G})};v.useEffect(()=>{e.app.revision!==a.app.revision&&!g.current&&!E.current?O(e):k()},[e]),v.useEffect(()=>{const W=pS(e.sessionId,D=>new Promise(ne=>{var ie,Ee;const H=D||crypto.randomUUID(),j=setTimeout(()=>{C.current.delete(H),ne()},900);C.current.set(H,()=>{clearTimeout(j),ne()}),(Ee=(ie=m.current)==null?void 0:ie.contentWindow)==null||Ee.postMessage({type:"canvas-app-host",id:h.current.id,channel:b.current,checkpoint:H},"*")})),X=async D=>{var Ee,me,_e,Je,De,ue,ye,M;const ne=D.data;if(D.source!==((Ee=m.current)==null?void 0:Ee.contentWindow)||(ne==null?void 0:ne.type)!=="canvas-app"||ne.id!==h.current.id)return;if(ne.op==="ready"){k(!0);return}if(ne.channel!==b.current)return;if(ne.op==="observation"){const Y=ne.observation;if(!Y||JSON.stringify(Y).length>48e4)return;try{await St("/api/actions",{method:"POST",body:{action:"canvas.views.observe",args:{...Y,...Bo(f.current),...ne.checkpoint?{checkpointId:ne.checkpoint}:{}},id:crypto.randomUUID()}})}catch{}(me=C.current.get(ne.checkpoint))==null||me(),C.current.delete(ne.checkpoint);return}if(ne.op==="status"){const Y=ne.status==="error"?"error":"ready",se=String(ne.message||"").slice(0,1e3),Fe=Y+":"+se;if(Fe===x.current)return;x.current=Fe,t("canvas.views.status",{...Bo(f.current),status:Y,message:se}).catch(()=>{}),l(Y==="error"?se:"");return}if(ne.op==="editing"&&h.current.readOnlyVersion)return;if(ne.op==="editing"){Number.isSafeInteger(ne.editVersion)&&ne.editVersion>y.current&&(y.current=ne.editVersion,T(!0).catch(()=>{}));return}if(!["state","event","request","dirty"].includes(ne.op)||typeof ne.requestId!="string"||ne.requestId.length>80)return;const H=Y=>{var se,Fe;return(Fe=(se=m.current)==null?void 0:se.contentWindow)==null?void 0:Fe.postMessage({type:"canvas-app-host",id:h.current.id,channel:b.current,requestId:ne.requestId,...Y},"*")};if(h.current.readOnlyVersion){H({error:"This saved version is read-only. Select Latest to interact."});return}if(JSON.stringify(ne).length>32e4){H({error:"This change exceeds the surface message size limit."});return}if(ne.revision!==f.current.app.revision){H({error:"This design changed. Inspect the current surface before retrying."});return}if(S.current.has(ne.requestId)){const Y=S.current.get(ne.requestId);Y&&H(Y);return}if(S.current.size>=128){const Y=[...S.current].find(([,se])=>se!==null);if(Y)S.current.delete(Y[0]);else{H({error:"Wait for pending surface changes to finish."});return}}S.current.set(ne.requestId,null),E.current++;const j=ne.editVersion,ie=b.current;try{let Y;if(ne.op==="dirty")await T(!!((_e=ne.args)!=null&&_e.dirty),j),Y={app:h.current.app};else{const Fe=ne.op==="state"?{patch:(Je=ne.args)==null?void 0:Je.patch}:ne.op==="event"?{name:(De=ne.args)==null?void 0:De.name,payload:(ue=ne.args)==null?void 0:ue.payload}:{name:(ye=ne.args)==null?void 0:ye.name,input:(M=ne.args)==null?void 0:M.input};Y=(await t("canvas.apps."+ne.op,{...Fe,id:f.current.id,sessionId:f.current.sessionId,expectedRevision:f.current.app.revision,expectedStateRevision:ne.stateRevision},{id:b.current+":"+ne.requestId})).result,Y.app.revision===h.current.app.revision&&Y.app.stateRevision>=h.current.app.stateRevision&&(h.current={...h.current,app:Y.app}),(ne.op==="state"||ne.op==="event")&&Number.isSafeInteger(ne.commit)&&ne.commit===j&&j===y.current&&await T(!1,j)}if(ie!==b.current)return;const se={snapshot:{id:h.current.id,app:Y.app,theme:wm()}};S.current.set(ne.requestId,se),H(se),i("")}catch(Y){if(ie!==b.current)return;const se={error:Y.message};S.current.set(ne.requestId,se),H(se),i(Y.message)}finally{E.current--,ie===b.current&&!E.current&&!g.current&&h.current.app.revision!==f.current.app.revision&&O(h.current)}};window.addEventListener("message",X);let U;const _=()=>{cancelAnimationFrame(U),U=requestAnimationFrame(()=>k())},P=new MutationObserver(_);P.observe(document.head,{subtree:!0,childList:!0,characterData:!0});const G=document.getElementById("amp-one");G&&P.observe(G,{attributes:!0,subtree:!0,childList:!0,characterData:!0});const Z=["prefers-color-scheme: dark","prefers-reduced-motion: reduce","prefers-contrast: more"].map(D=>matchMedia("("+D+")"));return Z.forEach(D=>D.addEventListener("change",_)),()=>{W();for(const D of C.current.values())D();C.current.clear(),window.removeEventListener("message",X),P.disconnect(),cancelAnimationFrame(U),Z.forEach(D=>D.removeEventListener("change",_))}},[t]);const I=()=>({id:e.id,sessionId:e.sessionId,expectedRevision:h.current.app.revision,expectedStateRevision:h.current.app.stateRevision}),F=async(W,X)=>{try{const U=await t(W,{...I(),...X});return i(""),U}catch(U){i(U.message)}},z=async W=>{const X=await t("canvas.apps.inspect",{id:e.id,sessionId:e.sessionId,requestId:W.id});p({request:W,input:X.result.requestInput})},q=$i(`/api/canvas/${a.id}/app-host?`+new URLSearchParams(Bo(a)));return n.createElement("section",{className:"a-canvas-app","aria-label":"Interactive conversation surface"},c&&n.createElement("p",{className:"a-canvas-unsaved",role:"status"},"Unsaved input"),n.createElement(yr,null,n.createElement("div",{className:"a-canvas-app-bar"},n.createElement("span",null,"Revision ",A.revision),n.createElement("details",null,n.createElement("summary",null,"History & shared state"),n.createElement("p",null,"Restoring a design keeps compatible current inputs and never repeats actions."),A.versions.map(W=>n.createElement("button",{type:"button",key:W.version,disabled:W.version===A.revision||c||e.readOnlyVersion,onClick:()=>F("canvas.apps.restore",{version:W.version})},"Restore revision ",W.version)),n.createElement("pre",{"aria-label":"Shared surface state"},JSON.stringify(A.state,null,2))))),(o||s)&&n.createElement("div",{className:"a-canvas-app-errors",role:"alert"},s&&n.createElement("p",null,s),o&&o!==s&&n.createElement("p",null,o)),a.app.revision!==A.revision&&n.createElement("p",{role:"status"},"A new design is ready. Your unfinished input is still here. ",n.createElement("button",{type:"button",onClick:async()=>{try{await t("canvas.views.dirty",{...Bo(h.current),dirty:!1}),g.current=!1,u(!1),O(h.current)}catch(W){i(W.message)}}},"Discard unfinished input and load revision ",A.revision)),A.requests.filter(W=>W.status==="pending").map(W=>n.createElement("div",{className:"a-canvas-app-request",key:W.id},n.createElement("span",null,W.action==="theme.preview"?"Preview on this device":W.action==="theme.apply"?"Apply to the shared shell":"Revert this device’s last theme change",": ",W.summary),n.createElement("button",{type:"button",onClick:()=>z(W).catch(X=>i(X.message))},"Review theme change"),n.createElement("button",{type:"button",onClick:()=>F("canvas.apps.resolve",{requestId:W.id,approve:!1})},"Decline"))),d&&A.requests.some(W=>W.id===d.request.id&&W.status==="pending")&&n.createElement("section",{className:"a-canvas-app-review","aria-label":"Review requested theme change"},n.createElement("strong",null,d.request.summary),n.createElement("p",null,d.request.action==="theme.apply"?"Applying changes the shell for all connected clients.":"This action uses this device’s theme controls."),n.createElement("pre",null,d.input.css||"End the preview, or undo the last applied theme if it is still current."),n.createElement("button",{type:"button",onClick:async()=>{await F("canvas.apps.resolve",{requestId:d.request.id,approve:!0})&&p(null)}},"Approve theme change"),n.createElement("button",{type:"button",onClick:()=>p(null)},"Back")),e.readOnlyVersion&&n.createElement("p",{role:"status"},"Saved design, read only.",e.historicalStateUnavailable?" Inputs were not recorded for this older design.":" Inputs show the state saved when this version was created."),n.createElement("iframe",{key:a.app.revision,title:e.title,ref:m,src:q,sandbox:"allow-scripts allow-same-origin",onLoad:()=>k(!0)}))}const fS="modulepreload",gS=function(e){return"/"+e},km={},zg=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let s=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=s(a.map(u=>{if(u=gS(u),u in km)return;km[u]=!0;const d=u.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":fS,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((h,f)=>{m.addEventListener("load",h),m.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return o.then(s=>{for(const l of s||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},xm=4e3;function vS(e,t=0){return()=>a=>{const r=o=>{var i;o.children=(i=o.children)==null?void 0:i.map(s=>{var u,d,p,m,h,f;const l=(d=(u=s.position)==null?void 0:u.start)==null?void 0:d.offset,c=(m=(p=s.position)==null?void 0:p.end)==null?void 0:m.offset;if(s.type==="text"&&Number.isInteger(l)&&Number.isInteger(c))return{type:"emphasis",data:{hName:"span",hProperties:{"data-canvas-source-start":t+l,"data-canvas-source-end":t+c}},children:[s]};if(["inlineCode","code"].includes(s.type)&&Number.isInteger(l)&&Number.isInteger(c)){const g=e.slice(l,c),E=((h=/^`+/.exec(g))==null?void 0:h[0].length)||0;let y=l;if(s.type==="inlineCode"){y+=E;const b=e.slice(y,c-E);b.startsWith(" ")&&b.endsWith(" ")&&b.trim()&&y++}else/^ {0,3}(`{3,}|~{3,})/.test(g)?y+=g.indexOf(` +`)+1:y+=/^ */.exec(g)[0].length;y+s.value.length<=c&&e.slice(y,y+s.value.length)===s.value&&(s.data={...s.data,hProperties:{...(f=s.data)==null?void 0:f.hProperties,"data-canvas-source-start":t+y,"data-canvas-source-end":t+y+s.value.length,"data-canvas-literal":"true"}})}return s.children&&r(s),s})};r(a)}}const bS=/\\[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~]|&(?:#[xX][0-9a-fA-F]{1,6}|#[0-9]{1,7}|[A-Za-z][A-Za-z0-9]+);|\r\n/g;function yS(e,t,a){const r=[0];let o="",i=0;const s=(l,c,u)=>{o+=l;for(let d=1;d<=l.length;d++)r.push(d===l.length?u:c)};for(const l of e.matchAll(bS)){for(let u=i;uxm)return{error:`Select at most ${xm.toLocaleString()} characters to reference.`};const i=e.ownerDocument,s=i.createElement("textarea"),l=g=>(s.innerHTML=g,s.value),c=i.createTreeWalker(e,4),u=[];let d;for(;d=c.nextNode();){if(!r.intersectsNode(d))continue;const g=d===r.startContainer?r.startOffset:0,y=d===r.endContainer?r.endOffset:d.length;if(y<=g)continue;const E=(f=d.parentElement)==null?void 0:f.closest("[data-canvas-source-start]");if(!E||!e.contains(E)||E.textContent!==d.textContent){if(d.textContent.slice(g,y).trim())return{error:"Select document text without embedded controls or diagrams."};continue}const b=Number(E.dataset.canvasSourceStart),S=Number(E.dataset.canvasSourceEnd),w=E.dataset.canvasLiteral==="true",N=a.slice(b,S),x=w||N===d.textContent,A=x?null:yS(N,!1,l);if((x?N:A.text)!==d.textContent)return{error:"This selection cannot be mapped to the saved source. Select a smaller text passage."};u.push({start:b+(x?g:A.offsets[g]),end:b+(x?y:A.offsets[y]),...w?{literal:!0}:{}})}if(!u.length)return null;if(u.length>128)return{error:"Select a smaller passage to reference."};let p=0,m=0;const h=g=>{for(;p65535?2:1,m++;return m};for(const g of u)g.start=h(g.start),g.end=h(g.end);return{excerpt:o,spans:u}}/*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */function Sm(e,t){(t==null||t>e.length)&&(t=e.length);for(var a=0,r=Array(t);a2?r-2:0),i=2;i1?a-1:0),o=1;o"u"?null:gn(BigInt.prototype.toString),Am=typeof Symbol>"u"?null:gn(Symbol.prototype.toString),oa=gn(Object.prototype.hasOwnProperty),Wo=gn(Object.prototype.toString),Hn=gn(RegExp.prototype.test),Cr=MS(TypeError);function gn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:si;if(Cm&&Cm(e,null),!oo(t))return e;let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=a(o);i!==o&&(NS(t)||(t[r]=i),o=i)}e[o]=!0}return e}function zS(e){for(let t=0;t/g),$S=Dn(/\${[\w\W]*/g),BS=Dn(/^data-[\-\w.\u00B7-\uFFFF]+$/),HS=Dn(/^aria-[\-\w]+$/),zm=Dn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VS=Dn(/^(?:\w+script|data):/i),WS=Dn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ZS=Dn(/^html$/i),JS=Dn(/^[a-z][.\w]*(-[.\w]+)+$/i),Lm=Dn(/<[/\w!]/g),Dm=Dn(/<[/\w]/g),KS=Dn(/<\/no(script|embed|frames)/i),YS=Dn(/\/>/i),fa={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Fg=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],GS=Nn(Tt({},Fg)),QS=(function(){const e={};return Ir(Fg,t=>{e[t]=Dn(new RegExp("])","i"))}),Nn(e)})(),XS=function(){return typeof window>"u"?null:window},e1=function(t,a){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";a&&a.hasAttribute(o)&&(r=a.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Fm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},sr=function(t,a,r,o){return oa(t,a)&&oo(t[a])?Tt(o.base?ba(o.base):{},t[a],o.transform):r},Kl=function(t,a,r){const o=oa(t,a)?t[a]:void 0;return o&&typeof o=="object"?ba(o):r()};function qg(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XS();const t=he=>qg(he);if(t.version="3.4.15",t.removed=[],!e||!e.document||e.document.nodeType!==fa.document||!e.Element)return t.isSupported=!1,t;let a=e.document;const r=a,o=r.currentScript;e.DocumentFragment;const i=e.HTMLTemplateElement,s=e.Node,l=e.Element,c=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,p=e.trustedTypes,m=l.prototype,h=Aa(m,"cloneNode"),f=Aa(m,"remove"),g=Aa(m,"removeAttributeNode"),y=Aa(m,"nextSibling"),E=Aa(m,"childNodes"),b=Aa(m,"parentNode"),S=Aa(m,"shadowRoot"),w=Aa(m,"attributes"),N=s&&s.prototype?Aa(s.prototype,"nodeType"):null,x=s&&s.prototype?Aa(s.prototype,"nodeName"):null,A=s&&s.prototype?Aa(s.prototype,"ownerDocument"):null,C=function($){return N?N($):$.nodeType},O=function($){return x?x($):$.nodeName};if(typeof i=="function"){const he=a.createElement("template");he.content&&he.content.ownerDocument&&(a=he.content.ownerDocument)}let k,T="",I,F=!1,z=0;const U=function(){if(z>0)throw Cr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},H=function($){U(),z++;try{return k.createHTML($)}finally{z--}},te=function($){U(),z++;try{return k.createScriptURL($)}finally{z--}},j=function(){return F||(I=e1(p,o),F=!0),I},_=a,P=_.implementation,G=_.createNodeIterator,W=_.createDocumentFragment,D=_.getElementsByTagName,ne=r.importNode;let q=Fm();t.isSupported=typeof Lg=="function"&&typeof b=="function"&&P&&P.createHTMLDocument!==void 0;const Z=US,ie=jS,ke=$S,me=BS,_e=HS,Je=VS,De=WS,ue=JS;let ye=zm,M=null;const Y=Tt({},[..._m,...Vl,...Wl,...Zl,...Pm]);let se=null;const Fe=Tt({},[...Om,...Jl,...Mm,...Gi]);let je=Object.seal(Qr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),oe=null,Ze=null;const it=Object.seal(Qr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let zt=!0,ct=!0,qt=!1,le=!0,fe=!1,xe=!0,ze=!1,Ye=!1,ht=null,bt=null,ft=!1,Ce=!1,gt=!1,Et=!1,vt=!0,at=!1;const X="user-content-";let Re=!0,ae=!1,Le={},Oe=null;const et=Tt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let st=null;const It=Tt({},["audio","video","img","source","image","track"]);let xt=null;const Ut=Tt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),rt="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml";let Nt=$e,Zt=!1,rn=null;const In=Tt({},[rt,Xe,$e],Hl),yn=Nn(["mi","mo","mn","ms","mtext"]);let Fn=Tt({},yn);const Gn=Nn(["annotation-xml"]);let An=Tt({},Gn);const Jt=Tt({},["title","style","font","a","script"]);let dn=null;const ut=["application/xhtml+xml","text/html"],ve="text/html";let ge=null,At=null;const Ot=a.createElement("form"),Kt=function($){return $ instanceof RegExp||$ instanceof Function},Q=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(At&&At===$)return;(!$||typeof $!="object")&&($={}),$=ba($),dn=ut.indexOf($.PARSER_MEDIA_TYPE)===-1?ve:$.PARSER_MEDIA_TYPE,ge=dn==="application/xhtml+xml"?Hl:si,M=sr($,"ALLOWED_TAGS",Y,{transform:ge}),se=sr($,"ALLOWED_ATTR",Fe,{transform:ge}),rn=sr($,"ALLOWED_NAMESPACES",In,{transform:Hl}),xt=sr($,"ADD_URI_SAFE_ATTR",Ut,{transform:ge,base:Ut}),st=sr($,"ADD_DATA_URI_TAGS",It,{transform:ge,base:It}),Oe=sr($,"FORBID_CONTENTS",et,{transform:ge}),oe=sr($,"FORBID_TAGS",ba({}),{transform:ge}),Ze=sr($,"FORBID_ATTR",ba({}),{transform:ge}),Le=oa($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?ba($.USE_PROFILES):$.USE_PROFILES:!1,zt=$.ALLOW_ARIA_ATTR!==!1,ct=$.ALLOW_DATA_ATTR!==!1,qt=$.ALLOW_UNKNOWN_PROTOCOLS||!1,le=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=$.SAFE_FOR_TEMPLATES||!1,xe=$.SAFE_FOR_XML!==!1,ze=$.WHOLE_DOCUMENT||!1,Ce=$.RETURN_DOM||!1,gt=$.RETURN_DOM_FRAGMENT||!1,Et=$.RETURN_TRUSTED_TYPE||!1,ft=$.FORCE_BODY||!1,vt=$.SANITIZE_DOM!==!1,at=$.SANITIZE_NAMED_PROPS||!1,Re=$.KEEP_CONTENT!==!1,ae=$.IN_PLACE||!1,ye=DS($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:zm,Nt=typeof $.NAMESPACE=="string"?$.NAMESPACE:$e,Fn=Kl($,"MATHML_TEXT_INTEGRATION_POINTS",()=>Tt({},yn)),An=Kl($,"HTML_INTEGRATION_POINTS",()=>Tt({},Gn));const ee=Kl($,"CUSTOM_ELEMENT_HANDLING",()=>Qr(null));if(je=Qr(null),oa(ee,"tagNameCheck")&&Kt(ee.tagNameCheck)&&(je.tagNameCheck=ee.tagNameCheck),oa(ee,"attributeNameCheck")&&Kt(ee.attributeNameCheck)&&(je.attributeNameCheck=ee.attributeNameCheck),oa(ee,"allowCustomizedBuiltInElements")&&typeof ee.allowCustomizedBuiltInElements=="boolean"&&(je.allowCustomizedBuiltInElements=ee.allowCustomizedBuiltInElements),Dn(je),fe&&(ct=!1),gt&&(Ce=!0),Le&&(M=Tt({},Pm),se=Qr(null),Le.html===!0&&(Tt(M,_m),Tt(se,Om)),Le.svg===!0&&(Tt(M,Vl),Tt(se,Jl),Tt(se,Gi)),Le.svgFilters===!0&&(Tt(M,Wl),Tt(se,Jl),Tt(se,Gi)),Le.mathMl===!0&&(Tt(M,Zl),Tt(se,Mm),Tt(se,Gi))),it.tagCheck=null,it.attributeCheck=null,oa($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?it.tagCheck=$.ADD_TAGS:oo($.ADD_TAGS)&&(M===Y&&(M=ba(M)),Tt(M,$.ADD_TAGS,ge))),oa($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?it.attributeCheck=$.ADD_ATTR:oo($.ADD_ATTR)&&(se===Fe&&(se=ba(se)),Tt(se,$.ADD_ATTR,ge))),oa($,"ADD_FORBID_CONTENTS")&&oo($.ADD_FORBID_CONTENTS)&&(Oe===et&&(Oe=ba(Oe)),Tt(Oe,$.ADD_FORBID_CONTENTS,ge)),Re&&(M["#text"]=!0),ze&&Tt(M,["html","head","body"]),M.table&&(Tt(M,["tbody"]),delete oe.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const pe=k;k=$.TRUSTED_TYPES_POLICY;try{T=H("")}catch(Me){throw k=pe,Me}}else $.TRUSTED_TYPES_POLICY===null?(k=void 0,T=""):(k===void 0&&(k=j()),k&&typeof T=="string"&&(T=H("")));Nn&&Nn($),At=$},Yt=Tt({},[...Vl,...Wl,...FS]),En=Tt({},[...Zl,...qS]),qn=function($,ee,pe){return ee.namespaceURI===$e?$==="svg":ee.namespaceURI===rt?$==="svg"&&(pe==="annotation-xml"||Fn[pe]):!!Yt[$]},pn=function($,ee,pe){return ee.namespaceURI===$e?$==="math":ee.namespaceURI===Xe?$==="math"&&An[pe]:!!En[$]},wn=function($,ee,pe){return ee.namespaceURI===Xe&&!An[pe]||ee.namespaceURI===rt&&!Fn[pe]?!1:!En[$]&&(Jt[$]||!Yt[$])},mn=function($){let ee=b($);(!ee||!ee.tagName)&&(ee={namespaceURI:Nt,tagName:"template"});const pe=si($.tagName),Me=si(ee.tagName);return rn[$.namespaceURI]?$.namespaceURI===Xe?qn(pe,ee,Me):$.namespaceURI===rt?pn(pe,ee,Me):$.namespaceURI===$e?wn(pe,ee,Me):!!(dn==="application/xhtml+xml"&&rn[$.namespaceURI]):!1},_n=function($){Ho(t.removed,{element:$});try{b($).removeChild($)}catch{if(f($),!b($))throw Cr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},on=function($,ee,pe){try{g($,ee)}catch{try{$.removeAttribute(pe)}catch{}}},pt=function($){we($);const ee=E($);if(ee){const Me=[];Ir(ee,Be=>{Ho(Me,Be)}),Ir(Me,Be=>{try{f(Be)}catch{}})}const pe=w($);if(pe)for(let Me=pe.length-1;Me>=0;--Me){const Be=pe[Me],ot=Be&&Be.name;typeof ot=="string"&&on($,Be,ot)}},mt=function($,ee,pe){if(!pe)try{pe=ee.getAttributeNode($)}catch{pe=null}Ho(t.removed,{attribute:pe||null,from:ee});try{pe?g(ee,pe):ee.removeAttribute($)}catch{try{ee.removeAttribute($)}catch{}}if($==="is")if(Ce||gt)try{_n(ee)}catch{}else try{ee.setAttribute($,"")}catch{}},V=function($){const ee=w($);if(ee)for(let pe=ee.length-1;pe>=0;--pe){const Me=ee[pe],Be=Me&&Me.name;typeof Be!="string"||se[ge(Be)]||on($,Me,Be)}},we=function($){const ee=[$];for(;ee.length>0;){const pe=ee.pop();C(pe)===fa.element&&V(pe);const Be=E(pe);if(Be)for(let ot=Be.length-1;ot>=0;--ot)ee.push(Be[ot])}},Ge=function($,ee){return xe?$==="patchsrc"?!0:$==="for"&&ee!=="label"&&ee!=="output":!1},Dt=function($){if(!xe)return;const ee=[$];for(;ee.length>0;){const pe=ee.pop(),Me=C(pe);if(Me===fa.processingInstruction||Me===fa.comment&&Hn(Dm,pe.data)){try{f(pe)}catch{}continue}if(Me===fa.element){const ot=pe,Ft=ge(O(pe));try{ot.hasAttribute&&ot.hasAttribute("patchsrc")&&ot.removeAttribute("patchsrc"),ot.hasAttribute&&ot.hasAttribute("for")&&Ge("for",Ft)&&ot.removeAttribute("for")}catch{}}const Be=E(pe);if(Be)for(let ot=Be.length-1;ot>=0;--ot)ee.push(Be[ot])}},kn=function($){let ee=null,pe=null;if(ft)$=""+$;else{const ot=Rm($,/^[\r\n\t ]+/);pe=ot&&ot[0]}dn==="application/xhtml+xml"&&Nt===$e&&($=''+$+"");const Me=k?H($):$;if(Nt===$e)try{ee=new d().parseFromString(Me,dn)}catch{}if(!ee||!ee.documentElement){ee=P.createDocument(Nt,"template",null);try{ee.documentElement.innerHTML=Zt?T:Me}catch{}}const Be=ee.body||ee.documentElement;return $&&pe&&Be.insertBefore(a.createTextNode(pe),Be.childNodes[0]||null),Nt===$e?D.call(ee,ze?"html":"body")[0]:ze?ee.documentElement:Be},sn=function($){const ee=A?A($):$.ownerDocument;return G.call(ee||$,$,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ca=function($){return $=Vo($,Z," "),$=Vo($,ie," "),$=Vo($,ke," "),$},Na=function($){var ee;$.normalize();const pe=A?A($):$.ownerDocument,Me=G.call(pe||$,$,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let Be=Me.nextNode();for(;Be;)Be.data=Ca(Be.data),Be=Me.nextNode();const ot=(ee=$.querySelectorAll)===null||ee===void 0?void 0:ee.call($,"template");ot&&Ir(ot,Ft=>{xn(Ft.content)&&Na(Ft.content)})},pa=function($){const ee=x?x($):null;return typeof ee!="string"||ge(ee)!=="form"?!1:typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||$.attributes!==w($)||typeof $.removeAttribute!="function"||typeof $.removeAttributeNode!="function"||typeof $.getAttributeNode!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function"||$.nodeType!==N($)||$.childNodes!==E($)},xn=function($){if(!N||typeof $!="object"||$===null)return!1;try{return N($)===fa.documentFragment}catch{return!1}},ta=function($){if(!N||typeof $!="object"||$===null)return!1;try{return typeof N($)=="number"}catch{return!1}};function Sn(he,$,ee){he.length!==0&&Ir(he,pe=>{pe.call(t,$,ee,At)})}const ma=function($,ee){return!!(xe&&$.hasChildNodes()&&!ta($.firstElementChild)&&Hn(Lm,$.textContent)&&Hn(Lm,$.innerHTML)||xe&&$.namespaceURI===$e&&GS[ee]&&(ta($.firstElementChild)||typeof $.textContent=="string"&&Hn(QS[ee],$.textContent))||$.nodeType===fa.processingInstruction||xe&&$.nodeType===fa.comment&&Hn(Dm,$.data))},na=function($,ee){if($ instanceof RegExp)return Hn($,ee);if($ instanceof Function){for(var pe=arguments.length,Me=new Array(pe>2?pe-2:0),Be=2;Be=0;--Ft){const Gt=$===pe?h(Be[Ft],!0):Be[Ft];Me.insertBefore(Gt,y($))}}}return _n($),!0},Qa=function($,ee,pe,Me){return $.length===0?ee:ee===pe||ee===Me?ba(ee):ee},Xa=function($,ee){return $===ee||b($)!==null?!1:(ae&&we($),!0)},aa=function($,ee){if(Sn(q.beforeSanitizeElements,$,null),Xa($,ee))return!0;if(pa($))return _n($),!0;const pe=ge(O($));if(M=Qa(q.uponSanitizeElement,M,Y,ht),Sn(q.uponSanitizeElement,$,{tagName:pe,allowedTags:M}),Xa($,ee))return!0;if(ma($,pe))return _n($),!0;if(oe[pe]||!(it.tagCheck instanceof Function&&it.tagCheck(pe))&&!M[pe]){const Be=Ga($,pe,ee);return Be===!1&&Sn(q.afterSanitizeElements,$,null),Be}if(C($)===fa.element&&!mn($)||(pe==="noscript"||pe==="noembed"||pe==="noframes")&&Hn(KS,$.innerHTML))return _n($),!0;if(fe&&$.nodeType===fa.text){const Be=Ca($.textContent);$.textContent!==Be&&(Ho(t.removed,{element:$.cloneNode()}),$.textContent=Be)}return Sn(q.afterSanitizeElements,$,null),!1},Cn=function($,ee,pe){if(Ze[ee]||Ge(ee,$)||vt&&(ee==="id"||ee==="name")&&(pe in a||pe in Ot))return!1;const Me=se[ee]||it.attributeCheck instanceof Function&&it.attributeCheck(ee,$);return ct&&Hn(me,ee)||zt&&Hn(_e,ee)?!0:Me?xt[ee]||Hn(ye,Vo(pe,De,""))||(ee==="src"||ee==="xlink:href"||ee==="href")&&$!=="script"&&Tm(pe,"data:")===0&&st[$]||qt&&!Hn(Je,Vo(pe,De,""))?!0:!pe:ha($)&&na(je.tagNameCheck,$)&&na(je.attributeNameCheck,ee,$)||ee==="is"&&je.allowCustomizedBuiltInElements&&na(je.tagNameCheck,pe)},ir=Tt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ha=function($){return!ir[si($)]&&Hn(ue,$)},Ra=function($,ee,pe,Me){if(k&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!pe)switch(p.getAttributeType($,ee)){case"TrustedHTML":return H(Me);case"TrustedScriptURL":return te(Me)}return Me},ln=function($,ee,pe,Me){try{return pe?$.setAttributeNS(pe,ee,Me):$.setAttribute(ee,Me),pa($)?(_n($),!1):!0}catch{return mt(ee,$),!1}},Qn=function($){Sn(q.beforeSanitizeAttributes,$,null);const ee=$.attributes;if(!ee||pa($))return;se=Qa(q.uponSanitizeAttribute,se,Fe,bt);const pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let Me=ee.length;const Be=ge($.nodeName);for(;Me--;){const ot=ee[Me],Ft=ot.name,Gt=ot.namespaceURI,Un=ot.value,jn=ge(Ft),Yr=Un;let Pn=Ft==="value"?Yr:_S(Yr),qo=!1;if(pe.attrName=jn,pe.attrValue=Pn,pe.keepAttr=!0,pe.forceKeepAttr=void 0,Sn(q.uponSanitizeAttribute,$,pe),Pn=pe.attrValue,at&&(jn==="id"||jn==="name")&&Tm(Pn,X)!==0&&(mt(Ft,$,ot),Pn=X+Pn,qo=!0),xe&&Hn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pn)){mt(Ft,$,ot);continue}if(jn==="attributename"&&Rm(Pn,"href")){mt(Ft,$,ot);continue}if(!pe.forceKeepAttr){if(!pe.keepAttr){mt(Ft,$,ot);continue}if(!le&&Hn(YS,Pn)){mt(Ft,$,ot);continue}if(fe&&(Pn=Ca(Pn)),!Cn(Be,jn,Pn)){mt(Ft,$,ot);continue}Pn=Ra(Be,jn,Gt,Pn),Pn!==Yr&&ln($,Ft,Gt,Pn)&&qo&&Nm(t.removed)}}Sn(q.afterSanitizeAttributes,$,null)},ja=function($){let ee=null;const pe=sn($);for(Sn(q.beforeSanitizeShadowDOM,$,null);ee=pe.nextNode();)if(Sn(q.uponSanitizeShadowNode,ee,null),aa(ee,$),Qn(ee),xn(ee.content)&&ja(ee.content),C(ee)===fa.element){const Me=S(ee);xn(Me)&&(cn(Me),ja(Me))}Sn(q.afterSanitizeShadowDOM,$,null)},cn=function($){const ee=[{node:$,shadow:null}];for(;ee.length>0;){const pe=ee.pop();if(pe.shadow){ja(pe.shadow);continue}const Me=pe.node,ot=C(Me)===fa.element,Ft=E(Me);if(Ft)for(let Gt=Ft.length-1;Gt>=0;--Gt)ee.push({node:Ft[Gt],shadow:null});if(ot){const Gt=x?x(Me):null;if(typeof Gt=="string"&&ge(Gt)==="template"){const Un=Me.content;xn(Un)&&ee.push({node:Un,shadow:null})}}if(ot){const Gt=S(Me);xn(Gt)&&ee.push({node:null,shadow:Gt},{node:Gt,shadow:null})}}};return t.sanitize=function(he){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ee=null,pe=null,Me=null,Be=null;if(Zt=!he,Zt&&(he=""),typeof he!="string"&&!ta(he)&&(he=LS(he),typeof he!="string"))throw Cr("dirty is not a string, aborting");if(!t.isSupported)return he;Ye?(M=ht,se=bt):Q($),(q.uponSanitizeElement.length>0||q.uponSanitizeAttribute.length>0)&&(M=ba(M)),q.uponSanitizeAttribute.length>0&&(se=ba(se)),t.removed=[];const ot=ae&&typeof he!="string"&&ta(he);if(ot){Dt(he);const Un=O(he);if(typeof Un=="string"){const jn=ge(Un);if(!M[jn]||oe[jn])throw pt(he),Cr("root node is forbidden and cannot be sanitized in-place")}if(pa(he))throw pt(he),Cr("root node is clobbered and cannot be sanitized in-place");try{cn(he)}catch(jn){throw pt(he),jn}}else if(ta(he))ee=kn(""),pe=ee.ownerDocument.importNode(he,!0),pe.nodeType===fa.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?ee=pe:ee.appendChild(pe),cn(ee);else{if(!Ce&&!fe&&!ze&&he.indexOf("<")===-1)return k&&Et?H(he):he;if(ee=kn(he),!ee)return Ce?null:Et?T:""}ee&&ft&&_n(ee.firstChild);const Ft=ot?he:ee;try{const Un=sn(Ft);for(;Me=Un.nextNode();)aa(Me,Ft),Qn(Me),xn(Me.content)&&ja(Me.content)}catch(Un){throw ot&&(pt(he),Ir(t.removed,jn=>{jn.element&&we(jn.element)})),Un}if(ot)return Ir(t.removed,Un=>{Un.element&&we(Un.element)}),fe&&Na(he),he;if(Ce){if(fe&&Na(ee),gt)for(Be=W.call(ee.ownerDocument);ee.firstChild;)Be.appendChild(ee.firstChild);else Be=ee;return(se.shadowroot||se.shadowrootmode)&&(Be=ne.call(r,Be,!0)),Be}let Gt=ze?ee.outerHTML:ee.innerHTML;return ze&&M["!doctype"]&&ee.ownerDocument&&ee.ownerDocument.doctype&&ee.ownerDocument.doctype.name&&Hn(ZS,ee.ownerDocument.doctype.name)&&(Gt=" -`+Gt),fe&&(Gt=Ca(Gt)),k&&Et?H(Gt):Gt},t.setConfig=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Q(he),Ye=!0,ht=M,bt=se},t.clearConfig=function(){At=null,Ye=!1,ht=null,bt=null,k=I,T=""},t.isValidAttribute=function(he,$,ee){At||Q({});const pe=ge(he),Me=ge($);return Cn(pe,Me,ee)},t.addHook=function(he,$){typeof $=="function"&&oa(q,he)&&Ho(q[he],$)},t.removeHook=function(he,$){if(oa(q,he)){if($!==void 0){const ee=IS(q[he],$);return ee===-1?void 0:AS(q[he],ee,1)[0]}return Nm(q[he])}},t.removeHooks=function(he){oa(q,he)&&(q[he]=[])},t.removeAllHooks=function(){q=Fm()},t}var t1=qg();function n1(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const a1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,r1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o1={};function qm(e,t){return(o1.jsx?r1:a1).test(e)}const i1=/[ \t\n\f\r]/g;function s1(e){return typeof e=="object"?e.type==="text"?Um(e.value):!1:Um(e)}function Um(e){return e.replace(i1,"")===""}class Bi{constructor(t,a,r){this.normal=a,this.property=t,r&&(this.space=r)}}Bi.prototype.normal={};Bi.prototype.property={};Bi.prototype.space=void 0;function Ug(e,t){const a={},r={};for(const o of e)Object.assign(a,o.property),Object.assign(r,o.normal);return new Bi(a,r,t)}function Gc(e){return e.toLowerCase()}class la{constructor(t,a){this.attribute=a,this.property=t}}la.prototype.attribute="";la.prototype.booleanish=!1;la.prototype.boolean=!1;la.prototype.commaOrSpaceSeparated=!1;la.prototype.commaSeparated=!1;la.prototype.defined=!1;la.prototype.mustUseProperty=!1;la.prototype.number=!1;la.prototype.overloadedBoolean=!1;la.prototype.property="";la.prototype.spaceSeparated=!1;la.prototype.space=void 0;let l1=0;const dt=Wr(),hn=Wr(),Qc=Wr(),Se=Wr(),$t=Wr(),Mr=Wr(),va=Wr();function Wr(){return 2**++l1}const Xc=Object.freeze(Object.defineProperty({__proto__:null,boolean:dt,booleanish:hn,commaOrSpaceSeparated:va,commaSeparated:Mr,number:Se,overloadedBoolean:Qc,spaceSeparated:$t},Symbol.toStringTag,{value:"Module"})),Yl=Object.keys(Xc);class Xu extends la{constructor(t,a,r,o){let i=-1;if(super(t,a),jm(this,"space",o),typeof r=="number")for(;++i4&&a.slice(0,4)==="data"&&m1.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($m,g1);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$m.test(i)){let s=i.replace(p1,f1);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=Xu}return new o(r,t)}function f1(e){return"-"+e.toLowerCase()}function g1(e){return e.charAt(1).toUpperCase()}const v1=Ug([jg,c1,Hg,Vg,Wg],"html"),ed=Ug([jg,u1,Hg,Vg,Wg],"svg");function b1(e){return e.join(" ").trim()}var Gr={},Gl,Bm;function y1(){if(Bm)return Gl;Bm=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,a=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,l=/^\s+|\s+$/g,c=` -`,u="/",d="*",p="",m="comment",h="declaration";function f(y,E){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];E=E||{};var b=1,S=1;function w(z){var U=z.match(t);U&&(b+=U.length);var H=z.lastIndexOf(c);S=~H?z.length-H:S+z.length}function N(){var z={line:b,column:S};return function(U){return U.position=new x(z),O(),U}}function x(z){this.start=z,this.end={line:b,column:S},this.source=E.source}x.prototype.content=y;function A(z){var U=new Error(E.source+":"+b+":"+S+": "+z);if(U.reason=z,U.filename=E.source,U.line=b,U.column=S,U.source=y,!E.silent)throw U}function C(z){var U=z.exec(y);if(U){var H=U[0];return w(H),y=y.slice(H.length),U}}function O(){C(a)}function k(z){var U;for(z=z||[];U=T();)U!==!1&&z.push(U);return z}function T(){var z=N();if(!(u!=y.charAt(0)||d!=y.charAt(1))){for(var U=2;p!=y.charAt(U)&&(d!=y.charAt(U)||u!=y.charAt(U+1));)++U;if(U+=2,p===y.charAt(U-1))return A("End of comment missing");var H=y.slice(2,U-2);return S+=2,w(H),y=y.slice(U),S+=2,z({type:m,comment:H})}}function I(){var z=N(),U=C(r);if(U){if(T(),!C(o))return A("property missing ':'");var H=C(i),te=z({type:h,property:g(U[0].replace(e,p)),value:H?g(H[0].replace(e,p)):p});return C(s),te}}function F(){var z=[];k(z);for(var U;U=I();)U!==!1&&(z.push(U),k(z));return z}return O(),F()}function g(y){return y?y.replace(l,p):p}return Gl=f,Gl}var Hm;function E1(){if(Hm)return Gr;Hm=1;var e=Gr&&Gr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.default=a;const t=e(y1());function a(r,o){let i=null;if(!r||typeof r!="string")return i;const s=(0,t.default)(r),l=typeof o=="function";return s.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?o(u,d,c):d&&(i=i||{},i[u]=d)}),i}return Gr}var Zo={},Vm;function w1(){if(Vm)return Zo;Vm=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,a=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(u){return!u||a.test(u)||e.test(u)},s=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,l):u=u.replace(r,l),u.replace(t,s))};return Zo.camelCase=c,Zo}var Jo,Wm;function k1(){if(Wm)return Jo;Wm=1;var e=Jo&&Jo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(E1()),a=w1();function r(o,i){var s={};return!o||typeof o!="string"||(0,t.default)(o,function(l,c){l&&c&&(s[(0,a.camelCase)(l,i)]=c)}),s}return r.default=r,Jo=r,Jo}var x1=k1();const S1=og(x1),Zg=Jg("end"),td=Jg("start");function Jg(e){return t;function t(a){const r=a&&a.position&&a.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function C1(e){const t=td(e),a=Zg(e);if(t&&a)return{start:t,end:a}}function mi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Zm(e.position):"start"in e||"end"in e?Zm(e):"line"in e||"column"in e?eu(e):""}function eu(e){return Jm(e&&e.line)+":"+Jm(e&&e.column)}function Zm(e){return eu(e&&e.start)+"-"+eu(e&&e.end)}function Jm(e){return e&&typeof e=="number"?e:1}class Kn extends Error{constructor(t,a,r){super(),typeof a=="string"&&(r=a,a=void 0);let o="",i={},s=!1;if(a&&("line"in a&&"column"in a?i={place:a}:"start"in a&&"end"in a?i={place:a}:"type"in a?i={ancestors:[a],place:a.position}:i={...a}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=mi(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Kn.prototype.file="";Kn.prototype.name="";Kn.prototype.reason="";Kn.prototype.message="";Kn.prototype.stack="";Kn.prototype.column=void 0;Kn.prototype.line=void 0;Kn.prototype.ancestors=void 0;Kn.prototype.cause=void 0;Kn.prototype.fatal=void 0;Kn.prototype.place=void 0;Kn.prototype.ruleId=void 0;Kn.prototype.source=void 0;const nd={}.hasOwnProperty,N1=new Map,R1=/[A-Z]/g,T1=new Set(["table","tbody","thead","tfoot","tr"]),I1=new Set(["td","th"]),Kg="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function A1(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=F1(a,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=D1(a,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ed:v1,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Yg(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function Yg(e,t,a){if(t.type==="element")return _1(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return P1(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return M1(e,t,a);if(t.type==="mdxjsEsm")return O1(e,t);if(t.type==="root")return z1(e,t,a);if(t.type==="text")return L1(e,t)}function _1(e,t,a){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=ed,e.schema=o),e.ancestors.push(t);const i=Qg(e,t.tagName,!1),s=q1(e,t);let l=rd(e,t);return T1.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!s1(c):!0})),Gg(e,s,i,t),ad(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,a)}function P1(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ki(e,t.position)}function O1(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ki(e,t.position)}function M1(e,t,a){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=ed,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:Qg(e,t.name,!0),s=U1(e,t),l=rd(e,t);return Gg(e,s,i,t),ad(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,a)}function z1(e,t,a){const r={};return ad(r,rd(e,t)),e.create(t,e.Fragment,r,a)}function L1(e,t){return t.value}function Gg(e,t,a,r){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=r)}function ad(e,t){if(t.length>0){const a=t.length>1?t:t[0];a&&(e.children=a)}}function D1(e,t,a){return r;function r(o,i,s,l){const u=Array.isArray(s.children)?a:t;return l?u(i,s,l):u(i,s)}}function F1(e,t){return a;function a(r,o,i,s){const l=Array.isArray(i.children),c=td(r);return t(o,i,s,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function q1(e,t){const a={};let r,o;for(o in t.properties)if(o!=="children"&&nd.call(t.properties,o)){const i=j1(e,o,t.properties[o]);if(i){const[s,l]=i;e.tableCellAlignToStyle&&s==="align"&&typeof l=="string"&&I1.has(t.tagName)?r=l:a[s]=l}}if(r){const i=a.style||(a.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return a}function U1(e,t){const a={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const l=s.properties[0];l.type,Object.assign(a,e.evaluater.evaluateExpression(l.argument))}else ki(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else ki(e,t.position);else i=r.value===null?!0:r.value;a[o]=i}return a}function rd(e,t){const a=[];let r=-1;const o=e.passKeys?new Map:N1;for(;++rxm)return{error:`Select at most ${xm.toLocaleString()} characters to reference.`};const i=e.ownerDocument,s=i.createElement("textarea"),l=g=>(s.innerHTML=g,s.value),c=i.createTreeWalker(e,4),u=[];let d;for(;d=c.nextNode();){if(!r.intersectsNode(d))continue;const g=d===r.startContainer?r.startOffset:0,E=d===r.endContainer?r.endOffset:d.length;if(E<=g)continue;const y=(f=d.parentElement)==null?void 0:f.closest("[data-canvas-source-start]");if(!y||!e.contains(y)||y.textContent!==d.textContent){if(d.textContent.slice(g,E).trim())return{error:"Select document text without embedded controls or diagrams."};continue}const b=Number(y.dataset.canvasSourceStart),S=Number(y.dataset.canvasSourceEnd),w=y.dataset.canvasLiteral==="true",N=a.slice(b,S),x=w||N===d.textContent,A=x?null:yS(N,!1,l);if((x?N:A.text)!==d.textContent)return{error:"This selection cannot be mapped to the saved source. Select a smaller text passage."};u.push({start:b+(x?g:A.offsets[g]),end:b+(x?E:A.offsets[E]),...w?{literal:!0}:{}})}if(!u.length)return null;if(u.length>128)return{error:"Select a smaller passage to reference."};let p=0,m=0;const h=g=>{for(;p65535?2:1,m++;return m};for(const g of u)g.start=h(g.start),g.end=h(g.end);return{excerpt:o,spans:u}}/*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */function Sm(e,t){(t==null||t>e.length)&&(t=e.length);for(var a=0,r=Array(t);a2?r-2:0),i=2;i1?a-1:0),o=1;o"u"?null:gn(BigInt.prototype.toString),Am=typeof Symbol>"u"?null:gn(Symbol.prototype.toString),oa=gn(Object.prototype.hasOwnProperty),Wo=gn(Object.prototype.toString),Hn=gn(RegExp.prototype.test),Cr=MS(TypeError);function gn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:si;if(Cm&&Cm(e,null),!oo(t))return e;let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=a(o);i!==o&&(NS(t)||(t[r]=i),o=i)}e[o]=!0}return e}function zS(e){for(let t=0;t/g),$S=Dn(/\${[\w\W]*/g),BS=Dn(/^data-[\-\w.\u00B7-\uFFFF]+$/),HS=Dn(/^aria-[\-\w]+$/),zm=Dn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VS=Dn(/^(?:\w+script|data):/i),WS=Dn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ZS=Dn(/^html$/i),JS=Dn(/^[a-z][.\w]*(-[.\w]+)+$/i),Lm=Dn(/<[/\w!]/g),Dm=Dn(/<[/\w]/g),KS=Dn(/<\/no(script|embed|frames)/i),YS=Dn(/\/>/i),fa={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Fg=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],GS=Nn(Tt({},Fg)),QS=(function(){const e={};return Ir(Fg,t=>{e[t]=Dn(new RegExp("])","i"))}),Nn(e)})(),XS=function(){return typeof window>"u"?null:window},e1=function(t,a){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";a&&a.hasAttribute(o)&&(r=a.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Fm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},sr=function(t,a,r,o){return oa(t,a)&&oo(t[a])?Tt(o.base?ba(o.base):{},t[a],o.transform):r},Kl=function(t,a,r){const o=oa(t,a)?t[a]:void 0;return o&&typeof o=="object"?ba(o):r()};function qg(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XS();const t=he=>qg(he);if(t.version="3.4.15",t.removed=[],!e||!e.document||e.document.nodeType!==fa.document||!e.Element)return t.isSupported=!1,t;let a=e.document;const r=a,o=r.currentScript;e.DocumentFragment;const i=e.HTMLTemplateElement,s=e.Node,l=e.Element,c=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,p=e.trustedTypes,m=l.prototype,h=Aa(m,"cloneNode"),f=Aa(m,"remove"),g=Aa(m,"removeAttributeNode"),E=Aa(m,"nextSibling"),y=Aa(m,"childNodes"),b=Aa(m,"parentNode"),S=Aa(m,"shadowRoot"),w=Aa(m,"attributes"),N=s&&s.prototype?Aa(s.prototype,"nodeType"):null,x=s&&s.prototype?Aa(s.prototype,"nodeName"):null,A=s&&s.prototype?Aa(s.prototype,"ownerDocument"):null,C=function($){return N?N($):$.nodeType},O=function($){return x?x($):$.nodeName};if(typeof i=="function"){const he=a.createElement("template");he.content&&he.content.ownerDocument&&(a=he.content.ownerDocument)}let k,T="",I,F=!1,z=0;const q=function(){if(z>0)throw Cr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},W=function($){q(),z++;try{return k.createHTML($)}finally{z--}},X=function($){q(),z++;try{return k.createScriptURL($)}finally{z--}},U=function(){return F||(I=e1(p,o),F=!0),I},_=a,P=_.implementation,G=_.createNodeIterator,Z=_.createDocumentFragment,D=_.getElementsByTagName,ne=r.importNode;let H=Fm();t.isSupported=typeof Lg=="function"&&typeof b=="function"&&P&&P.createHTMLDocument!==void 0;const j=US,ie=jS,Ee=$S,me=BS,_e=HS,Je=VS,De=WS,ue=JS;let ye=zm,M=null;const Y=Tt({},[..._m,...Vl,...Wl,...Zl,...Pm]);let se=null;const Fe=Tt({},[...Om,...Jl,...Mm,...Gi]);let je=Object.seal(Qr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),oe=null,Ze=null;const it=Object.seal(Qr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let zt=!0,ct=!0,qt=!1,le=!0,fe=!1,xe=!0,ze=!1,Ye=!1,ht=null,bt=null,ft=!1,Ce=!1,gt=!1,Et=!1,vt=!0,at=!1;const ee="user-content-";let Re=!0,ae=!1,Le={},Oe=null;const et=Tt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let st=null;const It=Tt({},["audio","video","img","source","image","track"]);let xt=null;const Ut=Tt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),rt="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml";let Nt=$e,Zt=!1,rn=null;const In=Tt({},[rt,Xe,$e],Hl),yn=Nn(["mi","mo","mn","ms","mtext"]);let Fn=Tt({},yn);const Gn=Nn(["annotation-xml"]);let An=Tt({},Gn);const Jt=Tt({},["title","style","font","a","script"]);let dn=null;const ut=["application/xhtml+xml","text/html"],ve="text/html";let ge=null,At=null;const Ot=a.createElement("form"),Kt=function($){return $ instanceof RegExp||$ instanceof Function},Q=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(At&&At===$)return;(!$||typeof $!="object")&&($={}),$=ba($),dn=ut.indexOf($.PARSER_MEDIA_TYPE)===-1?ve:$.PARSER_MEDIA_TYPE,ge=dn==="application/xhtml+xml"?Hl:si,M=sr($,"ALLOWED_TAGS",Y,{transform:ge}),se=sr($,"ALLOWED_ATTR",Fe,{transform:ge}),rn=sr($,"ALLOWED_NAMESPACES",In,{transform:Hl}),xt=sr($,"ADD_URI_SAFE_ATTR",Ut,{transform:ge,base:Ut}),st=sr($,"ADD_DATA_URI_TAGS",It,{transform:ge,base:It}),Oe=sr($,"FORBID_CONTENTS",et,{transform:ge}),oe=sr($,"FORBID_TAGS",ba({}),{transform:ge}),Ze=sr($,"FORBID_ATTR",ba({}),{transform:ge}),Le=oa($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?ba($.USE_PROFILES):$.USE_PROFILES:!1,zt=$.ALLOW_ARIA_ATTR!==!1,ct=$.ALLOW_DATA_ATTR!==!1,qt=$.ALLOW_UNKNOWN_PROTOCOLS||!1,le=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=$.SAFE_FOR_TEMPLATES||!1,xe=$.SAFE_FOR_XML!==!1,ze=$.WHOLE_DOCUMENT||!1,Ce=$.RETURN_DOM||!1,gt=$.RETURN_DOM_FRAGMENT||!1,Et=$.RETURN_TRUSTED_TYPE||!1,ft=$.FORCE_BODY||!1,vt=$.SANITIZE_DOM!==!1,at=$.SANITIZE_NAMED_PROPS||!1,Re=$.KEEP_CONTENT!==!1,ae=$.IN_PLACE||!1,ye=DS($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:zm,Nt=typeof $.NAMESPACE=="string"?$.NAMESPACE:$e,Fn=Kl($,"MATHML_TEXT_INTEGRATION_POINTS",()=>Tt({},yn)),An=Kl($,"HTML_INTEGRATION_POINTS",()=>Tt({},Gn));const te=Kl($,"CUSTOM_ELEMENT_HANDLING",()=>Qr(null));if(je=Qr(null),oa(te,"tagNameCheck")&&Kt(te.tagNameCheck)&&(je.tagNameCheck=te.tagNameCheck),oa(te,"attributeNameCheck")&&Kt(te.attributeNameCheck)&&(je.attributeNameCheck=te.attributeNameCheck),oa(te,"allowCustomizedBuiltInElements")&&typeof te.allowCustomizedBuiltInElements=="boolean"&&(je.allowCustomizedBuiltInElements=te.allowCustomizedBuiltInElements),Dn(je),fe&&(ct=!1),gt&&(Ce=!0),Le&&(M=Tt({},Pm),se=Qr(null),Le.html===!0&&(Tt(M,_m),Tt(se,Om)),Le.svg===!0&&(Tt(M,Vl),Tt(se,Jl),Tt(se,Gi)),Le.svgFilters===!0&&(Tt(M,Wl),Tt(se,Jl),Tt(se,Gi)),Le.mathMl===!0&&(Tt(M,Zl),Tt(se,Mm),Tt(se,Gi))),it.tagCheck=null,it.attributeCheck=null,oa($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?it.tagCheck=$.ADD_TAGS:oo($.ADD_TAGS)&&(M===Y&&(M=ba(M)),Tt(M,$.ADD_TAGS,ge))),oa($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?it.attributeCheck=$.ADD_ATTR:oo($.ADD_ATTR)&&(se===Fe&&(se=ba(se)),Tt(se,$.ADD_ATTR,ge))),oa($,"ADD_FORBID_CONTENTS")&&oo($.ADD_FORBID_CONTENTS)&&(Oe===et&&(Oe=ba(Oe)),Tt(Oe,$.ADD_FORBID_CONTENTS,ge)),Re&&(M["#text"]=!0),ze&&Tt(M,["html","head","body"]),M.table&&(Tt(M,["tbody"]),delete oe.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const pe=k;k=$.TRUSTED_TYPES_POLICY;try{T=W("")}catch(Me){throw k=pe,Me}}else $.TRUSTED_TYPES_POLICY===null?(k=void 0,T=""):(k===void 0&&(k=U()),k&&typeof T=="string"&&(T=W("")));Nn&&Nn($),At=$},Yt=Tt({},[...Vl,...Wl,...FS]),En=Tt({},[...Zl,...qS]),qn=function($,te,pe){return te.namespaceURI===$e?$==="svg":te.namespaceURI===rt?$==="svg"&&(pe==="annotation-xml"||Fn[pe]):!!Yt[$]},pn=function($,te,pe){return te.namespaceURI===$e?$==="math":te.namespaceURI===Xe?$==="math"&&An[pe]:!!En[$]},wn=function($,te,pe){return te.namespaceURI===Xe&&!An[pe]||te.namespaceURI===rt&&!Fn[pe]?!1:!En[$]&&(Jt[$]||!Yt[$])},mn=function($){let te=b($);(!te||!te.tagName)&&(te={namespaceURI:Nt,tagName:"template"});const pe=si($.tagName),Me=si(te.tagName);return rn[$.namespaceURI]?$.namespaceURI===Xe?qn(pe,te,Me):$.namespaceURI===rt?pn(pe,te,Me):$.namespaceURI===$e?wn(pe,te,Me):!!(dn==="application/xhtml+xml"&&rn[$.namespaceURI]):!1},_n=function($){Ho(t.removed,{element:$});try{b($).removeChild($)}catch{if(f($),!b($))throw Cr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},on=function($,te,pe){try{g($,te)}catch{try{$.removeAttribute(pe)}catch{}}},pt=function($){ke($);const te=y($);if(te){const Me=[];Ir(te,Be=>{Ho(Me,Be)}),Ir(Me,Be=>{try{f(Be)}catch{}})}const pe=w($);if(pe)for(let Me=pe.length-1;Me>=0;--Me){const Be=pe[Me],ot=Be&&Be.name;typeof ot=="string"&&on($,Be,ot)}},mt=function($,te,pe){if(!pe)try{pe=te.getAttributeNode($)}catch{pe=null}Ho(t.removed,{attribute:pe||null,from:te});try{pe?g(te,pe):te.removeAttribute($)}catch{try{te.removeAttribute($)}catch{}}if($==="is")if(Ce||gt)try{_n(te)}catch{}else try{te.setAttribute($,"")}catch{}},V=function($){const te=w($);if(te)for(let pe=te.length-1;pe>=0;--pe){const Me=te[pe],Be=Me&&Me.name;typeof Be!="string"||se[ge(Be)]||on($,Me,Be)}},ke=function($){const te=[$];for(;te.length>0;){const pe=te.pop();C(pe)===fa.element&&V(pe);const Be=y(pe);if(Be)for(let ot=Be.length-1;ot>=0;--ot)te.push(Be[ot])}},Ge=function($,te){return xe?$==="patchsrc"?!0:$==="for"&&te!=="label"&&te!=="output":!1},Dt=function($){if(!xe)return;const te=[$];for(;te.length>0;){const pe=te.pop(),Me=C(pe);if(Me===fa.processingInstruction||Me===fa.comment&&Hn(Dm,pe.data)){try{f(pe)}catch{}continue}if(Me===fa.element){const ot=pe,Ft=ge(O(pe));try{ot.hasAttribute&&ot.hasAttribute("patchsrc")&&ot.removeAttribute("patchsrc"),ot.hasAttribute&&ot.hasAttribute("for")&&Ge("for",Ft)&&ot.removeAttribute("for")}catch{}}const Be=y(pe);if(Be)for(let ot=Be.length-1;ot>=0;--ot)te.push(Be[ot])}},kn=function($){let te=null,pe=null;if(ft)$=""+$;else{const ot=Rm($,/^[\r\n\t ]+/);pe=ot&&ot[0]}dn==="application/xhtml+xml"&&Nt===$e&&($=''+$+"");const Me=k?W($):$;if(Nt===$e)try{te=new d().parseFromString(Me,dn)}catch{}if(!te||!te.documentElement){te=P.createDocument(Nt,"template",null);try{te.documentElement.innerHTML=Zt?T:Me}catch{}}const Be=te.body||te.documentElement;return $&&pe&&Be.insertBefore(a.createTextNode(pe),Be.childNodes[0]||null),Nt===$e?D.call(te,ze?"html":"body")[0]:ze?te.documentElement:Be},sn=function($){const te=A?A($):$.ownerDocument;return G.call(te||$,$,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ca=function($){return $=Vo($,j," "),$=Vo($,ie," "),$=Vo($,Ee," "),$},Na=function($){var te;$.normalize();const pe=A?A($):$.ownerDocument,Me=G.call(pe||$,$,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let Be=Me.nextNode();for(;Be;)Be.data=Ca(Be.data),Be=Me.nextNode();const ot=(te=$.querySelectorAll)===null||te===void 0?void 0:te.call($,"template");ot&&Ir(ot,Ft=>{xn(Ft.content)&&Na(Ft.content)})},pa=function($){const te=x?x($):null;return typeof te!="string"||ge(te)!=="form"?!1:typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||$.attributes!==w($)||typeof $.removeAttribute!="function"||typeof $.removeAttributeNode!="function"||typeof $.getAttributeNode!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function"||$.nodeType!==N($)||$.childNodes!==y($)},xn=function($){if(!N||typeof $!="object"||$===null)return!1;try{return N($)===fa.documentFragment}catch{return!1}},ta=function($){if(!N||typeof $!="object"||$===null)return!1;try{return typeof N($)=="number"}catch{return!1}};function Sn(he,$,te){he.length!==0&&Ir(he,pe=>{pe.call(t,$,te,At)})}const ma=function($,te){return!!(xe&&$.hasChildNodes()&&!ta($.firstElementChild)&&Hn(Lm,$.textContent)&&Hn(Lm,$.innerHTML)||xe&&$.namespaceURI===$e&&GS[te]&&(ta($.firstElementChild)||typeof $.textContent=="string"&&Hn(QS[te],$.textContent))||$.nodeType===fa.processingInstruction||xe&&$.nodeType===fa.comment&&Hn(Dm,$.data))},na=function($,te){if($ instanceof RegExp)return Hn($,te);if($ instanceof Function){for(var pe=arguments.length,Me=new Array(pe>2?pe-2:0),Be=2;Be=0;--Ft){const Gt=$===pe?h(Be[Ft],!0):Be[Ft];Me.insertBefore(Gt,E($))}}}return _n($),!0},Qa=function($,te,pe,Me){return $.length===0?te:te===pe||te===Me?ba(te):te},Xa=function($,te){return $===te||b($)!==null?!1:(ae&&ke($),!0)},aa=function($,te){if(Sn(H.beforeSanitizeElements,$,null),Xa($,te))return!0;if(pa($))return _n($),!0;const pe=ge(O($));if(M=Qa(H.uponSanitizeElement,M,Y,ht),Sn(H.uponSanitizeElement,$,{tagName:pe,allowedTags:M}),Xa($,te))return!0;if(ma($,pe))return _n($),!0;if(oe[pe]||!(it.tagCheck instanceof Function&&it.tagCheck(pe))&&!M[pe]){const Be=Ga($,pe,te);return Be===!1&&Sn(H.afterSanitizeElements,$,null),Be}if(C($)===fa.element&&!mn($)||(pe==="noscript"||pe==="noembed"||pe==="noframes")&&Hn(KS,$.innerHTML))return _n($),!0;if(fe&&$.nodeType===fa.text){const Be=Ca($.textContent);$.textContent!==Be&&(Ho(t.removed,{element:$.cloneNode()}),$.textContent=Be)}return Sn(H.afterSanitizeElements,$,null),!1},Cn=function($,te,pe){if(Ze[te]||Ge(te,$)||vt&&(te==="id"||te==="name")&&(pe in a||pe in Ot))return!1;const Me=se[te]||it.attributeCheck instanceof Function&&it.attributeCheck(te,$);return ct&&Hn(me,te)||zt&&Hn(_e,te)?!0:Me?xt[te]||Hn(ye,Vo(pe,De,""))||(te==="src"||te==="xlink:href"||te==="href")&&$!=="script"&&Tm(pe,"data:")===0&&st[$]||qt&&!Hn(Je,Vo(pe,De,""))?!0:!pe:ha($)&&na(je.tagNameCheck,$)&&na(je.attributeNameCheck,te,$)||te==="is"&&je.allowCustomizedBuiltInElements&&na(je.tagNameCheck,pe)},ir=Tt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ha=function($){return!ir[si($)]&&Hn(ue,$)},Ra=function($,te,pe,Me){if(k&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!pe)switch(p.getAttributeType($,te)){case"TrustedHTML":return W(Me);case"TrustedScriptURL":return X(Me)}return Me},ln=function($,te,pe,Me){try{return pe?$.setAttributeNS(pe,te,Me):$.setAttribute(te,Me),pa($)?(_n($),!1):!0}catch{return mt(te,$),!1}},Qn=function($){Sn(H.beforeSanitizeAttributes,$,null);const te=$.attributes;if(!te||pa($))return;se=Qa(H.uponSanitizeAttribute,se,Fe,bt);const pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let Me=te.length;const Be=ge($.nodeName);for(;Me--;){const ot=te[Me],Ft=ot.name,Gt=ot.namespaceURI,Un=ot.value,jn=ge(Ft),Yr=Un;let Pn=Ft==="value"?Yr:_S(Yr),qo=!1;if(pe.attrName=jn,pe.attrValue=Pn,pe.keepAttr=!0,pe.forceKeepAttr=void 0,Sn(H.uponSanitizeAttribute,$,pe),Pn=pe.attrValue,at&&(jn==="id"||jn==="name")&&Tm(Pn,ee)!==0&&(mt(Ft,$,ot),Pn=ee+Pn,qo=!0),xe&&Hn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pn)){mt(Ft,$,ot);continue}if(jn==="attributename"&&Rm(Pn,"href")){mt(Ft,$,ot);continue}if(!pe.forceKeepAttr){if(!pe.keepAttr){mt(Ft,$,ot);continue}if(!le&&Hn(YS,Pn)){mt(Ft,$,ot);continue}if(fe&&(Pn=Ca(Pn)),!Cn(Be,jn,Pn)){mt(Ft,$,ot);continue}Pn=Ra(Be,jn,Gt,Pn),Pn!==Yr&&ln($,Ft,Gt,Pn)&&qo&&Nm(t.removed)}}Sn(H.afterSanitizeAttributes,$,null)},ja=function($){let te=null;const pe=sn($);for(Sn(H.beforeSanitizeShadowDOM,$,null);te=pe.nextNode();)if(Sn(H.uponSanitizeShadowNode,te,null),aa(te,$),Qn(te),xn(te.content)&&ja(te.content),C(te)===fa.element){const Me=S(te);xn(Me)&&(cn(Me),ja(Me))}Sn(H.afterSanitizeShadowDOM,$,null)},cn=function($){const te=[{node:$,shadow:null}];for(;te.length>0;){const pe=te.pop();if(pe.shadow){ja(pe.shadow);continue}const Me=pe.node,ot=C(Me)===fa.element,Ft=y(Me);if(Ft)for(let Gt=Ft.length-1;Gt>=0;--Gt)te.push({node:Ft[Gt],shadow:null});if(ot){const Gt=x?x(Me):null;if(typeof Gt=="string"&&ge(Gt)==="template"){const Un=Me.content;xn(Un)&&te.push({node:Un,shadow:null})}}if(ot){const Gt=S(Me);xn(Gt)&&te.push({node:null,shadow:Gt},{node:Gt,shadow:null})}}};return t.sanitize=function(he){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=null,pe=null,Me=null,Be=null;if(Zt=!he,Zt&&(he=""),typeof he!="string"&&!ta(he)&&(he=LS(he),typeof he!="string"))throw Cr("dirty is not a string, aborting");if(!t.isSupported)return he;Ye?(M=ht,se=bt):Q($),(H.uponSanitizeElement.length>0||H.uponSanitizeAttribute.length>0)&&(M=ba(M)),H.uponSanitizeAttribute.length>0&&(se=ba(se)),t.removed=[];const ot=ae&&typeof he!="string"&&ta(he);if(ot){Dt(he);const Un=O(he);if(typeof Un=="string"){const jn=ge(Un);if(!M[jn]||oe[jn])throw pt(he),Cr("root node is forbidden and cannot be sanitized in-place")}if(pa(he))throw pt(he),Cr("root node is clobbered and cannot be sanitized in-place");try{cn(he)}catch(jn){throw pt(he),jn}}else if(ta(he))te=kn(""),pe=te.ownerDocument.importNode(he,!0),pe.nodeType===fa.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?te=pe:te.appendChild(pe),cn(te);else{if(!Ce&&!fe&&!ze&&he.indexOf("<")===-1)return k&&Et?W(he):he;if(te=kn(he),!te)return Ce?null:Et?T:""}te&&ft&&_n(te.firstChild);const Ft=ot?he:te;try{const Un=sn(Ft);for(;Me=Un.nextNode();)aa(Me,Ft),Qn(Me),xn(Me.content)&&ja(Me.content)}catch(Un){throw ot&&(pt(he),Ir(t.removed,jn=>{jn.element&&ke(jn.element)})),Un}if(ot)return Ir(t.removed,Un=>{Un.element&&ke(Un.element)}),fe&&Na(he),he;if(Ce){if(fe&&Na(te),gt)for(Be=Z.call(te.ownerDocument);te.firstChild;)Be.appendChild(te.firstChild);else Be=te;return(se.shadowroot||se.shadowrootmode)&&(Be=ne.call(r,Be,!0)),Be}let Gt=ze?te.outerHTML:te.innerHTML;return ze&&M["!doctype"]&&te.ownerDocument&&te.ownerDocument.doctype&&te.ownerDocument.doctype.name&&Hn(ZS,te.ownerDocument.doctype.name)&&(Gt=" +`+Gt),fe&&(Gt=Ca(Gt)),k&&Et?W(Gt):Gt},t.setConfig=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Q(he),Ye=!0,ht=M,bt=se},t.clearConfig=function(){At=null,Ye=!1,ht=null,bt=null,k=I,T=""},t.isValidAttribute=function(he,$,te){At||Q({});const pe=ge(he),Me=ge($);return Cn(pe,Me,te)},t.addHook=function(he,$){typeof $=="function"&&oa(H,he)&&Ho(H[he],$)},t.removeHook=function(he,$){if(oa(H,he)){if($!==void 0){const te=IS(H[he],$);return te===-1?void 0:AS(H[he],te,1)[0]}return Nm(H[he])}},t.removeHooks=function(he){oa(H,he)&&(H[he]=[])},t.removeAllHooks=function(){H=Fm()},t}var t1=qg();function n1(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const a1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,r1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o1={};function qm(e,t){return(o1.jsx?r1:a1).test(e)}const i1=/[ \t\n\f\r]/g;function s1(e){return typeof e=="object"?e.type==="text"?Um(e.value):!1:Um(e)}function Um(e){return e.replace(i1,"")===""}class Bi{constructor(t,a,r){this.normal=a,this.property=t,r&&(this.space=r)}}Bi.prototype.normal={};Bi.prototype.property={};Bi.prototype.space=void 0;function Ug(e,t){const a={},r={};for(const o of e)Object.assign(a,o.property),Object.assign(r,o.normal);return new Bi(a,r,t)}function Gc(e){return e.toLowerCase()}class la{constructor(t,a){this.attribute=a,this.property=t}}la.prototype.attribute="";la.prototype.booleanish=!1;la.prototype.boolean=!1;la.prototype.commaOrSpaceSeparated=!1;la.prototype.commaSeparated=!1;la.prototype.defined=!1;la.prototype.mustUseProperty=!1;la.prototype.number=!1;la.prototype.overloadedBoolean=!1;la.prototype.property="";la.prototype.spaceSeparated=!1;la.prototype.space=void 0;let l1=0;const dt=Wr(),hn=Wr(),Qc=Wr(),Se=Wr(),$t=Wr(),Mr=Wr(),va=Wr();function Wr(){return 2**++l1}const Xc=Object.freeze(Object.defineProperty({__proto__:null,boolean:dt,booleanish:hn,commaOrSpaceSeparated:va,commaSeparated:Mr,number:Se,overloadedBoolean:Qc,spaceSeparated:$t},Symbol.toStringTag,{value:"Module"})),Yl=Object.keys(Xc);class Xu extends la{constructor(t,a,r,o){let i=-1;if(super(t,a),jm(this,"space",o),typeof r=="number")for(;++i4&&a.slice(0,4)==="data"&&m1.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($m,g1);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$m.test(i)){let s=i.replace(p1,f1);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=Xu}return new o(r,t)}function f1(e){return"-"+e.toLowerCase()}function g1(e){return e.charAt(1).toUpperCase()}const v1=Ug([jg,c1,Hg,Vg,Wg],"html"),ed=Ug([jg,u1,Hg,Vg,Wg],"svg");function b1(e){return e.join(" ").trim()}var Gr={},Gl,Bm;function y1(){if(Bm)return Gl;Bm=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,a=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,l=/^\s+|\s+$/g,c=` +`,u="/",d="*",p="",m="comment",h="declaration";function f(E,y){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];y=y||{};var b=1,S=1;function w(z){var q=z.match(t);q&&(b+=q.length);var W=z.lastIndexOf(c);S=~W?z.length-W:S+z.length}function N(){var z={line:b,column:S};return function(q){return q.position=new x(z),O(),q}}function x(z){this.start=z,this.end={line:b,column:S},this.source=y.source}x.prototype.content=E;function A(z){var q=new Error(y.source+":"+b+":"+S+": "+z);if(q.reason=z,q.filename=y.source,q.line=b,q.column=S,q.source=E,!y.silent)throw q}function C(z){var q=z.exec(E);if(q){var W=q[0];return w(W),E=E.slice(W.length),q}}function O(){C(a)}function k(z){var q;for(z=z||[];q=T();)q!==!1&&z.push(q);return z}function T(){var z=N();if(!(u!=E.charAt(0)||d!=E.charAt(1))){for(var q=2;p!=E.charAt(q)&&(d!=E.charAt(q)||u!=E.charAt(q+1));)++q;if(q+=2,p===E.charAt(q-1))return A("End of comment missing");var W=E.slice(2,q-2);return S+=2,w(W),E=E.slice(q),S+=2,z({type:m,comment:W})}}function I(){var z=N(),q=C(r);if(q){if(T(),!C(o))return A("property missing ':'");var W=C(i),X=z({type:h,property:g(q[0].replace(e,p)),value:W?g(W[0].replace(e,p)):p});return C(s),X}}function F(){var z=[];k(z);for(var q;q=I();)q!==!1&&(z.push(q),k(z));return z}return O(),F()}function g(E){return E?E.replace(l,p):p}return Gl=f,Gl}var Hm;function E1(){if(Hm)return Gr;Hm=1;var e=Gr&&Gr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.default=a;const t=e(y1());function a(r,o){let i=null;if(!r||typeof r!="string")return i;const s=(0,t.default)(r),l=typeof o=="function";return s.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?o(u,d,c):d&&(i=i||{},i[u]=d)}),i}return Gr}var Zo={},Vm;function w1(){if(Vm)return Zo;Vm=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,a=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(u){return!u||a.test(u)||e.test(u)},s=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,l):u=u.replace(r,l),u.replace(t,s))};return Zo.camelCase=c,Zo}var Jo,Wm;function k1(){if(Wm)return Jo;Wm=1;var e=Jo&&Jo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(E1()),a=w1();function r(o,i){var s={};return!o||typeof o!="string"||(0,t.default)(o,function(l,c){l&&c&&(s[(0,a.camelCase)(l,i)]=c)}),s}return r.default=r,Jo=r,Jo}var x1=k1();const S1=og(x1),Zg=Jg("end"),td=Jg("start");function Jg(e){return t;function t(a){const r=a&&a.position&&a.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function C1(e){const t=td(e),a=Zg(e);if(t&&a)return{start:t,end:a}}function mi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Zm(e.position):"start"in e||"end"in e?Zm(e):"line"in e||"column"in e?eu(e):""}function eu(e){return Jm(e&&e.line)+":"+Jm(e&&e.column)}function Zm(e){return eu(e&&e.start)+"-"+eu(e&&e.end)}function Jm(e){return e&&typeof e=="number"?e:1}class Kn extends Error{constructor(t,a,r){super(),typeof a=="string"&&(r=a,a=void 0);let o="",i={},s=!1;if(a&&("line"in a&&"column"in a?i={place:a}:"start"in a&&"end"in a?i={place:a}:"type"in a?i={ancestors:[a],place:a.position}:i={...a}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=mi(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Kn.prototype.file="";Kn.prototype.name="";Kn.prototype.reason="";Kn.prototype.message="";Kn.prototype.stack="";Kn.prototype.column=void 0;Kn.prototype.line=void 0;Kn.prototype.ancestors=void 0;Kn.prototype.cause=void 0;Kn.prototype.fatal=void 0;Kn.prototype.place=void 0;Kn.prototype.ruleId=void 0;Kn.prototype.source=void 0;const nd={}.hasOwnProperty,N1=new Map,R1=/[A-Z]/g,T1=new Set(["table","tbody","thead","tfoot","tr"]),I1=new Set(["td","th"]),Kg="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function A1(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=F1(a,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=D1(a,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ed:v1,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Yg(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function Yg(e,t,a){if(t.type==="element")return _1(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return P1(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return M1(e,t,a);if(t.type==="mdxjsEsm")return O1(e,t);if(t.type==="root")return z1(e,t,a);if(t.type==="text")return L1(e,t)}function _1(e,t,a){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=ed,e.schema=o),e.ancestors.push(t);const i=Qg(e,t.tagName,!1),s=q1(e,t);let l=rd(e,t);return T1.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!s1(c):!0})),Gg(e,s,i,t),ad(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,a)}function P1(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ki(e,t.position)}function O1(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ki(e,t.position)}function M1(e,t,a){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=ed,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:Qg(e,t.name,!0),s=U1(e,t),l=rd(e,t);return Gg(e,s,i,t),ad(s,l),e.ancestors.pop(),e.schema=r,e.create(t,i,s,a)}function z1(e,t,a){const r={};return ad(r,rd(e,t)),e.create(t,e.Fragment,r,a)}function L1(e,t){return t.value}function Gg(e,t,a,r){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=r)}function ad(e,t){if(t.length>0){const a=t.length>1?t:t[0];a&&(e.children=a)}}function D1(e,t,a){return r;function r(o,i,s,l){const u=Array.isArray(s.children)?a:t;return l?u(i,s,l):u(i,s)}}function F1(e,t){return a;function a(r,o,i,s){const l=Array.isArray(i.children),c=td(r);return t(o,i,s,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function q1(e,t){const a={};let r,o;for(o in t.properties)if(o!=="children"&&nd.call(t.properties,o)){const i=j1(e,o,t.properties[o]);if(i){const[s,l]=i;e.tableCellAlignToStyle&&s==="align"&&typeof l=="string"&&I1.has(t.tagName)?r=l:a[s]=l}}if(r){const i=a.style||(a.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return a}function U1(e,t){const a={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const l=s.properties[0];l.type,Object.assign(a,e.evaluater.evaluateExpression(l.argument))}else ki(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else ki(e,t.position);else i=r.value===null?!0:r.value;a[o]=i}return a}function rd(e,t){const a=[];let r=-1;const o=e.passKeys?new Map:N1;for(;++ro?0:o+t:t=t>o?o:t,a=a>0?a:0,r.length<1e4)s=Array.from(r),s.unshift(t,a),e.splice(...s);else for(a&&e.splice(t,a);i0?(ka(e,e.length,0,t),e):t}const Xm={}.hasOwnProperty;function ev(e){const t={};let a=-1;for(;++a13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Fa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xn=kr(/[A-Za-z]/),Jn=kr(/[\dA-Za-z]/),Q1=kr(/[#-'*+\--9=?A-Z^-~]/);function Ds(e){return e!==null&&(e<32||e===127)}const tu=kr(/\d/),X1=kr(/[\dA-Fa-f]/),e0=kr(/[!-/:-@[-`{-~]/);function tt(e){return e!==null&&e<-2}function Bt(e){return e!==null&&(e<0||e===32)}function kt(e){return e===-2||e===-1||e===32}const ll=kr(new RegExp("\\p{P}|\\p{S}","u")),jr=kr(/\s/);function kr(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Ao(e){const t=[];let a=-1,r=0,o=0;for(;++a55295&&i<57344){const l=e.charCodeAt(a+1);i<56320&&l>56319&&l<57344?(s=String.fromCharCode(i,l),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,a),encodeURIComponent(s)),r=a+o+1,s=""),o&&(a+=o,o=0)}return t.join("")+e.slice(r)}function Rt(e,t,a,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(c){return kt(c)?(e.enter(a),l(c)):t(c)}function l(c){return kt(c)&&i++s))return;const A=t.events.length;let C=A,O,k;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){if(O){k=t.events[C][1].end;break}O=!0}for(E(r),x=A;xS;){const N=a[w];t.containerState=N[1],N[0].exit.call(t,e)}a.length=S}function b(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function o0(e,t,a){return Rt(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bo(e){if(e===null||Bt(e)||jr(e))return 1;if(ll(e))return 2}function cl(e,t,a){const r=[];let o=-1;for(;++o1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[a][1].start};th(p,-c),th(m,c),s={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[a][1].start}},o={type:c>1?"strong":"emphasis",start:{...s.start},end:{...l.end}},e[r][1].end={...s.start},e[a][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Oa(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Oa(u,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Oa(u,cl(t.parser.constructs.insideSpan.null,e.slice(r+1,a),t)),u=Oa(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[a][1].end.offset-e[a][1].start.offset?(d=2,u=Oa(u,[["enter",e[a][1],t],["exit",e[a][1],t]])):d=0,ka(e,r-1,a-r+3,u),a=r+u.length-d-2;break}}for(a=-1;++a0&&kt(x)?Rt(e,b,"linePrefix",i+1)(x):b(x)}function b(x){return x===null||tt(x)?e.check(nh,g,w)(x):(e.enter("codeFlowValue"),S(x))}function S(x){return x===null||tt(x)?(e.exit("codeFlowValue"),b(x)):(e.consume(x),S)}function w(x){return e.exit("codeFenced"),t(x)}function N(x,A,C){let O=0;return k;function k(U){return x.enter("lineEnding"),x.consume(U),x.exit("lineEnding"),T}function T(U){return x.enter("codeFencedFence"),kt(U)?Rt(x,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):I(U)}function I(U){return U===l?(x.enter("codeFencedFenceSequence"),F(U)):C(U)}function F(U){return U===l?(O++,x.consume(U),F):O>=s?(x.exit("codeFencedFenceSequence"),kt(U)?Rt(x,z,"whitespace")(U):z(U)):C(U)}function z(U){return U===null||tt(U)?(x.exit("codeFencedFence"),A(U)):C(U)}}}function v0(e,t,a){const r=this;return o;function o(s){return s===null?a(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?a(s):t(s)}}const tc={name:"codeIndented",tokenize:y0},b0={partial:!0,tokenize:E0};function y0(e,t,a){const r=this;return o;function o(u){return e.enter("codeIndented"),Rt(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):a(u)}function s(u){return u===null?c(u):tt(u)?e.attempt(b0,s,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||tt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function E0(e,t,a){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?a(s):tt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):Rt(e,i,"linePrefix",5)(s)}function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):tt(s)?o(s):a(s)}}const w0={name:"codeText",previous:x0,resolve:k0,tokenize:S0};function k0(e){let t=e.length-4,a=3,r,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=a;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,a,r){const o=a||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Yo(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Yo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(s):e.interrupt(r.parser.constructs.flow,a,t)(s)}}function iv(e,t,a,r,o,i,s,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return p;function p(E){return E===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(E),e.exit(i),m):E===null||E===32||E===41||Ds(E)?a(E):(e.enter(r),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(E))}function m(E){return E===62?(e.enter(i),e.consume(E),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===62?(e.exit("chunkString"),e.exit(l),m(E)):E===null||E===60||tt(E)?a(E):(e.consume(E),E===92?f:h)}function f(E){return E===60||E===62||E===92?(e.consume(E),h):h(E)}function g(E){return!d&&(E===null||E===41||Bt(E))?(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(r),t(E)):d999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?a(h):h===93?(e.exit(i),e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):tt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===null||h===91||h===93||tt(h)||l++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!kt(h)),h===92?m:p)}function m(h){return h===91||h===92||h===93?(e.consume(h),l++,p):p(h)}}function lv(e,t,a,r,o,i){let s;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(o),e.consume(m),e.exit(o),s=m===40?41:m,c):a(m)}function c(m){return m===s?(e.enter(o),e.consume(m),e.exit(o),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),c(s)):m===null?a(m):tt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Rt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===s||m===null||tt(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?p:d)}function p(m){return m===s||m===92?(e.consume(m),d):d(m)}}function hi(e,t){let a;return r;function r(o){return tt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,r):kt(o)?Rt(e,r,a?"linePrefix":"lineSuffix")(o):t(o)}}const P0={name:"definition",tokenize:M0},O0={partial:!0,tokenize:z0};function M0(e,t,a){const r=this;let o;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return sv.call(r,e,l,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return o=Fa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):a(h)}function c(h){return Bt(h)?hi(e,u)(h):u(h)}function u(h){return iv(e,d,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(O0,p,p)(h)}function p(h){return kt(h)?Rt(e,m,"whitespace")(h):m(h)}function m(h){return h===null||tt(h)?(e.exit("definition"),r.parser.defined.push(o),t(h)):a(h)}}function z0(e,t,a){return r;function r(l){return Bt(l)?hi(e,o)(l):a(l)}function o(l){return lv(e,i,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return kt(l)?Rt(e,s,"whitespace")(l):s(l)}function s(l){return l===null||tt(l)?t(l):a(l)}}const L0={name:"hardBreakEscape",tokenize:D0};function D0(e,t,a){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return tt(i)?(e.exit("hardBreakEscape"),t(i)):a(i)}}const F0={name:"headingAtx",resolve:q0,tokenize:U0};function q0(e,t){let a=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),a-2>r&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(r===a-1||a-4>r&&e[a-2][1].type==="whitespace")&&(a-=r+1===a?2:4),a>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[a][1].end},i={type:"chunkText",start:e[r][1].start,end:e[a][1].end,contentType:"text"},ka(e,r,a-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function U0(e,t,a){let r=0;return o;function o(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Bt(d)?(e.exit("atxHeadingSequence"),l(d)):a(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||tt(d)?(e.exit("atxHeading"),t(d)):kt(d)?Rt(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Bt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const j0=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],rh=["pre","script","style","textarea"],$0={concrete:!0,name:"htmlFlow",resolveTo:V0,tokenize:W0},B0={partial:!0,tokenize:J0},H0={partial:!0,tokenize:Z0};function V0(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function W0(e,t,a){const r=this;let o,i,s,l,c;return u;function u(D){return d(D)}function d(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),p}function p(D){return D===33?(e.consume(D),m):D===47?(e.consume(D),i=!0,g):D===63?(e.consume(D),o=3,r.interrupt?t:P):Xn(D)?(e.consume(D),s=String.fromCharCode(D),y):a(D)}function m(D){return D===45?(e.consume(D),o=2,h):D===91?(e.consume(D),o=5,l=0,f):Xn(D)?(e.consume(D),o=4,r.interrupt?t:P):a(D)}function h(D){return D===45?(e.consume(D),r.interrupt?t:P):a(D)}function f(D){const ne="CDATA[";return D===ne.charCodeAt(l++)?(e.consume(D),l===ne.length?r.interrupt?t:I:f):a(D)}function g(D){return Xn(D)?(e.consume(D),s=String.fromCharCode(D),y):a(D)}function y(D){if(D===null||D===47||D===62||Bt(D)){const ne=D===47,q=s.toLowerCase();return!ne&&!i&&rh.includes(q)?(o=1,r.interrupt?t(D):I(D)):j0.includes(s.toLowerCase())?(o=6,ne?(e.consume(D),E):r.interrupt?t(D):I(D)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(D):i?b(D):S(D))}return D===45||Jn(D)?(e.consume(D),s+=String.fromCharCode(D),y):a(D)}function E(D){return D===62?(e.consume(D),r.interrupt?t:I):a(D)}function b(D){return kt(D)?(e.consume(D),b):k(D)}function S(D){return D===47?(e.consume(D),k):D===58||D===95||Xn(D)?(e.consume(D),w):kt(D)?(e.consume(D),S):k(D)}function w(D){return D===45||D===46||D===58||D===95||Jn(D)?(e.consume(D),w):N(D)}function N(D){return D===61?(e.consume(D),x):kt(D)?(e.consume(D),N):S(D)}function x(D){return D===null||D===60||D===61||D===62||D===96?a(D):D===34||D===39?(e.consume(D),c=D,A):kt(D)?(e.consume(D),x):C(D)}function A(D){return D===c?(e.consume(D),c=null,O):D===null||tt(D)?a(D):(e.consume(D),A)}function C(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Bt(D)?N(D):(e.consume(D),C)}function O(D){return D===47||D===62||kt(D)?S(D):a(D)}function k(D){return D===62?(e.consume(D),T):a(D)}function T(D){return D===null||tt(D)?I(D):kt(D)?(e.consume(D),T):a(D)}function I(D){return D===45&&o===2?(e.consume(D),H):D===60&&o===1?(e.consume(D),te):D===62&&o===4?(e.consume(D),G):D===63&&o===3?(e.consume(D),P):D===93&&o===5?(e.consume(D),_):tt(D)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(B0,W,F)(D)):D===null||tt(D)?(e.exit("htmlFlowData"),F(D)):(e.consume(D),I)}function F(D){return e.check(H0,z,W)(D)}function z(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),U}function U(D){return D===null||tt(D)?F(D):(e.enter("htmlFlowData"),I(D))}function H(D){return D===45?(e.consume(D),P):I(D)}function te(D){return D===47?(e.consume(D),s="",j):I(D)}function j(D){if(D===62){const ne=s.toLowerCase();return rh.includes(ne)?(e.consume(D),G):I(D)}return Xn(D)&&s.length<8?(e.consume(D),s+=String.fromCharCode(D),j):I(D)}function _(D){return D===93?(e.consume(D),P):I(D)}function P(D){return D===62?(e.consume(D),G):D===45&&o===2?(e.consume(D),P):I(D)}function G(D){return D===null||tt(D)?(e.exit("htmlFlowData"),W(D)):(e.consume(D),G)}function W(D){return e.exit("htmlFlow"),t(D)}}function Z0(e,t,a){const r=this;return o;function o(s){return tt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):a(s)}function i(s){return r.parser.lazy[r.now().line]?a(s):t(s)}}function J0(e,t,a){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Hi,t,a)}}const K0={name:"htmlText",tokenize:Y0};function Y0(e,t,a){const r=this;let o,i,s;return l;function l(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),c}function c(P){return P===33?(e.consume(P),u):P===47?(e.consume(P),N):P===63?(e.consume(P),S):Xn(P)?(e.consume(P),C):a(P)}function u(P){return P===45?(e.consume(P),d):P===91?(e.consume(P),i=0,f):Xn(P)?(e.consume(P),b):a(P)}function d(P){return P===45?(e.consume(P),h):a(P)}function p(P){return P===null?a(P):P===45?(e.consume(P),m):tt(P)?(s=p,te(P)):(e.consume(P),p)}function m(P){return P===45?(e.consume(P),h):p(P)}function h(P){return P===62?H(P):P===45?m(P):p(P)}function f(P){const G="CDATA[";return P===G.charCodeAt(i++)?(e.consume(P),i===G.length?g:f):a(P)}function g(P){return P===null?a(P):P===93?(e.consume(P),y):tt(P)?(s=g,te(P)):(e.consume(P),g)}function y(P){return P===93?(e.consume(P),E):g(P)}function E(P){return P===62?H(P):P===93?(e.consume(P),E):g(P)}function b(P){return P===null||P===62?H(P):tt(P)?(s=b,te(P)):(e.consume(P),b)}function S(P){return P===null?a(P):P===63?(e.consume(P),w):tt(P)?(s=S,te(P)):(e.consume(P),S)}function w(P){return P===62?H(P):S(P)}function N(P){return Xn(P)?(e.consume(P),x):a(P)}function x(P){return P===45||Jn(P)?(e.consume(P),x):A(P)}function A(P){return tt(P)?(s=A,te(P)):kt(P)?(e.consume(P),A):H(P)}function C(P){return P===45||Jn(P)?(e.consume(P),C):P===47||P===62||Bt(P)?O(P):a(P)}function O(P){return P===47?(e.consume(P),H):P===58||P===95||Xn(P)?(e.consume(P),k):tt(P)?(s=O,te(P)):kt(P)?(e.consume(P),O):H(P)}function k(P){return P===45||P===46||P===58||P===95||Jn(P)?(e.consume(P),k):T(P)}function T(P){return P===61?(e.consume(P),I):tt(P)?(s=T,te(P)):kt(P)?(e.consume(P),T):O(P)}function I(P){return P===null||P===60||P===61||P===62||P===96?a(P):P===34||P===39?(e.consume(P),o=P,F):tt(P)?(s=I,te(P)):kt(P)?(e.consume(P),I):(e.consume(P),z)}function F(P){return P===o?(e.consume(P),o=void 0,U):P===null?a(P):tt(P)?(s=F,te(P)):(e.consume(P),F)}function z(P){return P===null||P===34||P===39||P===60||P===61||P===96?a(P):P===47||P===62||Bt(P)?O(P):(e.consume(P),z)}function U(P){return P===47||P===62||Bt(P)?O(P):a(P)}function H(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):a(P)}function te(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),j}function j(P){return kt(P)?Rt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):_(P)}function _(P){return e.enter("htmlTextData"),s(P)}}const sd={name:"labelEnd",resolveAll:eC,resolveTo:tC,tokenize:nC},G0={tokenize:aC},Q0={tokenize:rC},X0={tokenize:oC};function eC(e){let t=-1;const a=[];for(;++t=3&&(u===null||tt(u))?(e.exit("thematicBreak"),t(u)):a(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),kt(u)?Rt(e,l,"whitespace")(u):l(u))}}const ra={continuation:{tokenize:fC},exit:vC,name:"list",tokenize:hC},pC={partial:!0,tokenize:bC},mC={partial:!0,tokenize:gC};function hC(e,t,a){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return l;function l(h){const f=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:tu(h)){if(r.containerState.type||(r.containerState.type=f,e.enter(f,{_container:!0})),f==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Ss,a,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return a(h)}function c(h){return tu(h)&&++s<10?(e.consume(h),c):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):a(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Hi,r.interrupt?a:d,e.attempt(pC,m,p))}function d(h){return r.containerState.initialBlankLine=!0,i++,m(h)}function p(h){return kt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),m):a(h)}function m(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function fC(e,t,a){const r=this;return r.containerState._closeFlow=void 0,e.check(Hi,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Rt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!kt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mC,t,s)(l))}function s(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Rt(e,e.attempt(ra,t,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function gC(e,t,a){const r=this;return Rt(e,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):a(i)}}function vC(e){e.exit(this.containerState.type)}function bC(e,t,a){const r=this;return Rt(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!kt(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):a(i)}}const oh={name:"setextUnderline",resolveTo:yC,tokenize:EC};function yC(e,t){let a=e.length,r,o,i;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){r=a;break}e[a][1].type==="paragraph"&&(o=a)}else e[a][1].type==="content"&&e.splice(a,1),!i&&e[a][1].type==="definition"&&(i=a);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function EC(e,t,a){const r=this;let o;return i;function i(u){let d=r.events.length,p;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){p=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),o=u,s(u)):a(u)}function s(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===o?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),kt(u)?Rt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||tt(u)?(e.exit("setextHeadingLine"),t(u)):a(u)}}const wC={tokenize:kC};function kC(e){const t=this,a=e.attempt(Hi,r,e.attempt(this.parser.constructs.flowInitial,o,Rt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(R0,o)),"linePrefix")));return a;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,a}}const xC={resolveAll:uv()},SC=cv("string"),CC=cv("text");function cv(e){return{resolveAll:uv(e==="text"?NC:void 0),tokenize:t};function t(a){const r=this,o=this.parser.constructs[e],i=a.attempt(o,s,l);return s;function s(d){return u(d)?i(d):l(d)}function l(d){if(d===null){a.consume(d);return}return a.enter("data"),a.consume(d),c}function c(d){return u(d)?(a.exit("data"),i(d)):(a.consume(d),c)}function u(d){if(d===null)return!0;const p=o[d];let m=-1;if(p)for(;++m-1){const l=s[0];typeof l=="string"?s[0]=l.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function qC(e,t){let a=-1;const r=[];let o;for(;++ao?0:o+t:t=t>o?o:t,a=a>0?a:0,r.length<1e4)s=Array.from(r),s.unshift(t,a),e.splice(...s);else for(a&&e.splice(t,a);i0?(ka(e,e.length,0,t),e):t}const Xm={}.hasOwnProperty;function ev(e){const t={};let a=-1;for(;++a13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Fa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xn=kr(/[A-Za-z]/),Jn=kr(/[\dA-Za-z]/),Q1=kr(/[#-'*+\--9=?A-Z^-~]/);function Ds(e){return e!==null&&(e<32||e===127)}const tu=kr(/\d/),X1=kr(/[\dA-Fa-f]/),e0=kr(/[!-/:-@[-`{-~]/);function tt(e){return e!==null&&e<-2}function Bt(e){return e!==null&&(e<0||e===32)}function kt(e){return e===-2||e===-1||e===32}const ll=kr(new RegExp("\\p{P}|\\p{S}","u")),jr=kr(/\s/);function kr(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Ao(e){const t=[];let a=-1,r=0,o=0;for(;++a55295&&i<57344){const l=e.charCodeAt(a+1);i<56320&&l>56319&&l<57344?(s=String.fromCharCode(i,l),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,a),encodeURIComponent(s)),r=a+o+1,s=""),o&&(a+=o,o=0)}return t.join("")+e.slice(r)}function Rt(e,t,a,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(c){return kt(c)?(e.enter(a),l(c)):t(c)}function l(c){return kt(c)&&i++s))return;const A=t.events.length;let C=A,O,k;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){if(O){k=t.events[C][1].end;break}O=!0}for(y(r),x=A;xS;){const N=a[w];t.containerState=N[1],N[0].exit.call(t,e)}a.length=S}function b(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function o0(e,t,a){return Rt(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bo(e){if(e===null||Bt(e)||jr(e))return 1;if(ll(e))return 2}function cl(e,t,a){const r=[];let o=-1;for(;++o1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[a][1].start};th(p,-c),th(m,c),s={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[a][1].start}},o={type:c>1?"strong":"emphasis",start:{...s.start},end:{...l.end}},e[r][1].end={...s.start},e[a][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Oa(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Oa(u,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Oa(u,cl(t.parser.constructs.insideSpan.null,e.slice(r+1,a),t)),u=Oa(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[a][1].end.offset-e[a][1].start.offset?(d=2,u=Oa(u,[["enter",e[a][1],t],["exit",e[a][1],t]])):d=0,ka(e,r-1,a-r+3,u),a=r+u.length-d-2;break}}for(a=-1;++a0&&kt(x)?Rt(e,b,"linePrefix",i+1)(x):b(x)}function b(x){return x===null||tt(x)?e.check(nh,g,w)(x):(e.enter("codeFlowValue"),S(x))}function S(x){return x===null||tt(x)?(e.exit("codeFlowValue"),b(x)):(e.consume(x),S)}function w(x){return e.exit("codeFenced"),t(x)}function N(x,A,C){let O=0;return k;function k(q){return x.enter("lineEnding"),x.consume(q),x.exit("lineEnding"),T}function T(q){return x.enter("codeFencedFence"),kt(q)?Rt(x,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):I(q)}function I(q){return q===l?(x.enter("codeFencedFenceSequence"),F(q)):C(q)}function F(q){return q===l?(O++,x.consume(q),F):O>=s?(x.exit("codeFencedFenceSequence"),kt(q)?Rt(x,z,"whitespace")(q):z(q)):C(q)}function z(q){return q===null||tt(q)?(x.exit("codeFencedFence"),A(q)):C(q)}}}function v0(e,t,a){const r=this;return o;function o(s){return s===null?a(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?a(s):t(s)}}const tc={name:"codeIndented",tokenize:y0},b0={partial:!0,tokenize:E0};function y0(e,t,a){const r=this;return o;function o(u){return e.enter("codeIndented"),Rt(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):a(u)}function s(u){return u===null?c(u):tt(u)?e.attempt(b0,s,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||tt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function E0(e,t,a){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?a(s):tt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):Rt(e,i,"linePrefix",5)(s)}function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):tt(s)?o(s):a(s)}}const w0={name:"codeText",previous:x0,resolve:k0,tokenize:S0};function k0(e){let t=e.length-4,a=3,r,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=a;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,a,r){const o=a||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Yo(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Yo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(s):e.interrupt(r.parser.constructs.flow,a,t)(s)}}function iv(e,t,a,r,o,i,s,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return p;function p(y){return y===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(y),e.exit(i),m):y===null||y===32||y===41||Ds(y)?a(y):(e.enter(r),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(y))}function m(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(l),m(y)):y===null||y===60||tt(y)?a(y):(e.consume(y),y===92?f:h)}function f(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function g(y){return!d&&(y===null||y===41||Bt(y))?(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(r),t(y)):d999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?a(h):h===93?(e.exit(i),e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):tt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===null||h===91||h===93||tt(h)||l++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!kt(h)),h===92?m:p)}function m(h){return h===91||h===92||h===93?(e.consume(h),l++,p):p(h)}}function lv(e,t,a,r,o,i){let s;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(o),e.consume(m),e.exit(o),s=m===40?41:m,c):a(m)}function c(m){return m===s?(e.enter(o),e.consume(m),e.exit(o),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),c(s)):m===null?a(m):tt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Rt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===s||m===null||tt(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?p:d)}function p(m){return m===s||m===92?(e.consume(m),d):d(m)}}function hi(e,t){let a;return r;function r(o){return tt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,r):kt(o)?Rt(e,r,a?"linePrefix":"lineSuffix")(o):t(o)}}const P0={name:"definition",tokenize:M0},O0={partial:!0,tokenize:z0};function M0(e,t,a){const r=this;let o;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return sv.call(r,e,l,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return o=Fa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):a(h)}function c(h){return Bt(h)?hi(e,u)(h):u(h)}function u(h){return iv(e,d,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(O0,p,p)(h)}function p(h){return kt(h)?Rt(e,m,"whitespace")(h):m(h)}function m(h){return h===null||tt(h)?(e.exit("definition"),r.parser.defined.push(o),t(h)):a(h)}}function z0(e,t,a){return r;function r(l){return Bt(l)?hi(e,o)(l):a(l)}function o(l){return lv(e,i,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return kt(l)?Rt(e,s,"whitespace")(l):s(l)}function s(l){return l===null||tt(l)?t(l):a(l)}}const L0={name:"hardBreakEscape",tokenize:D0};function D0(e,t,a){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return tt(i)?(e.exit("hardBreakEscape"),t(i)):a(i)}}const F0={name:"headingAtx",resolve:q0,tokenize:U0};function q0(e,t){let a=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),a-2>r&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(r===a-1||a-4>r&&e[a-2][1].type==="whitespace")&&(a-=r+1===a?2:4),a>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[a][1].end},i={type:"chunkText",start:e[r][1].start,end:e[a][1].end,contentType:"text"},ka(e,r,a-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function U0(e,t,a){let r=0;return o;function o(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Bt(d)?(e.exit("atxHeadingSequence"),l(d)):a(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||tt(d)?(e.exit("atxHeading"),t(d)):kt(d)?Rt(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Bt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const j0=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],rh=["pre","script","style","textarea"],$0={concrete:!0,name:"htmlFlow",resolveTo:V0,tokenize:W0},B0={partial:!0,tokenize:J0},H0={partial:!0,tokenize:Z0};function V0(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function W0(e,t,a){const r=this;let o,i,s,l,c;return u;function u(D){return d(D)}function d(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),p}function p(D){return D===33?(e.consume(D),m):D===47?(e.consume(D),i=!0,g):D===63?(e.consume(D),o=3,r.interrupt?t:P):Xn(D)?(e.consume(D),s=String.fromCharCode(D),E):a(D)}function m(D){return D===45?(e.consume(D),o=2,h):D===91?(e.consume(D),o=5,l=0,f):Xn(D)?(e.consume(D),o=4,r.interrupt?t:P):a(D)}function h(D){return D===45?(e.consume(D),r.interrupt?t:P):a(D)}function f(D){const ne="CDATA[";return D===ne.charCodeAt(l++)?(e.consume(D),l===ne.length?r.interrupt?t:I:f):a(D)}function g(D){return Xn(D)?(e.consume(D),s=String.fromCharCode(D),E):a(D)}function E(D){if(D===null||D===47||D===62||Bt(D)){const ne=D===47,H=s.toLowerCase();return!ne&&!i&&rh.includes(H)?(o=1,r.interrupt?t(D):I(D)):j0.includes(s.toLowerCase())?(o=6,ne?(e.consume(D),y):r.interrupt?t(D):I(D)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(D):i?b(D):S(D))}return D===45||Jn(D)?(e.consume(D),s+=String.fromCharCode(D),E):a(D)}function y(D){return D===62?(e.consume(D),r.interrupt?t:I):a(D)}function b(D){return kt(D)?(e.consume(D),b):k(D)}function S(D){return D===47?(e.consume(D),k):D===58||D===95||Xn(D)?(e.consume(D),w):kt(D)?(e.consume(D),S):k(D)}function w(D){return D===45||D===46||D===58||D===95||Jn(D)?(e.consume(D),w):N(D)}function N(D){return D===61?(e.consume(D),x):kt(D)?(e.consume(D),N):S(D)}function x(D){return D===null||D===60||D===61||D===62||D===96?a(D):D===34||D===39?(e.consume(D),c=D,A):kt(D)?(e.consume(D),x):C(D)}function A(D){return D===c?(e.consume(D),c=null,O):D===null||tt(D)?a(D):(e.consume(D),A)}function C(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Bt(D)?N(D):(e.consume(D),C)}function O(D){return D===47||D===62||kt(D)?S(D):a(D)}function k(D){return D===62?(e.consume(D),T):a(D)}function T(D){return D===null||tt(D)?I(D):kt(D)?(e.consume(D),T):a(D)}function I(D){return D===45&&o===2?(e.consume(D),W):D===60&&o===1?(e.consume(D),X):D===62&&o===4?(e.consume(D),G):D===63&&o===3?(e.consume(D),P):D===93&&o===5?(e.consume(D),_):tt(D)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(B0,Z,F)(D)):D===null||tt(D)?(e.exit("htmlFlowData"),F(D)):(e.consume(D),I)}function F(D){return e.check(H0,z,Z)(D)}function z(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),q}function q(D){return D===null||tt(D)?F(D):(e.enter("htmlFlowData"),I(D))}function W(D){return D===45?(e.consume(D),P):I(D)}function X(D){return D===47?(e.consume(D),s="",U):I(D)}function U(D){if(D===62){const ne=s.toLowerCase();return rh.includes(ne)?(e.consume(D),G):I(D)}return Xn(D)&&s.length<8?(e.consume(D),s+=String.fromCharCode(D),U):I(D)}function _(D){return D===93?(e.consume(D),P):I(D)}function P(D){return D===62?(e.consume(D),G):D===45&&o===2?(e.consume(D),P):I(D)}function G(D){return D===null||tt(D)?(e.exit("htmlFlowData"),Z(D)):(e.consume(D),G)}function Z(D){return e.exit("htmlFlow"),t(D)}}function Z0(e,t,a){const r=this;return o;function o(s){return tt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):a(s)}function i(s){return r.parser.lazy[r.now().line]?a(s):t(s)}}function J0(e,t,a){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Hi,t,a)}}const K0={name:"htmlText",tokenize:Y0};function Y0(e,t,a){const r=this;let o,i,s;return l;function l(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),c}function c(P){return P===33?(e.consume(P),u):P===47?(e.consume(P),N):P===63?(e.consume(P),S):Xn(P)?(e.consume(P),C):a(P)}function u(P){return P===45?(e.consume(P),d):P===91?(e.consume(P),i=0,f):Xn(P)?(e.consume(P),b):a(P)}function d(P){return P===45?(e.consume(P),h):a(P)}function p(P){return P===null?a(P):P===45?(e.consume(P),m):tt(P)?(s=p,X(P)):(e.consume(P),p)}function m(P){return P===45?(e.consume(P),h):p(P)}function h(P){return P===62?W(P):P===45?m(P):p(P)}function f(P){const G="CDATA[";return P===G.charCodeAt(i++)?(e.consume(P),i===G.length?g:f):a(P)}function g(P){return P===null?a(P):P===93?(e.consume(P),E):tt(P)?(s=g,X(P)):(e.consume(P),g)}function E(P){return P===93?(e.consume(P),y):g(P)}function y(P){return P===62?W(P):P===93?(e.consume(P),y):g(P)}function b(P){return P===null||P===62?W(P):tt(P)?(s=b,X(P)):(e.consume(P),b)}function S(P){return P===null?a(P):P===63?(e.consume(P),w):tt(P)?(s=S,X(P)):(e.consume(P),S)}function w(P){return P===62?W(P):S(P)}function N(P){return Xn(P)?(e.consume(P),x):a(P)}function x(P){return P===45||Jn(P)?(e.consume(P),x):A(P)}function A(P){return tt(P)?(s=A,X(P)):kt(P)?(e.consume(P),A):W(P)}function C(P){return P===45||Jn(P)?(e.consume(P),C):P===47||P===62||Bt(P)?O(P):a(P)}function O(P){return P===47?(e.consume(P),W):P===58||P===95||Xn(P)?(e.consume(P),k):tt(P)?(s=O,X(P)):kt(P)?(e.consume(P),O):W(P)}function k(P){return P===45||P===46||P===58||P===95||Jn(P)?(e.consume(P),k):T(P)}function T(P){return P===61?(e.consume(P),I):tt(P)?(s=T,X(P)):kt(P)?(e.consume(P),T):O(P)}function I(P){return P===null||P===60||P===61||P===62||P===96?a(P):P===34||P===39?(e.consume(P),o=P,F):tt(P)?(s=I,X(P)):kt(P)?(e.consume(P),I):(e.consume(P),z)}function F(P){return P===o?(e.consume(P),o=void 0,q):P===null?a(P):tt(P)?(s=F,X(P)):(e.consume(P),F)}function z(P){return P===null||P===34||P===39||P===60||P===61||P===96?a(P):P===47||P===62||Bt(P)?O(P):(e.consume(P),z)}function q(P){return P===47||P===62||Bt(P)?O(P):a(P)}function W(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):a(P)}function X(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),U}function U(P){return kt(P)?Rt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):_(P)}function _(P){return e.enter("htmlTextData"),s(P)}}const sd={name:"labelEnd",resolveAll:eC,resolveTo:tC,tokenize:nC},G0={tokenize:aC},Q0={tokenize:rC},X0={tokenize:oC};function eC(e){let t=-1;const a=[];for(;++t=3&&(u===null||tt(u))?(e.exit("thematicBreak"),t(u)):a(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),kt(u)?Rt(e,l,"whitespace")(u):l(u))}}const ra={continuation:{tokenize:fC},exit:vC,name:"list",tokenize:hC},pC={partial:!0,tokenize:bC},mC={partial:!0,tokenize:gC};function hC(e,t,a){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return l;function l(h){const f=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:tu(h)){if(r.containerState.type||(r.containerState.type=f,e.enter(f,{_container:!0})),f==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Ss,a,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return a(h)}function c(h){return tu(h)&&++s<10?(e.consume(h),c):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):a(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Hi,r.interrupt?a:d,e.attempt(pC,m,p))}function d(h){return r.containerState.initialBlankLine=!0,i++,m(h)}function p(h){return kt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),m):a(h)}function m(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function fC(e,t,a){const r=this;return r.containerState._closeFlow=void 0,e.check(Hi,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Rt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!kt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mC,t,s)(l))}function s(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Rt(e,e.attempt(ra,t,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function gC(e,t,a){const r=this;return Rt(e,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):a(i)}}function vC(e){e.exit(this.containerState.type)}function bC(e,t,a){const r=this;return Rt(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!kt(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):a(i)}}const oh={name:"setextUnderline",resolveTo:yC,tokenize:EC};function yC(e,t){let a=e.length,r,o,i;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){r=a;break}e[a][1].type==="paragraph"&&(o=a)}else e[a][1].type==="content"&&e.splice(a,1),!i&&e[a][1].type==="definition"&&(i=a);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function EC(e,t,a){const r=this;let o;return i;function i(u){let d=r.events.length,p;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){p=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),o=u,s(u)):a(u)}function s(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===o?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),kt(u)?Rt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||tt(u)?(e.exit("setextHeadingLine"),t(u)):a(u)}}const wC={tokenize:kC};function kC(e){const t=this,a=e.attempt(Hi,r,e.attempt(this.parser.constructs.flowInitial,o,Rt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(R0,o)),"linePrefix")));return a;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,a}}const xC={resolveAll:uv()},SC=cv("string"),CC=cv("text");function cv(e){return{resolveAll:uv(e==="text"?NC:void 0),tokenize:t};function t(a){const r=this,o=this.parser.constructs[e],i=a.attempt(o,s,l);return s;function s(d){return u(d)?i(d):l(d)}function l(d){if(d===null){a.consume(d);return}return a.enter("data"),a.consume(d),c}function c(d){return u(d)?(a.exit("data"),i(d)):(a.consume(d),c)}function u(d){if(d===null)return!0;const p=o[d];let m=-1;if(p)for(;++m-1){const l=s[0];typeof l=="string"?s[0]=l.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function qC(e,t){let a=-1;const r=[];let o;for(;++a0){const ht=xe.tokenStack[xe.tokenStack.length-1];(ht[1]||sh).call(xe,void 0,ht[0])}for(fe.position={start:lr(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:lr(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye0){const ht=xe.tokenStack[xe.tokenStack.length-1];(ht[1]||sh).call(xe,void 0,ht[0])}for(fe.position={start:lr(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:lr(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:a}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function XC(e,t){const a={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function eN(e,t){const a={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function tN(e,t){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=Ao(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let s,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+o,id:a+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function nN(e,t){const a={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function aN(e,t){if(e.options.allowDangerousHtml){const a={type:"raw",value:t.value};return e.patch(t,a),e.applyData(t,a)}}function mv(e,t){const a=t.referenceType;let r="]";if(a==="collapsed"?r+="[]":a==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function rN(e,t){const a=String(t.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return mv(e,t);const o={src:Ao(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function oN(e,t){const a={src:Ao(t.url)};t.alt!==null&&t.alt!==void 0&&(a.alt=t.alt),t.title!==null&&t.title!==void 0&&(a.title=t.title);const r={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,r),e.applyData(t,r)}function iN(e,t){const a={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,a);const r={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(t,r),e.applyData(t,r)}function sN(e,t){const a=String(t.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return mv(e,t);const o={href:Ao(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function lN(e,t){const a={href:Ao(t.url)};t.title!==null&&t.title!==void 0&&(a.title=t.title);const r={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cN(e,t,a){const r=e.all(t),o=a?uN(a):hv(t),i={},s=[];if(typeof t.checked=="boolean"){const d=r[0];let p;d&&d.type==="element"&&d.tagName==="p"?p=d:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l1}function dN(e,t){const a={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(a.start=t.start);++o0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},l=td(t.children[1]),c=Zg(t.children[t.children.length-1]);l&&c&&(s.position={start:l,end:c}),o.push(s)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function gN(e,t,a){const r=a?a.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=a&&a.type==="table"?a.align:void 0,l=s?s.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),o=r.index+r[0].length,r=a.exec(t);return i.push(uh(t.slice(o),o>0,!1)),i.join("")}function uh(e,t,a){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===lh||i===ch;)r++,i=e.codePointAt(r)}if(a){let i=e.codePointAt(o-1);for(;i===lh||i===ch;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function yN(e,t){const a={type:"text",value:bN(String(t.value))};return e.patch(t,a),e.applyData(t,a)}function EN(e,t){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,a),e.applyData(t,a)}const wN={blockquote:YC,break:GC,code:QC,delete:XC,emphasis:eN,footnoteReference:tN,heading:nN,html:aN,imageReference:rN,image:oN,inlineCode:iN,linkReference:sN,link:lN,listItem:cN,list:dN,paragraph:pN,root:mN,strong:hN,table:fN,tableCell:vN,tableRow:gN,text:yN,thematicBreak:EN,toml:Qi,yaml:Qi,definition:Qi,footnoteDefinition:Qi};function Qi(){}const fv=-1,ul=0,fi=1,Fs=2,ld=3,cd=4,ud=5,dd=6,gv=7,vv=8,{defineProperty:kN}=Object,bv=typeof self=="object"?self:globalThis,dh=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new bv[e](t)},xN=(e,t)=>{const a=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,s]=t[o];switch(i){case ul:case fv:return a(s,o);case fi:{const l=a([],o);for(const c of s)l.push(r(c));return l}case Fs:{const l=a({},o);for(const[c,u]of s){const d=r(c),p=r(u);d==="__proto__"?kN(l,d,{value:p,configurable:!0,enumerable:!0,writable:!0}):l[d]=p}return l}case ld:return a(new Date(s),o);case cd:{const{source:l,flags:c}=s;return a(new RegExp(l,c),o)}case ud:{const l=a(new Map,o);for(const[c,u]of s)l.set(r(c),r(u));return l}case dd:{const l=a(new Set,o);for(const c of s)l.add(r(c));return l}case gv:{const{name:l,message:c}=s;return a(typeof bv[l]=="function"?dh(l,c):new Error(c),o)}case vv:return a(BigInt(s),o);case"BigInt":return a(Object(BigInt(s)),o);case"ArrayBuffer":return a(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:l}=new Uint8Array(s);return a(new DataView(l),s)}case"-0":return-0}return a(dh(i,s),o)};return r},ph=e=>xN(new Map,e)(0),Ar="",{toString:SN}={},{keys:CN,is:NN}=Object,Go=e=>{const t=typeof e;if(t!=="object"||!e)return[ul,t];const a=SN.call(e).slice(8,-1);switch(a){case"Array":return[fi,Ar];case"Object":return[Fs,Ar];case"Date":return[ld,Ar];case"RegExp":return[cd,Ar];case"Map":return[ud,Ar];case"Set":return[dd,Ar];case"DataView":return[fi,a]}return a.includes("Array")?[fi,a]:e instanceof Error?[gv,e.name||"Error"]:[Fs,a]},Xi=([e,t])=>e===ul&&(t==="function"||t==="symbol"),RN=(e,t,a,r)=>{const o=(s,l)=>{const c=r.push(s)-1;return a.set(l,c),c},i=s=>{if(a.has(s))return a.get(s);let[l,c]=Go(s);switch(l){case ul:{let d=s;switch(c){case"bigint":l=vv,d=s.toString();break;case"number":if(!s&&NN(s,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([fv],s)}return o([l,d],s)}case fi:{if(c){let m=s;return c==="DataView"?m=new Uint8Array(s.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(s)),o([c,[...m]],s)}const d=[],p=o([l,d],s);for(const m of s)d.push(i(m));return p}case Fs:{if(c)switch(c){case"BigInt":return o([c,s.toString()],s);case"Boolean":case"Number":case"String":return o([c,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const d=[],p=o([l,d],s);for(const m of CN(s))(e||!Xi(Go(s[m])))&&d.push([i(m),i(s[m])]);return p}case ld:return o([l,isNaN(s.getTime())?Ar:s.toISOString()],s);case cd:{const{source:d,flags:p}=s;return o([l,{source:d,flags:p}],s)}case ud:{const d=[],p=o([l,d],s);for(const[m,h]of s)(e||!(Xi(Go(m))||Xi(Go(h))))&&d.push([i(m),i(h)]);return p}case dd:{const d=[],p=o([l,d],s);for(const m of s)(e||!Xi(Go(m)))&&d.push(i(m));return p}}const{message:u}=s;return o([l,{name:c,message:u}],s)};return i},mh=(e,{json:t,lossy:a}={})=>{const r=[];return RN(!(t||a),!!t,new Map,r)(e),r},qs=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ph(mh(e,t)):structuredClone(e):(e,t)=>ph(mh(e,t));function TN(e,t){const a=[{type:"text",value:"↩"}];return t>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),a}function IN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function AN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||TN,r=e.options.footnoteBackLabel||IN,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&f.push({type:"text",value:" "});let b=typeof a=="string"?a:a(c,h);typeof b=="string"&&(b={type:"text",value:b}),f.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const b=y.children[y.children.length-1];b&&b.type==="text"?b.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...f)}else d.push(...f);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,E),l.push(E)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...qs(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,u),e.applyData(t,u)}function uN(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const a=e.children;let r=-1;for(;!t&&++r1}function dN(e,t){const a={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(a.start=t.start);++o0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},l=td(t.children[1]),c=Zg(t.children[t.children.length-1]);l&&c&&(s.position={start:l,end:c}),o.push(s)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function gN(e,t,a){const r=a?a.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=a&&a.type==="table"?a.align:void 0,l=s?s.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),o=r.index+r[0].length,r=a.exec(t);return i.push(uh(t.slice(o),o>0,!1)),i.join("")}function uh(e,t,a){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===lh||i===ch;)r++,i=e.codePointAt(r)}if(a){let i=e.codePointAt(o-1);for(;i===lh||i===ch;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function yN(e,t){const a={type:"text",value:bN(String(t.value))};return e.patch(t,a),e.applyData(t,a)}function EN(e,t){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,a),e.applyData(t,a)}const wN={blockquote:YC,break:GC,code:QC,delete:XC,emphasis:eN,footnoteReference:tN,heading:nN,html:aN,imageReference:rN,image:oN,inlineCode:iN,linkReference:sN,link:lN,listItem:cN,list:dN,paragraph:pN,root:mN,strong:hN,table:fN,tableCell:vN,tableRow:gN,text:yN,thematicBreak:EN,toml:Qi,yaml:Qi,definition:Qi,footnoteDefinition:Qi};function Qi(){}const fv=-1,ul=0,fi=1,Fs=2,ld=3,cd=4,ud=5,dd=6,gv=7,vv=8,{defineProperty:kN}=Object,bv=typeof self=="object"?self:globalThis,dh=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new bv[e](t)},xN=(e,t)=>{const a=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,s]=t[o];switch(i){case ul:case fv:return a(s,o);case fi:{const l=a([],o);for(const c of s)l.push(r(c));return l}case Fs:{const l=a({},o);for(const[c,u]of s){const d=r(c),p=r(u);d==="__proto__"?kN(l,d,{value:p,configurable:!0,enumerable:!0,writable:!0}):l[d]=p}return l}case ld:return a(new Date(s),o);case cd:{const{source:l,flags:c}=s;return a(new RegExp(l,c),o)}case ud:{const l=a(new Map,o);for(const[c,u]of s)l.set(r(c),r(u));return l}case dd:{const l=a(new Set,o);for(const c of s)l.add(r(c));return l}case gv:{const{name:l,message:c}=s;return a(typeof bv[l]=="function"?dh(l,c):new Error(c),o)}case vv:return a(BigInt(s),o);case"BigInt":return a(Object(BigInt(s)),o);case"ArrayBuffer":return a(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:l}=new Uint8Array(s);return a(new DataView(l),s)}case"-0":return-0}return a(dh(i,s),o)};return r},ph=e=>xN(new Map,e)(0),Ar="",{toString:SN}={},{keys:CN,is:NN}=Object,Go=e=>{const t=typeof e;if(t!=="object"||!e)return[ul,t];const a=SN.call(e).slice(8,-1);switch(a){case"Array":return[fi,Ar];case"Object":return[Fs,Ar];case"Date":return[ld,Ar];case"RegExp":return[cd,Ar];case"Map":return[ud,Ar];case"Set":return[dd,Ar];case"DataView":return[fi,a]}return a.includes("Array")?[fi,a]:e instanceof Error?[gv,e.name||"Error"]:[Fs,a]},Xi=([e,t])=>e===ul&&(t==="function"||t==="symbol"),RN=(e,t,a,r)=>{const o=(s,l)=>{const c=r.push(s)-1;return a.set(l,c),c},i=s=>{if(a.has(s))return a.get(s);let[l,c]=Go(s);switch(l){case ul:{let d=s;switch(c){case"bigint":l=vv,d=s.toString();break;case"number":if(!s&&NN(s,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([fv],s)}return o([l,d],s)}case fi:{if(c){let m=s;return c==="DataView"?m=new Uint8Array(s.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(s)),o([c,[...m]],s)}const d=[],p=o([l,d],s);for(const m of s)d.push(i(m));return p}case Fs:{if(c)switch(c){case"BigInt":return o([c,s.toString()],s);case"Boolean":case"Number":case"String":return o([c,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const d=[],p=o([l,d],s);for(const m of CN(s))(e||!Xi(Go(s[m])))&&d.push([i(m),i(s[m])]);return p}case ld:return o([l,isNaN(s.getTime())?Ar:s.toISOString()],s);case cd:{const{source:d,flags:p}=s;return o([l,{source:d,flags:p}],s)}case ud:{const d=[],p=o([l,d],s);for(const[m,h]of s)(e||!(Xi(Go(m))||Xi(Go(h))))&&d.push([i(m),i(h)]);return p}case dd:{const d=[],p=o([l,d],s);for(const m of s)(e||!Xi(Go(m)))&&d.push(i(m));return p}}const{message:u}=s;return o([l,{name:c,message:u}],s)};return i},mh=(e,{json:t,lossy:a}={})=>{const r=[];return RN(!(t||a),!!t,new Map,r)(e),r},qs=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ph(mh(e,t)):structuredClone(e):(e,t)=>ph(mh(e,t));function TN(e,t){const a=[{type:"text",value:"↩"}];return t>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),a}function IN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function AN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||TN,r=e.options.footnoteBackLabel||IN,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&f.push({type:"text",value:" "});let b=typeof a=="string"?a:a(c,h);typeof b=="string"&&(b={type:"text",value:b}),f.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const E=d[d.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const b=E.children[E.children.length-1];b&&b.type==="text"?b.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...f)}else d.push(...f);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...qs(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const dl=(function(e){if(e==null)return MN;if(typeof e=="function")return pl(e);if(typeof e=="object")return Array.isArray(e)?_N(e):PN(e);if(typeof e=="string")return ON(e);throw new Error("Expected function, string, or object as test")});function _N(e){const t=[];let a=-1;for(;++a":""))+")"})}return m;function m(){let h=yv,f,g,y;if((!t||i(c,u,d[d.length-1]||void 0))&&(h=FN(a(c,d)),h[0]===au))return h;if("children"in c&&c.children){const E=c;if(E.children&&h[0]!==DN)for(g=(r?E.children.length:-1)+s,y=d.concat(E);g>-1&&g":""))+")"})}return m;function m(){let h=yv,f,g,E;if((!t||i(c,u,d[d.length-1]||void 0))&&(h=FN(a(c,d)),h[0]===au))return h;if("children"in c&&c.children){const y=c;if(y.children&&h[0]!==DN)for(g=(r?y.children.length:-1)+s,E=d.concat(y);g>-1&&g0&&a.push({type:"text",value:` `}),a}function hh(e){let t=0,a=e.charCodeAt(t);for(;a===9||a===32;)t++,a=e.charCodeAt(t);return e.slice(t)}function fh(e,t){const a=UN(e,t),r=a.one(e,void 0),o=AN(a),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:` -`},o),i}function VN(e,t){return e&&"run"in e?async function(a,r){const o=fh(a,{file:r,...t});await e.run(o,r)}:function(a,r){return fh(a,{file:r,...e||t})}}function gh(e){if(e)throw e}var ac,vh;function WN(){if(vh)return ac;vh=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,a=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},i=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),p=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!p)return!1;var m;for(m in u);return typeof m>"u"||e.call(u,m)},s=function(u,d){a&&d.name==="__proto__"?a(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return ac=function c(){var u,d,p,m,h,f,g=arguments[0],y=1,E=arguments.length,b=!1;for(typeof g=="boolean"&&(b=g,g=arguments[1]||{},y=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});ys.length;let c;l&&s.push(o);try{c=e.apply(this,s)}catch(u){const d=u;if(l&&a)throw d;return o(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,o):c instanceof Error?o(c):i(c))}function o(s,...l){a||(a=!0,t(s,...l))}function i(s){o(null,s)}}const Ba={basename:YN,dirname:GN,extname:QN,join:XN,sep:"/"};function YN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vi(e);let a=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){a=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(a,r)}if(t===e)return"";let s=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){a=o+1;break}}else s<0&&(i=!0,s=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=s));return a===r?r=s:r<0&&(r=e.length),e.slice(a,r)}function GN(e){if(Vi(e),e.length===0)return".";let t=-1,a=e.length,r;for(;--a;)if(e.codePointAt(a)===47){if(r){t=a;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function QN(e){Vi(e);let t=e.length,a=-1,r=0,o=-1,i=0,s;for(;t--;){const l=e.codePointAt(t);if(l===47){if(s){r=t+1;break}continue}a<0&&(s=!0,a=t+1),l===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||a<0||i===0||i===1&&o===a-1&&o===r+1?"":e.slice(o,a)}function XN(...e){let t=-1,a;for(;++t0&&e.codePointAt(e.length-1)===47&&(a+="/"),t?"/"+a:a}function tR(e,t){let a="",r=0,o=-1,i=0,s=-1,l,c;for(;++s<=e.length;){if(s2){if(c=a.lastIndexOf("/"),c!==a.length-1){c<0?(a="",r=0):(a=a.slice(0,c),r=a.length-1-a.lastIndexOf("/")),o=s,i=0;continue}}else if(a.length>0){a="",r=0,o=s,i=0;continue}}t&&(a=a.length>0?a+"/..":"..",r=2)}else a.length>0?a+="/"+e.slice(o+1,s):a=e.slice(o+1,s),r=s-o-1;o=s,i=0}else l===46&&i>-1?i++:i=-1}return a}function Vi(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const nR={cwd:aR};function aR(){return"/"}function iu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function rR(e){if(typeof e=="string")e=new URL(e);else if(!iu(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return oR(e)}function oR(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let a=-1;for(;++a0){let[h,...f]=d;const g=r[m][1];ou(g)&&ou(h)&&(h=rc(!0,g,h)),r[m]=[u,h,...f]}}}}const cR=new md().freeze();function lc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function uc(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yh(e){if(!ou(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Eh(e,t,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function es(e){return uR(e)?e:new wv(e)}function uR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function dR(e){return typeof e=="string"||pR(e)}function pR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",wh=[],kh={allowDangerousHtml:!0},hR=/^(https?|ircs?|mailto|xmpp)$/i,fR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function gR(e){const t=vR(e),a=bR(e);return yR(t.runSync(t.parse(a),a),e)}function vR(e){const t=e.rehypePlugins||wh,a=e.remarkPlugins||wh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kh}:kh;return cR().use(KC).use(a).use(VN,r).use(t)}function bR(e){const t=e.children||"",a=new wv;return typeof t=="string"&&(a.value=t),a}function yR(e,t){const a=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||kv;for(const d of fR)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+mR+d.id,void 0);return pd(e,u),A1(e,{Fragment:ec.Fragment,components:o,ignoreInvalidStyle:!0,jsx:ec.jsx,jsxs:ec.jsxs,passKeys:!0,passNode:!0});function u(d,p,m){if(d.type==="raw"&&m&&typeof p=="number")return s?m.children.splice(p,1):m.children[p]={type:"text",value:d.value},p;if(d.type==="element"){let h;for(h in Ql)if(Object.hasOwn(Ql,h)&&Object.hasOwn(d.properties,h)){const f=d.properties[h],g=Ql[h];(g===null||g.includes(d.tagName))&&(d.properties[h]=c(String(f||""),h,d))}}if(d.type==="element"){let h=a?!a.includes(d.tagName):i?i.includes(d.tagName):!1;if(!h&&r&&typeof p=="number"&&(h=!r(d,p,m)),h&&m&&typeof p=="number")return l&&d.children?m.children.splice(p,1,...d.children):m.children.splice(p,1),p}}}function kv(e){const t=e.indexOf(":"),a=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||a!==-1&&t>a||r!==-1&&t>r||hR.test(e.slice(0,t))?e:""}function xh(e,t){const a=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=a.indexOf(t);for(;o!==-1;)r++,o=a.indexOf(t,o+t.length);return r}function ER(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wR(e,t,a){const o=dl((a||{}).ignore||[]),i=kR(t);let s=-1;for(;++s0?{type:"text",value:x}:void 0),x===!1?m.lastIndex=w+1:(f!==w&&b.push({type:"text",value:u.value.slice(f,w)}),Array.isArray(x)?b.push(...x):x&&b.push(x),f=w+S[0].length,E=!0),!m.global)break;S=m.exec(u.value)}return E?(f?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let a=t[0],r=a.indexOf(")");const o=xh(e,"(");let i=xh(e,")");for(;r!==-1&&o>i;)e+=a.slice(0,r+1),a=a.slice(r+1),r=a.indexOf(")"),i++;return[e,a]}function xv(e,t){const a=e.input.charCodeAt(e.index-1);return(e.index===0||jr(a)||ll(a))&&(!t||a!==47)}Sv.peek=VR;function DR(){this.buffer()}function FR(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function qR(){this.buffer()}function UR(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function jR(e){const t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Fa(this.sliceSerialize(e)).toLowerCase(),a.label=t}function $R(e){this.exit(e)}function BR(e){const t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Fa(this.sliceSerialize(e)).toLowerCase(),a.label=t}function HR(e){this.exit(e)}function VR(){return"["}function Sv(e,t,a,r){const o=a.createTracker(r);let i=o.move("[^");const s=a.enter("footnoteReference"),l=a.enter("reference");return i+=o.move(a.safe(a.associationId(e),{after:"]",before:i})),l(),s(),i+=o.move("]"),i}function WR(){return{enter:{gfmFootnoteCallString:DR,gfmFootnoteCall:FR,gfmFootnoteDefinitionLabelString:qR,gfmFootnoteDefinition:UR},exit:{gfmFootnoteCallString:jR,gfmFootnoteCall:$R,gfmFootnoteDefinitionLabelString:BR,gfmFootnoteDefinition:HR}}}function ZR(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:a,footnoteReference:Sv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(r,o,i,s){const l=i.createTracker(s);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?` -`:" ")+i.indentLines(i.containerFlow(r,l.current()),t?Cv:JR))),u(),c}}function JR(e,t,a){return t===0?e:Cv(e,t,a)}function Cv(e,t,a){return(a?"":" ")+e}const KR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Nv.peek=eT;function YR(){return{canContainEols:["delete"],enter:{strikethrough:QR},exit:{strikethrough:XR}}}function GR(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:KR}],handlers:{delete:Nv}}}function QR(e){this.enter({type:"delete",children:[]},e)}function XR(e){this.exit(e)}function Nv(e,t,a,r){const o=a.createTracker(r),i=a.enter("strikethrough");let s=o.move("~~");return s+=a.containerPhrasing(e,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function eT(){return"~"}function tT(e){return e.length}function nT(e,t){const a=t||{},r=(a.align||[]).concat(),o=a.stringLength||tT,i=[],s=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++Ec[E])&&(c[E]=S)}g.push(b)}s[d]=g,l[d]=y}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pc[p]&&(c[p]=b),h[p]=b),m[p]=S}s.splice(1,0,m),l.splice(1,0,h),d=-1;const f=[];for(;++d"u"||e.call(u,m)},s=function(u,d){a&&d.name==="__proto__"?a(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return ac=function c(){var u,d,p,m,h,f,g=arguments[0],E=1,y=arguments.length,b=!1;for(typeof g=="boolean"&&(b=g,g=arguments[1]||{},E=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});Es.length;let c;l&&s.push(o);try{c=e.apply(this,s)}catch(u){const d=u;if(l&&a)throw d;return o(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,o):c instanceof Error?o(c):i(c))}function o(s,...l){a||(a=!0,t(s,...l))}function i(s){o(null,s)}}const Ba={basename:YN,dirname:GN,extname:QN,join:XN,sep:"/"};function YN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vi(e);let a=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){a=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(a,r)}if(t===e)return"";let s=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){a=o+1;break}}else s<0&&(i=!0,s=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=s));return a===r?r=s:r<0&&(r=e.length),e.slice(a,r)}function GN(e){if(Vi(e),e.length===0)return".";let t=-1,a=e.length,r;for(;--a;)if(e.codePointAt(a)===47){if(r){t=a;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function QN(e){Vi(e);let t=e.length,a=-1,r=0,o=-1,i=0,s;for(;t--;){const l=e.codePointAt(t);if(l===47){if(s){r=t+1;break}continue}a<0&&(s=!0,a=t+1),l===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||a<0||i===0||i===1&&o===a-1&&o===r+1?"":e.slice(o,a)}function XN(...e){let t=-1,a;for(;++t0&&e.codePointAt(e.length-1)===47&&(a+="/"),t?"/"+a:a}function tR(e,t){let a="",r=0,o=-1,i=0,s=-1,l,c;for(;++s<=e.length;){if(s2){if(c=a.lastIndexOf("/"),c!==a.length-1){c<0?(a="",r=0):(a=a.slice(0,c),r=a.length-1-a.lastIndexOf("/")),o=s,i=0;continue}}else if(a.length>0){a="",r=0,o=s,i=0;continue}}t&&(a=a.length>0?a+"/..":"..",r=2)}else a.length>0?a+="/"+e.slice(o+1,s):a=e.slice(o+1,s),r=s-o-1;o=s,i=0}else l===46&&i>-1?i++:i=-1}return a}function Vi(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const nR={cwd:aR};function aR(){return"/"}function iu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function rR(e){if(typeof e=="string")e=new URL(e);else if(!iu(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return oR(e)}function oR(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let a=-1;for(;++a0){let[h,...f]=d;const g=r[m][1];ou(g)&&ou(h)&&(h=rc(!0,g,h)),r[m]=[u,h,...f]}}}}const cR=new md().freeze();function lc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function uc(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yh(e){if(!ou(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Eh(e,t,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function es(e){return uR(e)?e:new wv(e)}function uR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function dR(e){return typeof e=="string"||pR(e)}function pR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",wh=[],kh={allowDangerousHtml:!0},hR=/^(https?|ircs?|mailto|xmpp)$/i,fR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function gR(e){const t=vR(e),a=bR(e);return yR(t.runSync(t.parse(a),a),e)}function vR(e){const t=e.rehypePlugins||wh,a=e.remarkPlugins||wh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kh}:kh;return cR().use(KC).use(a).use(VN,r).use(t)}function bR(e){const t=e.children||"",a=new wv;return typeof t=="string"&&(a.value=t),a}function yR(e,t){const a=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||kv;for(const d of fR)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+mR+d.id,void 0);return pd(e,u),A1(e,{Fragment:ec.Fragment,components:o,ignoreInvalidStyle:!0,jsx:ec.jsx,jsxs:ec.jsxs,passKeys:!0,passNode:!0});function u(d,p,m){if(d.type==="raw"&&m&&typeof p=="number")return s?m.children.splice(p,1):m.children[p]={type:"text",value:d.value},p;if(d.type==="element"){let h;for(h in Ql)if(Object.hasOwn(Ql,h)&&Object.hasOwn(d.properties,h)){const f=d.properties[h],g=Ql[h];(g===null||g.includes(d.tagName))&&(d.properties[h]=c(String(f||""),h,d))}}if(d.type==="element"){let h=a?!a.includes(d.tagName):i?i.includes(d.tagName):!1;if(!h&&r&&typeof p=="number"&&(h=!r(d,p,m)),h&&m&&typeof p=="number")return l&&d.children?m.children.splice(p,1,...d.children):m.children.splice(p,1),p}}}function kv(e){const t=e.indexOf(":"),a=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||a!==-1&&t>a||r!==-1&&t>r||hR.test(e.slice(0,t))?e:""}function xh(e,t){const a=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=a.indexOf(t);for(;o!==-1;)r++,o=a.indexOf(t,o+t.length);return r}function ER(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wR(e,t,a){const o=dl((a||{}).ignore||[]),i=kR(t);let s=-1;for(;++s0?{type:"text",value:x}:void 0),x===!1?m.lastIndex=w+1:(f!==w&&b.push({type:"text",value:u.value.slice(f,w)}),Array.isArray(x)?b.push(...x):x&&b.push(x),f=w+S[0].length,y=!0),!m.global)break;S=m.exec(u.value)}return y?(f?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let a=t[0],r=a.indexOf(")");const o=xh(e,"(");let i=xh(e,")");for(;r!==-1&&o>i;)e+=a.slice(0,r+1),a=a.slice(r+1),r=a.indexOf(")"),i++;return[e,a]}function xv(e,t){const a=e.input.charCodeAt(e.index-1);return(e.index===0||jr(a)||ll(a))&&(!t||a!==47)}Sv.peek=VR;function DR(){this.buffer()}function FR(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function qR(){this.buffer()}function UR(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function jR(e){const t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Fa(this.sliceSerialize(e)).toLowerCase(),a.label=t}function $R(e){this.exit(e)}function BR(e){const t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Fa(this.sliceSerialize(e)).toLowerCase(),a.label=t}function HR(e){this.exit(e)}function VR(){return"["}function Sv(e,t,a,r){const o=a.createTracker(r);let i=o.move("[^");const s=a.enter("footnoteReference"),l=a.enter("reference");return i+=o.move(a.safe(a.associationId(e),{after:"]",before:i})),l(),s(),i+=o.move("]"),i}function WR(){return{enter:{gfmFootnoteCallString:DR,gfmFootnoteCall:FR,gfmFootnoteDefinitionLabelString:qR,gfmFootnoteDefinition:UR},exit:{gfmFootnoteCallString:jR,gfmFootnoteCall:$R,gfmFootnoteDefinitionLabelString:BR,gfmFootnoteDefinition:HR}}}function ZR(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:a,footnoteReference:Sv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(r,o,i,s){const l=i.createTracker(s);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?` +`:" ")+i.indentLines(i.containerFlow(r,l.current()),t?Cv:JR))),u(),c}}function JR(e,t,a){return t===0?e:Cv(e,t,a)}function Cv(e,t,a){return(a?"":" ")+e}const KR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Nv.peek=eT;function YR(){return{canContainEols:["delete"],enter:{strikethrough:QR},exit:{strikethrough:XR}}}function GR(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:KR}],handlers:{delete:Nv}}}function QR(e){this.enter({type:"delete",children:[]},e)}function XR(e){this.exit(e)}function Nv(e,t,a,r){const o=a.createTracker(r),i=a.enter("strikethrough");let s=o.move("~~");return s+=a.containerPhrasing(e,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function eT(){return"~"}function tT(e){return e.length}function nT(e,t){const a=t||{},r=(a.align||[]).concat(),o=a.stringLength||tT,i=[],s=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=S)}g.push(b)}s[d]=g,l[d]=E}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pc[p]&&(c[p]=b),h[p]=b),m[p]=S}s.splice(1,0,m),l.splice(1,0,h),d=-1;const f=[];for(;++d "),i.shift(2);const s=a.indentLines(a.containerFlow(e,i.current()),oT);return o(),s}function oT(e,t,a){return">"+(a?"":" ")+e}function iT(e,t){return Ch(e,t.inConstruct,!0)&&!Ch(e,t.notInConstruct,!1)}function Ch(e,t,a){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return a;let r=-1;for(;++rs&&(s=i):i=1,o=r+t.length,r=a.indexOf(t,o);return s}function lT(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function cT(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function uT(e,t,a,r){const o=cT(a),i=e.value||"",s=o==="`"?"GraveAccent":"Tilde";if(lT(e,a)){const p=a.enter("codeIndented"),m=a.indentLines(i,dT);return p(),m}const l=a.createTracker(r),c=o.repeat(Math.max(sT(i,o)+1,3)),u=a.enter("codeFenced");let d=l.move(c);if(e.lang){const p=a.enter(`codeFencedLang${s}`);d+=l.move(a.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),p()}if(e.lang&&e.meta){const p=a.enter(`codeFencedMeta${s}`);d+=l.move(" "),d+=l.move(a.safe(e.meta,{before:d,after:` @@ -548,16 +548,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `+(o===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(` `))+1))}const s="#".repeat(o),l=a.enter("headingAtx"),c=a.enter("phrasing");i.move(s+" ");let u=a.containerPhrasing(e,{before:"# ",after:` `,...i.current()});return/^[\t ]/.test(u)&&(u=xi(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,a.options.closeAtx&&(u+=" "+s),c(),l(),u}Tv.peek=vT;function Tv(e){return e.value||""}function vT(){return"<"}Iv.peek=bT;function Iv(e,t,a,r){const o=hd(a),i=o==='"'?"Quote":"Apostrophe",s=a.enter("image");let l=a.enter("label");const c=a.createTracker(r);let u=c.move("![");return u+=c.move(a.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=a.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(a.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=a.enter("destinationRaw"),u+=c.move(a.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=a.enter(`title${i}`),u+=c.move(" "+o),u+=c.move(a.safe(e.title,{before:u,after:o,...c.current()})),u+=c.move(o),l()),u+=c.move(")"),s(),u}function bT(){return"!"}Av.peek=yT;function Av(e,t,a,r){const o=e.referenceType,i=a.enter("imageReference");let s=a.enter("label");const l=a.createTracker(r);let c=l.move("![");const u=a.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),s();const d=a.stack;a.stack=[],s=a.enter("reference");const p=a.safe(a.associationId(e),{before:c,after:"]",...l.current()});return s(),a.stack=d,i(),o==="full"||!u||u!==p?c+=l.move(p+"]"):o==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function yT(){return"!"}_v.peek=ET;function _v(e,t,a){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(e.url))}Ov.peek=wT;function Ov(e,t,a,r){const o=hd(a),i=o==='"'?"Quote":"Apostrophe",s=a.createTracker(r);let l,c;if(Pv(e,a)){const d=a.stack;a.stack=[],l=a.enter("autolink");let p=s.move("<");return p+=s.move(a.containerPhrasing(e,{before:p,after:">",...s.current()})),p+=s.move(">"),l(),a.stack=d,p}l=a.enter("link"),c=a.enter("label");let u=s.move("[");return u+=s.move(a.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=a.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(a.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(c=a.enter("destinationRaw"),u+=s.move(a.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),c(),e.title&&(c=a.enter(`title${i}`),u+=s.move(" "+o),u+=s.move(a.safe(e.title,{before:u,after:o,...s.current()})),u+=s.move(o),c()),u+=s.move(")"),l(),u}function wT(e,t,a){return Pv(e,a)?"<":"["}Mv.peek=kT;function Mv(e,t,a,r){const o=e.referenceType,i=a.enter("linkReference");let s=a.enter("label");const l=a.createTracker(r);let c=l.move("[");const u=a.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),s();const d=a.stack;a.stack=[],s=a.enter("reference");const p=a.safe(a.associationId(e),{before:c,after:"]",...l.current()});return s(),a.stack=d,i(),o==="full"||!u||u!==p?c+=l.move(p+"]"):o==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function kT(){return"["}function fd(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function xT(e){const t=fd(e),a=e.options.bulletOther;if(!a)return t==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+a+"`) to be different");return a}function ST(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function zv(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function CT(e,t,a,r){const o=a.enter("list"),i=a.bulletCurrent;let s=e.ordered?ST(a):fd(a);const l=e.ordered?s==="."?")":".":xT(a);let c=t&&a.bulletLastUsed?s===a.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&d&&(!d.children||!d.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(c=!0),zv(a)===s&&d){let p=-1;for(;++p-1?t.start:1)+(a.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let s=i.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const l=a.createTracker(r);l.move(i+" ".repeat(s-i.length)),l.shift(s);const c=a.enter("listItem"),u=a.indentLines(a.containerFlow(e,l.current()),d);return c(),u;function d(p,m,h){return m?(h?"":" ".repeat(s))+p:(h?i:i+" ".repeat(s-i.length))+p}}function TT(e,t,a,r){const o=a.enter("paragraph"),i=a.enter("phrasing"),s=a.containerPhrasing(e,r);return i(),o(),s}const IT=dl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function AT(e,t,a,r){return(e.children.some(function(s){return IT(s)})?a.containerPhrasing:a.containerFlow).call(a,e,r)}function _T(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Lv.peek=PT;function Lv(e,t,a,r){const o=_T(a),i=a.enter("strong"),s=a.createTracker(r),l=s.move(o+o);let c=s.move(a.containerPhrasing(e,{after:o,before:l,...s.current()}));const u=c.charCodeAt(0),d=Us(r.before.charCodeAt(r.before.length-1),u,o);d.inside&&(c=xi(u)+c.slice(1));const p=c.charCodeAt(c.length-1),m=Us(r.after.charCodeAt(0),p,o);m.inside&&(c=c.slice(0,-1)+xi(p));const h=s.move(o+o);return i(),a.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+c+h}function PT(e,t,a){return a.options.strong||"*"}function OT(e,t,a,r){return a.safe(e.value,r)}function MT(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function zT(e,t,a){const r=(zv(a)+(a.options.ruleSpaces?" ":"")).repeat(MT(a));return a.options.ruleSpaces?r.slice(0,-1):r}const Dv={blockquote:rT,break:Nh,code:uT,definition:pT,emphasis:Rv,hardBreak:Nh,heading:gT,html:Tv,image:Iv,imageReference:Av,inlineCode:_v,link:Ov,linkReference:Mv,list:CT,listItem:RT,paragraph:TT,root:AT,strong:Lv,text:OT,thematicBreak:zT};function LT(){return{enter:{table:DT,tableData:Rh,tableHeader:Rh,tableRow:qT},exit:{codeText:UT,table:FT,tableData:hc,tableHeader:hc,tableRow:hc}}}function DT(e){const t=e._align;this.enter({type:"table",align:t.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function FT(e){this.exit(e),this.data.inTable=void 0}function qT(e){this.enter({type:"tableRow",children:[]},e)}function hc(e){this.exit(e)}function Rh(e){this.enter({type:"tableCell",children:[]},e)}function UT(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,jT));const a=this.stack[this.stack.length-1];a.type,a.value=t,this.exit(e)}function jT(e,t){return t==="|"?t:e}function $T(e){const t=e||{},a=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:s,tableCell:c,tableRow:l}};function s(h,f,g,y){return u(d(h,g,y),h.align)}function l(h,f,g,y){const E=p(h,g,y),b=u([E]);return b.slice(0,b.indexOf(` -`))}function c(h,f,g,y){const E=g.enter("tableCell"),b=g.enter("phrasing"),S=g.containerPhrasing(h,{...y,before:i,after:i});return b(),E(),S}function u(h,f){return nT(h,{align:f,alignDelimiters:r,padding:a,stringLength:o})}function d(h,f,g){const y=h.children;let E=-1;const b=[],S=f.enter("table");for(;++E0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const iI={tokenize:hI,partial:!0};function sI(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:dI,continuation:{tokenize:pI},exit:mI}},text:{91:{name:"gfmFootnoteCall",tokenize:uI},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lI,resolveTo:cI}}}}function lI(e,t,a){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const c=r.events[o][1];if(c.type==="labelImage"){s=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!s||!s._balanced)return a(c);const u=Fa(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?a(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function cI(e,t){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...l),e}function uI(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return l;function l(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),c}function c(p){return p!==94?a(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(p){if(i>999||p===93&&!s||p===null||p===91||Bt(p))return a(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return o.includes(Fa(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(p)}return Bt(p)||(s=!0),i++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),i++,u):u(p)}}function dI(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,l;return c;function c(f){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(f){return f===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):a(f)}function d(f){if(s>999||f===93&&!l||f===null||f===91||Bt(f))return a(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=Fa(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Bt(f)||(l=!0),s++,e.consume(f),f===92?p:d}function p(f){return f===91||f===92||f===93?(e.consume(f),s++,d):d(f)}function m(f){return f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),o.includes(i)||o.push(i),Rt(e,h,"gfmFootnoteDefinitionWhitespace")):a(f)}function h(f){return t(f)}}function pI(e,t,a){return e.check(Hi,t,e.attempt(iI,t,a))}function mI(e){e.exit("gfmFootnoteDefinition")}function hI(e,t,a){const r=this;return Rt(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):a(i)}}function fI(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(s,l){let c=-1;for(;++c1?c(f):(s.consume(f),p++,h);if(p<2&&!a)return c(f);const y=s.exit("strikethroughSequenceTemporary"),E=bo(f);return y._open=!E||E===2&&!!g,y._close=!g||g===2&&!!E,l(f)}}}class gI{constructor(){this.map=[]}add(t,a,r){vI(this,t,a,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function vI(e,t,a,r){let o=0;if(!(a===0&&r.length===0)){for(;o-1;){const z=r.events[T][1].type;if(z==="lineEnding"||z==="linePrefix")T--;else break}const I=T>-1?r.events[T][1].type:null,F=I==="tableHead"||I==="tableRow"?x:c;return F===x&&r.parser.lazy[r.now().line]?a(k):F(k)}function c(k){return e.enter("tableHead"),e.enter("tableRow"),u(k)}function u(k){return k===124||(s=!0,i+=1),d(k)}function d(k){return k===null?a(k):tt(k)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),h):a(k):kt(k)?Rt(e,d,"whitespace")(k):(i+=1,s&&(s=!1,o+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),p(k)))}function p(k){return k===null||k===124||Bt(k)?(e.exit("data"),d(k)):(e.consume(k),k===92?m:p)}function m(k){return k===92||k===124?(e.consume(k),p):p(k)}function h(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(k):(e.enter("tableDelimiterRow"),s=!1,kt(k)?Rt(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):f(k))}function f(k){return k===45||k===58?y(k):k===124?(s=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),g):N(k)}function g(k){return kt(k)?Rt(e,y,"whitespace")(k):y(k)}function y(k){return k===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),E):k===45?(i+=1,E(k)):k===null||tt(k)?w(k):N(k)}function E(k){return k===45?(e.enter("tableDelimiterFiller"),b(k)):N(k)}function b(k){return k===45?(e.consume(k),b):k===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(k))}function S(k){return kt(k)?Rt(e,w,"whitespace")(k):w(k)}function w(k){return k===124?f(k):k===null||tt(k)?!s||o!==i?N(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(k)):N(k)}function N(k){return a(k)}function x(k){return e.enter("tableRow"),A(k)}function A(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),A):k===null||tt(k)?(e.exit("tableRow"),t(k)):kt(k)?Rt(e,A,"whitespace")(k):(e.enter("data"),C(k))}function C(k){return k===null||k===124||Bt(k)?(e.exit("data"),A(k)):(e.consume(k),k===92?O:C)}function O(k){return k===92||k===124?(e.consume(k),C):C(k)}}function wI(e,t){let a=-1,r=!0,o=0,i=[0,0,0,0],s=[0,0,0,0],l=!1,c=0,u,d,p;const m=new gI;for(;++aa[2]+1){const f=a[2]+1,g=a[3]-a[2]-1;e.add(f,g,[])}}e.add(a[3]+1,0,[["exit",p,t]])}return o!==void 0&&(i.end=Object.assign({},Xr(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function Ih(e,t,a,r,o){const i=[],s=Xr(t.events,a);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(a+1,0,i)}function Xr(e,t){const a=e[t],r=a[0]==="enter"?"start":"end";return a[1][r]}const kI={name:"tasklistCheck",tokenize:SI};function xI(){return{text:{91:kI}}}function SI(e,t,a){const r=this;return o;function o(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Bt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),s):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),s):a(c)}function s(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):a(c)}function l(c){return tt(c)?t(c):kt(c)?e.check({tokenize:CI},t,a)(c):a(c)}}function CI(e,t,a){return Rt(e,r,"whitespace");function r(o){return o===null?a(o):t(o)}}function NI(e){return ev([GT(),sI(),fI(e),yI(),xI()])}const RI={};function TI(e){const t=this,a=e||RI,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(NI(a)),i.push(ZT()),s.push(JT(a))}const II=new Set(["standard","document","email","chat_message","social_post"]);function AI(e,{offsets:t=!1}={}){const a=String(e||"").split(` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:s,tableCell:c,tableRow:l}};function s(h,f,g,E){return u(d(h,g,E),h.align)}function l(h,f,g,E){const y=p(h,g,E),b=u([y]);return b.slice(0,b.indexOf(` +`))}function c(h,f,g,E){const y=g.enter("tableCell"),b=g.enter("phrasing"),S=g.containerPhrasing(h,{...E,before:i,after:i});return b(),y(),S}function u(h,f){return nT(h,{align:f,alignDelimiters:r,padding:a,stringLength:o})}function d(h,f,g){const E=h.children;let y=-1;const b=[],S=f.enter("table");for(;++y0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const iI={tokenize:hI,partial:!0};function sI(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:dI,continuation:{tokenize:pI},exit:mI}},text:{91:{name:"gfmFootnoteCall",tokenize:uI},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lI,resolveTo:cI}}}}function lI(e,t,a){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const c=r.events[o][1];if(c.type==="labelImage"){s=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!s||!s._balanced)return a(c);const u=Fa(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?a(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function cI(e,t){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...l),e}function uI(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return l;function l(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),c}function c(p){return p!==94?a(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(p){if(i>999||p===93&&!s||p===null||p===91||Bt(p))return a(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return o.includes(Fa(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(p)}return Bt(p)||(s=!0),i++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),i++,u):u(p)}}function dI(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,l;return c;function c(f){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(f){return f===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):a(f)}function d(f){if(s>999||f===93&&!l||f===null||f===91||Bt(f))return a(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=Fa(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Bt(f)||(l=!0),s++,e.consume(f),f===92?p:d}function p(f){return f===91||f===92||f===93?(e.consume(f),s++,d):d(f)}function m(f){return f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),o.includes(i)||o.push(i),Rt(e,h,"gfmFootnoteDefinitionWhitespace")):a(f)}function h(f){return t(f)}}function pI(e,t,a){return e.check(Hi,t,e.attempt(iI,t,a))}function mI(e){e.exit("gfmFootnoteDefinition")}function hI(e,t,a){const r=this;return Rt(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):a(i)}}function fI(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(s,l){let c=-1;for(;++c1?c(f):(s.consume(f),p++,h);if(p<2&&!a)return c(f);const E=s.exit("strikethroughSequenceTemporary"),y=bo(f);return E._open=!y||y===2&&!!g,E._close=!g||g===2&&!!y,l(f)}}}class gI{constructor(){this.map=[]}add(t,a,r){vI(this,t,a,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function vI(e,t,a,r){let o=0;if(!(a===0&&r.length===0)){for(;o-1;){const z=r.events[T][1].type;if(z==="lineEnding"||z==="linePrefix")T--;else break}const I=T>-1?r.events[T][1].type:null,F=I==="tableHead"||I==="tableRow"?x:c;return F===x&&r.parser.lazy[r.now().line]?a(k):F(k)}function c(k){return e.enter("tableHead"),e.enter("tableRow"),u(k)}function u(k){return k===124||(s=!0,i+=1),d(k)}function d(k){return k===null?a(k):tt(k)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),h):a(k):kt(k)?Rt(e,d,"whitespace")(k):(i+=1,s&&(s=!1,o+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),p(k)))}function p(k){return k===null||k===124||Bt(k)?(e.exit("data"),d(k)):(e.consume(k),k===92?m:p)}function m(k){return k===92||k===124?(e.consume(k),p):p(k)}function h(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(k):(e.enter("tableDelimiterRow"),s=!1,kt(k)?Rt(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):f(k))}function f(k){return k===45||k===58?E(k):k===124?(s=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),g):N(k)}function g(k){return kt(k)?Rt(e,E,"whitespace")(k):E(k)}function E(k){return k===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),y):k===45?(i+=1,y(k)):k===null||tt(k)?w(k):N(k)}function y(k){return k===45?(e.enter("tableDelimiterFiller"),b(k)):N(k)}function b(k){return k===45?(e.consume(k),b):k===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(k))}function S(k){return kt(k)?Rt(e,w,"whitespace")(k):w(k)}function w(k){return k===124?f(k):k===null||tt(k)?!s||o!==i?N(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(k)):N(k)}function N(k){return a(k)}function x(k){return e.enter("tableRow"),A(k)}function A(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),A):k===null||tt(k)?(e.exit("tableRow"),t(k)):kt(k)?Rt(e,A,"whitespace")(k):(e.enter("data"),C(k))}function C(k){return k===null||k===124||Bt(k)?(e.exit("data"),A(k)):(e.consume(k),k===92?O:C)}function O(k){return k===92||k===124?(e.consume(k),C):C(k)}}function wI(e,t){let a=-1,r=!0,o=0,i=[0,0,0,0],s=[0,0,0,0],l=!1,c=0,u,d,p;const m=new gI;for(;++aa[2]+1){const f=a[2]+1,g=a[3]-a[2]-1;e.add(f,g,[])}}e.add(a[3]+1,0,[["exit",p,t]])}return o!==void 0&&(i.end=Object.assign({},Xr(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function Ih(e,t,a,r,o){const i=[],s=Xr(t.events,a);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(a+1,0,i)}function Xr(e,t){const a=e[t],r=a[0]==="enter"?"start":"end";return a[1][r]}const kI={name:"tasklistCheck",tokenize:SI};function xI(){return{text:{91:kI}}}function SI(e,t,a){const r=this;return o;function o(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Bt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),s):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),s):a(c)}function s(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):a(c)}function l(c){return tt(c)?t(c):kt(c)?e.check({tokenize:CI},t,a)(c):a(c)}}function CI(e,t,a){return Rt(e,r,"whitespace");function r(o){return o===null?a(o):t(o)}}function NI(e){return ev([GT(),sI(),fI(e),yI(),xI()])}const RI={};function TI(e){const t=this,a=e||RI,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(NI(a)),i.push(ZT()),s.push(JT(a))}const II=new Set(["standard","document","email","chat_message","social_post"]);function AI(e,{offsets:t=!1}={}){const a=String(e||"").split(` `),r=[];let o=[],i=null,s=0,l=0;const c=a.map(p=>{const m=l;return l+=p.length+1,m}),u=(p,m)=>{o.length||(s=c[m]),o.push(p)},d=()=>{o.length&&(r.push({type:"text",text:o.join(` -`),...t?{sourceOffset:s}:{}}),o=[])};for(let p=0;p=i.length&&(i=null):i=h[1],u(m,p);continue}const f=!i&&/^:::writing\{([^{}]*)\}\s*$/.exec(m);if(!f){u(m,p);continue}const g={},y=/([a-z]+)="([^"\r\n]*)"/g;let E;for(;E=y.exec(f[1]);)g[E[1]]=E[2];if(f[1].replace(y,"").trim()||!II.has(g.variant)||!/^\d{5}$/.test(g.id)||Object.keys(g).some(w=>!["variant","id","subject","recipient","cc","bcc"].includes(w))){u(m,p);continue}let S=p+1;for(;Sf("button",{type:"button",className:"a-soft",disabled:l,onClick:b,...S},E);async function y(){try{await navigator.clipboard.writeText(r),d("Copied writing.")}catch{d("Clipboard is unavailable. Select the text to copy it.")}}return f("section",{className:"a-selection-card a-writing-block","aria-label":"Reusable writing"},f("strong",null,e.subject||e.variant.replaceAll("_"," ")),...["recipient","cc","bcc"].filter(E=>e[E]).map(E=>f("p",{key:E},{recipient:"To",cc:"Cc",bcc:"Bcc"}[E]+": "+e[E])),i?f("textarea",{"aria-label":"Edit writing copy",rows:8,value:r,disabled:l,onChange:E=>o(E.target.value)}):a(r),f("div",{className:"a-dialog-actions"},g("Copy writing",y),g(i?"Preview copy":"Edit copy",()=>s(E=>!E)),t&&g("Save writing version",h,{className:"a-primary",disabled:l||!r.trim(),"data-action":"outputs.write"})),u&&f("p",{role:"status"},u))}function Wv(e){if(typeof e!="string"||e.length>600||!e.startsWith("amplifier-canvas://artifact/"))return null;try{const t=new URL(e),a=t.pathname.slice(1),r=t.searchParams.get("session"),o=t.searchParams.get("version");if(t.host!=="artifact"||t.username||t.password||t.hash||!/^[-\w]{1,100}$/.test(a)||!/^[-\w]{1,200}$/.test(r||"")||[...t.searchParams.keys()].sort().join(",")!=="session,version"||!/^\d+$/.test(o||""))return null;const i=Number(o);return!Number.isSafeInteger(i)||i<1?null:{id:a,sessionId:r,version:i}}catch{return null}}function PI({reference:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){if(!l.current){if(e.sessionId!==t.sessionId){s("This artifact belongs to another chat. Open the reference from its original chat.");return}l.current=!0,o(!0),s("");try{await t.act("canvas.select",e)}catch(u){s(u.message||"This saved artifact version is unavailable.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.select",title:"Open saved version "+e.version+" in Canvas",onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function js(e){if(typeof e!="string"||!e||e.length>4e3||/[\x00-\x1f\x7f]/.test(e)||e.startsWith("#")||e.startsWith("//"))return null;let t=e.replace(/:\d+(?::\d+)?$/,"");if(/^file:/i.test(t))try{const a=new URL(t);if(a.hostname&&a.hostname!=="localhost"||a.username||a.password)return null;t=a.pathname}catch{return null}else if(/^[a-z][a-z\d+.-]*:/i.test(t))return null;t=t.split(/[?#]/,1)[0];try{t=decodeURIComponent(t)}catch{return null}return/[\x00-\x1f\x7f\\]/.test(t)||t.startsWith("//")||/^www\./i.test(t)||/^[a-z][a-z\d+.-]*:/i.test(t)||(t=t.replace(/:\d+(?::\d+)?$/,""),!/[^/]\.[a-z\d_-]{1,20}$/i.test(t))?null:t}function OI({path:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){var u,d;if(!l.current){l.current=!0,o(!0),s("");try{const p=await t.act("canvas.openFile",{sessionId:t.sessionId,workspace:t.workspace,path:e});((u=p==null?void 0:p.result)==null?void 0:u.status)!=="opened"&&s(((d=p==null?void 0:p.result)==null?void 0:d.message)||"This file could not be opened.")}catch{s("This file could not be opened.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.openFile",title:"Open in Canvas: "+e,onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function MI(){return e=>{let t=100;function a(r){!r.children||["link","image","code","html"].includes(r.type)||(r.children=r.children.flatMap(o=>{if(!t)return[o];if(o.type==="inlineCode"){const i=js(o.value);if(i)return t--,[{type:"link",url:i,children:[o]}]}if(o.type==="text"){const i=[];let s=0;const l=new RegExp("(?s&&i.push({type:"text",value:o.value.slice(s,c.index)}),i.push({type:"link",url:u,children:[{type:"text",value:u}]}),s=c.index+u.length,t--)}if(s)return sn.createElement("a",{...r,href:t,target:t!=null&&t.startsWith("#")?void 0:"_blank",rel:"noopener noreferrer"},a),img:({src:e,alt:t})=>n.createElement("a",{href:e,target:"_blank",rel:"noopener noreferrer"},t?`Image: ${t}`:"Open image"),table:({node:e,...t})=>n.createElement("div",{className:"a-table-scroll"},n.createElement("table",t))},Jv=v.createContext(null);function zI({node:e,href:t,children:a,...r}){const o=v.useContext(Jv),i=o&&Wv(t),s=(o==null?void 0:o.workspace)&&js(t);return i?n.createElement(PI,{key:t,reference:i,context:o},a):s?n.createElement(OI,{key:JSON.stringify([o.sessionId,o.workspace,s]),path:s,context:o},a):n.createElement(Zv.a,{href:t,...r},a)}const ml=v.memo(function({text:t,className:a="",overrides:r={},writingContext:o,fileContext:i,mapSource:s=!1}){const l=!!(i!=null&&i.sessionId&&(i!=null&&i.act)),c=!!(l&&i.workspace),u=(d,p)=>n.createElement(gR,{remarkPlugins:[TI,...Number.isInteger(p)?[vS(d,p)]:[],...c?[MI]:[]],skipHtml:!0,urlTransform:m=>l&&Wv(m)||c&&js(m)?m:kv(m),components:{...Zv,...l?{a:zI}:{},...r}},d);return n.createElement(Jv.Provider,{value:l?i:null},n.createElement("div",{className:`a-markdown ${a}`.trim()},...AI(t,{offsets:s}).map((d,p)=>{const m=h=>u(h,h===d.text?d.sourceOffset:void 0);return d.type==="writing"?n.createElement(_I,{key:d.id+":"+p,part:d,context:o,render:m}):n.createElement(n.Fragment,{key:p},m(d.text))})))}),$s=(e,t,a)=>t("canvas.view",{id:e.id,patch:a});function vd(e,t,a="preview"){const r=v.useRef(t);return r.current=t,v.useMemo(()=>(o,i="")=>{e.id&&r.current("canvas.report",{id:e.id,part:a,status:o,message:String(i).slice(0,2e3)})},[e.id,a])}function LI(e){return t1.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:["foreignObject","script","image","a","use","animate","set"],FORBID_ATTR:["href","xlink:href"]})}let Ah;function Kv({kind:e,source:t,canvas:a,act:r,part:o="preview",embedded:i=!1}){var S,w;const s=v.useId().replace(/[^a-zA-Z0-9]/g,""),l=vd(a,r,o),[c,u]=v.useState({}),d=v.useRef(null),p=v.useRef(null),m=a.view||{},h=m.zoom||1,f=m.panX||0,g=m.panY||0;v.useEffect(()=>{let N=!0,x,A;u({}),l("pending");const C=O=>{N&&(clearTimeout(A),x==null||x.terminate(),u(O),l(O.error?"error":"ready",O.error||"Diagram rendered"))};if(t.length>5e4){C({error:"Diagrams must be 50,000 characters or smaller."});return}return e==="dot"?(x=new Worker(new URL("/assets/graphviz.worker-CZ5dJQ9S.js",import.meta.url),{type:"module"}),A=setTimeout(()=>C({error:"Diagram layout took too long. Simplify the graph and try again."}),15e3),x.onmessage=O=>C(O.data),x.onerror=O=>C({error:O.message||"Graph renderer failed"}),x.postMessage({source:t,engine:m.engine||"dot"})):(Ah||(Ah=zg(async()=>{const{default:O}=await import("./mermaid.core-CDlaSEyP.js").then(k=>k.ca);return{default:O}},__vite__mapDeps([0,1])).then(({default:O})=>(O.initialize({startOnLoad:!1,securityLevel:"strict",maxTextSize:5e4,maxEdges:500,suppressErrorRendering:!0,theme:"default",flowchart:{htmlLabels:!1},htmlLabels:!1}),O))),Ah.then(O=>O.render(`canvas${s}`,t)).then(({svg:O})=>C({svg:O})).catch(O=>C({error:O.message||String(O)}))),()=>{N=!1,clearTimeout(A),x==null||x.terminate()}},[e,t,m.engine,s,l]);const y=v.useMemo(()=>c.svg?"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(LI(c.svg)):null,[c.svg]),E=N=>$s(a,r,N),b=(S=c.nodes)==null?void 0:S.find(N=>N.name===m.node);return n.createElement("div",{className:`a-diagram ${i?"embedded":""}`},!i&&n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom out","data-action":"canvas.view",onClick:()=>E({zoom:Math.max(.2,h-.2)})},n.createElement(kx,null)),n.createElement("span",null,Math.round(h*100),"%"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom in","data-action":"canvas.view",onClick:()=>E({zoom:Math.min(4,h+.2)})},n.createElement(wx,null)),n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.view",onClick:()=>E({zoom:1,panX:0,panY:0})},n.createElement(Gk,null),"Fit"),e==="dot"&&n.createElement("select",{"aria-label":"Graph layout","data-action":"canvas.view",value:m.engine||"dot",onChange:N=>E({engine:N.target.value,node:""})},["dot","neato","fdp","sfdp","circo","twopi"].map(N=>n.createElement("option",{key:N},N))))),c.error?n.createElement("div",{className:"a-canvas-result error",role:"alert"},n.createElement(zn,null),n.createElement("span",null,c.error)):y?n.createElement("div",{ref:p,className:"a-diagram-stage",tabIndex:0,"aria-label":"Diagram. Drag to pan; arrow keys move the view.",onKeyDown:N=>{const x={ArrowLeft:[-30,0],ArrowRight:[30,0],ArrowUp:[0,-30],ArrowDown:[0,30]};x[N.key]&&(N.preventDefault(),E({panX:f+x[N.key][0],panY:g+x[N.key][1]}))},onPointerDown:N=>{i||(d.current={x:N.clientX,y:N.clientY},N.currentTarget.setPointerCapture(N.pointerId))},onPointerUp:N=>{d.current&&(E({panX:Math.max(-1e4,Math.min(1e4,f+N.clientX-d.current.x)),panY:Math.max(-1e4,Math.min(1e4,g+N.clientY-d.current.y))}),d.current=null)}},n.createElement("img",{alt:a.title||"Diagram",draggable:"false",src:y,style:{transform:i?void 0:`translate(${f}px,${g}px) scale(${h})`}})):n.createElement("p",{role:"status"},"Drawing diagram…"),!i&&((w=c.nodes)==null?void 0:w.length)>0&&n.createElement("div",{className:"a-node-inspector"},n.createElement("label",null,"Inspect a node",n.createElement("select",{"aria-label":"Inspect graph node","data-action":"canvas.view",value:m.node||"",onChange:N=>E({node:N.target.value})},n.createElement("option",{value:""},"Choose a node…"),c.nodes.map(N=>n.createElement("option",{key:N.name,value:N.name},N.name)))),b&&n.createElement("dl",null,Object.entries(b).map(([N,x])=>n.createElement(n.Fragment,{key:N},n.createElement("dt",null,N),n.createElement("dd",null,typeof x=="object"?JSON.stringify(x):String(x)))))))}function DI({canvas:e,act:t}){const a=v.useMemo(()=>({pre:({children:r})=>n.createElement("div",{className:"a-canvas-code-block"},r),code:({className:r,children:o,node:i,...s})=>{var u,d,p;const l=(u=/language-(\w+)/.exec(r||""))==null?void 0:u[1],c=String(o).replace(/\n$/,"");return["mermaid","dot","graphviz"].includes(l)?n.createElement(Kv,{kind:l==="mermaid"?"mermaid":"dot",source:c,canvas:e,act:t,embedded:!0,part:`fence-${((p=(d=i==null?void 0:i.position)==null?void 0:d.start)==null?void 0:p.offset)||0}`}):n.createElement("code",{className:r,...s},o)}}),[e.id,t]);return n.createElement(ml,{text:e.content,overrides:a,mapSource:!0})}function lu({text:e}){const[t,a]=v.useState("");return v.useEffect(()=>{let r=!0;return a(""),e.length<1e5&&zg(async()=>{const{default:o}=await import("./index-D1m6Llf0.js");return{default:o}},__vite__mapDeps([2,1])).then(({default:o})=>{const i=o.highlightAuto(e).value;r&&a(i)}),()=>{r=!1}},[e]),t?n.createElement("pre",{className:"a-canvas-code"},n.createElement("code",{dangerouslySetInnerHTML:{__html:t}})):n.createElement("pre",{className:"a-canvas-code"},e)}function FI({canvas:e,act:t}){var N,x;const a=vd(e,t),r=e.view||{},o=e.content||"",i=!["text","image"].includes(e.kind),s=v.useRef(null),l=v.useRef(null),c=v.useRef(!1),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=["markdown","text"].includes(e.kind)&&!r.source;v.useEffect(()=>{if(d(null),f(""),!g)return;const A=()=>{var C;c.current||(C=l.current)!=null&&C.contains(document.activeElement)||(d(ES(s.current,window.getSelection(),o)),f(""))};return document.addEventListener("selectionchange",A),()=>document.removeEventListener("selectionchange",A)},[o,g,e.id,e.resourceRevision]);async function y(){var A,C;if(!(!(u!=null&&u.excerpt)||c.current)){c.current=!0,m(!0),f("");try{const O=await t("canvas.reference",{id:e.id,sessionId:e.sessionId,version:e.selectedVersion||e.revision||e.latestVersion,...u});((A=O==null?void 0:O.result)==null?void 0:A.status)==="referenced"&&(f("Reference added to your draft. Nothing was sent."),d(null),(C=window.getSelection())==null||C.removeAllRanges())}catch(O){f(O.message||"The reference could not be added.")}finally{c.current=!1,m(!1)}}}const E=v.useMemo(()=>{if(!["json","jsonl"].includes(e.kind))return{};try{return{value:e.kind==="json"?JSON.parse(o):o.split(` -`).filter(A=>A.trim()).map(A=>JSON.parse(A))}}catch(A){return{error:A.message}}},[e.kind,o]);v.useEffect(()=>{["html","babylon","image","dot","mermaid"].includes(e.kind)||a(E.error?"error":"ready",E.error||"Preview ready")},[e.id,e.kind,E.error,a]);const b=Object.values(e.renderReports||{}),S=b.find(A=>A.status==="error"),w=b.some(A=>A.status==="pending");return n.createElement("div",{className:"a-canvas-viewer"},n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},i&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-soft","aria-pressed":!r.source,"data-action":"canvas.view",onClick:()=>$s(e,t,{source:!1})},n.createElement($k,null),"Preview"),n.createElement("button",{type:"button",className:"a-soft","aria-pressed":!!r.source,"data-action":"canvas.view",onClick:()=>$s(e,t,{source:!0})},n.createElement(jk,null),"Source")),n.createElement("span",{className:"a-canvas-format"},e.kind),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy canvas source","data-action":"canvas.copy",onClick:()=>t("canvas.copy",{id:e.id})},n.createElement(rr,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Download canvas source","data-action":"canvas.download",onClick:()=>t("canvas.download",{id:e.id})},n.createElement(wa,null)))),g&&n.createElement("div",{className:"a-canvas-reference",ref:l},n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.reference",disabled:p||!(u!=null&&u.excerpt),onMouseDown:A=>A.preventDefault(),onClick:y},p?"Adding reference…":"Reference in chat"),n.createElement("span",{role:"status",className:"a-caption"},h||(u==null?void 0:u.error)||(u!=null&&u.excerpt?`${[...u.excerpt].length} characters selected`:"Select document text to quote in your draft."))),n.createElement("div",{className:"a-canvas-preview",ref:s,tabIndex:g?0:void 0,"aria-label":g?"Document text":void 0},r.source?e.contentResource?n.createElement(jI,{canvas:e}):n.createElement(lu,{text:o}):["html","babylon"].includes(e.kind)?n.createElement(UI,{canvas:e,act:t}):["mermaid","dot"].includes(e.kind)?n.createElement(Kv,{kind:e.kind,source:o,canvas:e,act:t}):e.kind==="markdown"?n.createElement(DI,{canvas:e,act:t}):e.kind==="image"?n.createElement("img",{className:"a-canvas-image",src:o,alt:e.title||"Workspace image",onLoad:()=>a("ready","Image loaded"),onError:()=>a("error","This image could not be decoded")}):["json","jsonl"].includes(e.kind)?E.error?n.createElement("div",{className:"a-canvas-result error",role:"alert"},E.error):n.createElement(qI,{value:E.value,canvas:e,act:t}):e.kind==="code"?n.createElement(lu,{text:o}):n.createElement("pre",{className:"a-canvas-plain"},n.createElement("span",{"data-canvas-source-start":"0","data-canvas-source-end":o.length,"data-canvas-literal":"true"},o))),n.createElement(yr,{inline:!!S||w},n.createElement("div",{className:`a-canvas-result ${S?"error":w?"":"success"}`,role:"status"},S?n.createElement(zn,null):w?null:n.createElement(Pt,null),n.createElement("span",null,S?S.message||"Preview needs attention":w?"Rendering…":((x=(N=e.renderReports)==null?void 0:N.clipboard)==null?void 0:x.message)||(["html","babylon"].includes(e.kind)?"Isolated HTML preview":"Ready")))))}function qI({value:e,canvas:t,act:a}){var s;const r=((s=t.view)==null?void 0:s.query)||"",o=Array.isArray(e)?e:[e],i=o.map((l,c)=>({v:l,i:c})).filter(({v:l})=>!r||JSON.stringify(l).toLowerCase().includes(r.toLowerCase()));return n.createElement("div",{className:"a-canvas-data"},n.createElement("input",{"aria-label":"Filter data records",type:"search",placeholder:"Filter records…",value:r,"data-action":"canvas.view",onChange:l=>$s(t,a,{query:l.target.value})}),n.createElement("small",null,i.length," of ",o.length," records"),i.slice(0,200).map(({v:l,i:c})=>n.createElement("pre",{key:c},JSON.stringify(l,null,2))),i.length>200&&n.createElement("p",null,"Showing the first 200 matches. Narrow the filter to see more."))}function UI({canvas:e,act:t}){const a=v.useRef(null),r=vd(e,t),o=v.useRef(t),i=v.useRef(null);return o.current=t,v.useEffect(()=>{r("pending","Loading HTML document");const s=l=>{var c,u;if(!(l.source!==((c=a.current)==null?void 0:c.contentWindow)||((u=l.data)==null?void 0:u.id)!==e.id)&&(l.data.type==="canvas-render"&&["ready","error"].includes(l.data.status)&&r(l.data.status,String(l.data.message||"").slice(0,2e3)),l.data.type==="canvas-snapshot")){const d=l.data.document;if(!d||typeof d.text!="string"||!Array.isArray(d.controls))return;const p={text:d.text.slice(0,16e3),controls:d.controls.slice(0,100).map(m=>({id:String(m.id||"").slice(0,100),tag:String(m.tag||"").slice(0,30),type:String(m.type||"").slice(0,30),label:String(m.label||"").slice(0,200),value:String(m.value||"").slice(0,4e3),disabled:!!m.disabled}))};o.current("canvas.snapshot",{id:e.id,document:p})}};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)},[e.id,r]),v.useEffect(()=>{var l,c;const s=e.interaction;s&&i.current!==s.requestId&&(i.current=s.requestId,(c=(l=a.current)==null?void 0:l.contentWindow)==null||c.postMessage({type:"canvas-interact",...s},"*"))},[e.interaction]),n.createElement("iframe",{ref:a,title:e.title||"Interactive canvas",className:"a-canvas-html",sandbox:"allow-scripts",referrerPolicy:"no-referrer",src:$i(`/api/canvas/${e.id}/document`+(e.viewId?"?"+new URLSearchParams({viewId:e.viewId,resourceId:e.id,resourceRevision:e.resourceRevision,generation:e.generation}):""))})}function jI({canvas:e}){const[t,a]=v.useState({});return v.useEffect(()=>{const r=new AbortController;return a({}),fetch($i(`/api/canvas/${e.id}/source?version=${e.selectedVersion??e.revision??1}`),{signal:r.signal}).then(async o=>{if(!o.ok)throw Error("The saved source could not be loaded.");return o.text()}).then(o=>a({text:o})).catch(o=>{o.name!=="AbortError"&&a({error:o.message})}),()=>r.abort()},[e.id,e.selectedVersion,e.revision]),t.error?n.createElement("p",{role:"alert"},t.error):t.text===void 0?n.createElement("p",{role:"status"},"Loading saved source…"):n.createElement(lu,{text:t.text})}var $I=Object.create,bd=Object.defineProperty,BI=Object.getOwnPropertyDescriptor,HI=Object.getOwnPropertyNames,VI=Object.getPrototypeOf,WI=Object.prototype.hasOwnProperty,ZI=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),JI=(e,t)=>{let a={};for(var r in e)bd(a,r,{get:e[r],enumerable:!0});return a},KI=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=HI(t),i=0,s=o.length,l;it[c]).bind(null,l),enumerable:!(r=BI(t,l))||r.enumerable});return e},YI=(e,t,a)=>(a=e!=null?$I(VI(e)):{},KI(bd(a,"default",{value:e,enumerable:!0}),e));const GI=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function QI(e){return typeof e=="string"&&GI.has(e.replace(/#$/,""))}function cu(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function _h(e,t="|"){return e.map(a=>eb(a)).join(t)}function uu(e,t){return typeof t=="bigint"?t.toString():t}class XI{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function hl(e){return new XI(e)}function e2(e){return e==null}function yd(e){const t=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(t,a)}function t2(e,t){const a=e/t,r=Math.round(a),o=4*Number.EPSILON*Math.max(Math.abs(a),1);return Math.abs(a-r){const l=t._zod.def.shape[i];return r?r(l,i):l}):Gv(e,i,r?r(s.value,i):s.value))}}function a2(e,t){for(const a of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,a);r.enumerable&&(r.get?Yv(e,a,()=>t[a]):Gv(e,a,r.value))}}function ya(...e){const t={};for(const a of e){const r=Object.getOwnPropertyDescriptors(a);Object.assign(t,r)}return Object.defineProperties({},t)}function r2(e){return JSON.stringify(e)}function o2(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Qv="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Si(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const i2=hl(()=>{var e;if(qa.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function yo(e){if(Si(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const a=t.prototype;return!(Si(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function Xv(e){return yo(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const s2=new Set(["string","number","symbol"]);function Eo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xr(e,t,a){const r=new e._zod.constr(t??e._zod.def);return(!t||a!=null&&a.parent)&&(r._zod.parent=e),r}function Ve(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function eb(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function l2(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const tb={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]},c2={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function u2(e,t){const a=e._zod.def,r=a.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return $r(i,e,fl(e,t)),xr(e,ya(a,{shape:i,checks:[]}))}function fl(e,t){var o;const a=ar(e),r=[];for(const i of Reflect.ownKeys(t)){if(!((o=Object.getOwnPropertyDescriptor(a,i))!=null&&o.enumerable))throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function d2(e,t){const a=e._zod.def,r=a.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(fl(e,t)),s={};return $r(s,e,Reflect.ownKeys(ar(e)).filter(l=>!i.has(l))),xr(e,ya(a,{shape:s,checks:[]}))}function p2(e,t){if(!yo(t))throw new Error("Invalid input to extend: expected a plain object");const a=e._zod.def.checks;if(a&&a.length>0){const o=ar(e);for(const i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xr(e,ya(e._zod.def,{shape:nb(e,t)}))}function nb(e,t){const a={};return $r(a,e,Reflect.ownKeys(ar(e))),a2(a,t),a}function m2(e,t){if(!yo(t))throw new Error("Invalid input to safeExtend: expected a plain object");return xr(e,ya(e._zod.def,{shape:nb(e,t)}))}function h2(e,t){var o,i;if(!((o=t==null?void 0:t._zod)!=null&&o.def))throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if((i=e._zod.def.checks)!=null&&i.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const a={};$r(a,e,Reflect.ownKeys(ar(e))),$r(a,t,Reflect.ownKeys(ar(t)));const r=ya(e._zod.def,{shape:a,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return xr(e,r)}function Oh(e,t,a,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const l=a?new Set(fl(t,a)):void 0,c={};return $r(c,t,Reflect.ownKeys(ar(t)),e&&((u,d)=>l&&!l.has(d)?u:new e({type:"optional",innerType:u}))),xr(t,ya(t._zod.def,{shape:c,checks:[]}))}function f2(e,t,a){const r=a?new Set(fl(t,a)):void 0,o={};return $r(o,t,Reflect.ownKeys(ar(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),xr(t,ya(t._zod.def,{shape:o}))}function er(e,t=0){var a;if(e.aborted===!0)return!0;for(let r=t;r{var r;return(r=a).path??(r.path=[]),a.path.unshift(e),a})}function Qo(e){return typeof e=="string"?e:e==null?void 0:e.message}function Mh(e,t,a){var r;for(let o=t;oe;return t[x2]=!0,t}var Lh;const C2=Object.freeze({status:"aborted"}),gc={value:void 0,enumerable:!1};let Dh="captureStackTrace"in Error?Error:null;function N2(e){const t=Dh;if(t){const a=t.stackTraceLimit;if(typeof a=="number"){try{t.stackTraceLimit=0}catch{return Dh=null,new e}try{return new e}finally{t.stackTraceLimit=a}}}return new e}function ce(e,t,a,r){const o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;const s=a,l=s&&new WeakSet;function c(m,h){if(!m._zod){gc.value=new i(h);try{Object.defineProperty(m,"_zod",gc)}finally{gc.value=void 0}}if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,h),l){const g=Object.getPrototypeOf(m),y=m._zod.constr.prototype;let E=g;for(;E&&E!==y;)E=Object.getPrototypeOf(E);const b=E??g;l.has(b)||(l.add(b),y2(b,s))}const f=p.prototype;for(const g in f)Object.prototype.hasOwnProperty.call(f,g)&&(g in m||(m[g]=f[g].bind(m)))}const u=(r==null?void 0:r.Parent)??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function p(m){var y;const h=r!=null&&r.Parent?N2(d):this;c(h,m);const f=h._zod.deferred;if(f){for(const E of f)E();h._zod.deferred=void 0}const g=(y=globalThis.__zod_globalConfig)==null?void 0:y.postProcessor;return g&&g(h),h}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:m=>{var h,f;return r!=null&&r.Parent&&m instanceof r.Parent?!0:(f=(h=m==null?void 0:m._zod)==null?void 0:h.traits)==null?void 0:f.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class zr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ob extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Lh=globalThis).__zod_globalConfig??(Lh.__zod_globalConfig={});const qa=globalThis.__zod_globalConfig;function Ka(e){return e&&Object.assign(qa,e),qa}function R2(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,uu,2)),e.message}function T2(e){this._zod.message=e}const I2={get:R2,set:T2,enumerable:!0,configurable:!0},vc={value:void 0,enumerable:!1},Fh=new WeakSet([Object.prototype,Error.prototype]),A2=(e,t)=>{e.name="$ZodError",vc.value=t,Object.defineProperty(e,"issues",vc),vc.value=void 0,Object.defineProperty(e,"message",I2);const a=Object.getPrototypeOf(e);Fh.has(a)||(Fh.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},_2=ce("$ZodError",A2);function P2(e,t,a){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:a(),writable:!0,enumerable:!0,configurable:!0}):e[t]=a()),e[t]}function O2(e,t=a=>a.message){const a={},r=[];for(const o of e.issues)o.path.length>0?P2(a,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:a}}function M2(e,t=a=>a.message){const a={_errors:[]},r=(o,i=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>r({issues:l},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{const l=[...i,...s.path];if(l.length===0)a._errors.push(t(s));else{let c=a,u=0;for(;u{const t=(a,r,o,i)=>{const s=o?{...o,async:!1}:{async:!1},l=a._zod.run({value:r,issues:[]},s);if(l instanceof Promise)throw new zr;if(l.issues.length){const c=new((i==null?void 0:i.Err)??e)(l.issues.map(u=>Er(u,s,Ka())));throw Qv(c,(i==null?void 0:i.callee)??t),c}return l.value};return t},Sd=e=>{const t=async(a,r,o,i)=>{const s=o?{...o,async:!0}:{async:!0};let l=a._zod.run({value:r,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const c=new((i==null?void 0:i.Err)??e)(l.issues.map(u=>Er(u,s,Ka())));throw Qv(c,(i==null?void 0:i.callee)??t),c}return l.value};return t},Cd=e=>(t,a,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:a,issues:[]},o);if(i instanceof Promise)throw new zr;return i.issues.length?ib(e,i.issues,o):{success:!0,data:i.value}};function ib(e,t,a){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>Er(o,a,Ka()))),t=void 0,a=void 0),r},set error(o){r=o,t=void 0,a=void 0}}}const Nd=e=>async(t,a,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:a,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?ib(e,i.issues,o):{success:!0,data:i.value}},z2=Symbol.for("zod.compile.invalid"),L2=Symbol.for("zod.compile.fallback"),D2=((e,t,a)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==z2)return!0;if(r.definite===!0&&a===void 0)return!1}return F2(e,t,a)});function F2(e,t,a){const r=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;let i;if(o?(r[L2]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new zr;return i.issues.length===0}const q2=async(e,t,a)=>{const r=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},U2=e=>{const t=xd(e),a=(r,o,i,s)=>{const l=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,l,gl(a,s))};return a},j2=e=>{const t=xd(e),a=(r,o,i,s)=>t(r,o,i,gl(a,s));return a},$2=e=>{const t=Sd(e),a=async(r,o,i,s)=>{const l=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,l,gl(a,s))};return a},B2=e=>{const t=Sd(e),a=async(r,o,i,s)=>await t(r,o,i,gl(a,s));return a},H2=e=>(t,a,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Cd(e)(t,a,o)},V2=e=>(t,a,r)=>Cd(e)(t,a,r),W2=e=>async(t,a,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Nd(e)(t,a,o)},Z2=e=>async(t,a,r)=>Nd(e)(t,a,r),J2=/^[cC][0-9a-z]{6,}$/,K2=/^[0-9a-z]+$/,Y2=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,G2=/^[0-9a-vA-V]{20}$/,Q2=/^[A-Za-z0-9]{27}$/,X2=/^[a-zA-Z0-9_-]{21}$/;function eA(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const tA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nA=/^([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})$/,qh=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,aA=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rA="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function oA(){return new RegExp(rA,"u")}const iA=/^(?:(?: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])$/,sA=/^(([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}|:))$/,lA=/^((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])$/,cA=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dA=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,pA=/^https?$/,mA=/^\+[1-9]\d{6,14}$/,sb="(?:(?:\\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])))";function hA(e){return new RegExp(`^${e}$`)}const fA=hA(sb);function du(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gA(e){return new RegExp(`^${du(e)}$`)}function vA(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${du({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${a}|${du({precision:e.precision})}`:a;return new RegExp(`^${sb}T(?:${r})$`)}const bA=/^[\s\S]{0,}$/,yA=/^-?\d+$/,Rd=/^-?\d+(?:\.\d+)?$/,EA=/^(?:true|false)$/i,wA=/^null$/i,kA=/^undefined$/i,xA=/^[^A-Z]*$/,SA=/^[^a-z]*$/,ca=ce("$ZodCheck",(e,t)=>{var a;e._zod??(e._zod={}),e._zod.def=t,(a=e._zod).onattach??(a.onattach=[])}),Td=e=>{const t=e.value;return!e2(t)&&t.length!==void 0},Bs={number:"number",bigint:"bigint",object:"date"},lb=ce("$ZodCheckLessThan",(e,t)=>{ca.init(e,t);const a=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{ca.init(e,t);const a=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Bs[typeof r.value]??a,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),CA=ce("$ZodCheckMultipleOf",(e,t)=>{ca.init(e,t),e._zod.check=a=>{if(typeof a.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?t.value!==BigInt(0)&&a.value%t.value===BigInt(0):t2(a.value,t.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:t.value,input:a.value,inst:e,continue:!t.abort})}}),NA=ce("$ZodCheckNumberFormat",(e,t)=>{var s;ca.init(e,t),t.format=t.format||"float64";const a=(s=t.format)==null?void 0:s.includes("int"),r=a?"int":"number",[o,i]=tb[t.format];e._zod.check=l=>{const c=l.value;if(a){if(!Number.isInteger(c)){l.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?l.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):l.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}ci&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),RA=ce("$ZodCheckMaxLength",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?wd(o):i)<=t.maximum)return;const l=kd(o);r.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),TA=ce("$ZodCheckMinLength",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i=t.minimum)return;const l=kd(o);r.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),IA=ce("$ZodCheckLengthEquals",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?wd(o):i;if(s===t.length)return;const l=kd(o),c=s>t.length;r.issues.push({origin:l,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),vl=ce("$ZodCheckStringFormat",(e,t)=>{var a,r;ca.init(e,t),t.pattern?(a=e._zod).check??(a.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),AA=ce("$ZodCheckRegex",(e,t)=>{vl.init(e,t),e._zod.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_A=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xA),vl.init(e,t)}),PA=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=SA),vl.init(e,t)}),OA=ce("$ZodCheckIncludes",(e,t)=>{ca.init(e,t);const a=Eo(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${a}`:a);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),MA=ce("$ZodCheckStartsWith",(e,t)=>{ca.init(e,t);const a=new RegExp(`^${Eo(t.prefix)}.*`);t.pattern??(t.pattern=a),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),zA=ce("$ZodCheckEndsWith",(e,t)=>{ca.init(e,t);const a=new RegExp(`.*${Eo(t.suffix)}$`);t.pattern??(t.pattern=a),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),LA=ce("$ZodCheckOverwrite",(e,t)=>{ca.init(e,t),e._zod.check=a=>{a.value=t.tx(a.value)}});class DA{constructor(t=[],a={}){this.content=[],this.indent=0,this.args=t,this.closed=a}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(` +`),...t?{sourceOffset:s}:{}}),o=[])};for(let p=0;p=i.length&&(i=null):i=h[1],u(m,p);continue}const f=!i&&/^:::writing\{([^{}]*)\}\s*$/.exec(m);if(!f){u(m,p);continue}const g={},E=/([a-z]+)="([^"\r\n]*)"/g;let y;for(;y=E.exec(f[1]);)g[y[1]]=y[2];if(f[1].replace(E,"").trim()||!II.has(g.variant)||!/^\d{5}$/.test(g.id)||Object.keys(g).some(w=>!["variant","id","subject","recipient","cc","bcc"].includes(w))){u(m,p);continue}let S=p+1;for(;Sf("button",{type:"button",className:"a-soft",disabled:l,onClick:b,...S},y);async function E(){try{await navigator.clipboard.writeText(r),d("Copied writing.")}catch{d("Clipboard is unavailable. Select the text to copy it.")}}return f("section",{className:"a-selection-card a-writing-block","aria-label":"Reusable writing"},f("strong",null,e.subject||e.variant.replaceAll("_"," ")),...["recipient","cc","bcc"].filter(y=>e[y]).map(y=>f("p",{key:y},{recipient:"To",cc:"Cc",bcc:"Bcc"}[y]+": "+e[y])),i?f("textarea",{"aria-label":"Edit writing copy",rows:8,value:r,disabled:l,onChange:y=>o(y.target.value)}):a(r),f("div",{className:"a-dialog-actions"},g("Copy writing",E),g(i?"Preview copy":"Edit copy",()=>s(y=>!y)),t&&g("Save writing version",h,{className:"a-primary",disabled:l||!r.trim(),"data-action":"outputs.write"})),u&&f("p",{role:"status"},u))}function Wv(e){if(typeof e!="string"||e.length>600||!e.startsWith("amplifier-canvas://artifact/"))return null;try{const t=new URL(e),a=t.pathname.slice(1),r=t.searchParams.get("session"),o=t.searchParams.get("version");if(t.host!=="artifact"||t.username||t.password||t.hash||!/^[-\w]{1,100}$/.test(a)||!/^[-\w]{1,200}$/.test(r||"")||[...t.searchParams.keys()].sort().join(",")!=="session,version"||!/^\d+$/.test(o||""))return null;const i=Number(o);return!Number.isSafeInteger(i)||i<1?null:{id:a,sessionId:r,version:i}}catch{return null}}function PI({reference:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){if(!l.current){if(e.sessionId!==t.sessionId){s("This artifact belongs to another chat. Open the reference from its original chat.");return}l.current=!0,o(!0),s("");try{await t.act("canvas.select",e)}catch(u){s(u.message||"This saved artifact version is unavailable.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.select",title:"Open saved version "+e.version+" in Canvas",onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function js(e){if(typeof e!="string"||!e||e.length>4e3||/[\x00-\x1f\x7f]/.test(e)||e.startsWith("#")||e.startsWith("//"))return null;let t=e.replace(/:\d+(?::\d+)?$/,"");if(/^file:/i.test(t))try{const a=new URL(t);if(a.hostname&&a.hostname!=="localhost"||a.username||a.password)return null;t=a.pathname}catch{return null}else if(/^[a-z][a-z\d+.-]*:/i.test(t))return null;t=t.split(/[?#]/,1)[0];try{t=decodeURIComponent(t)}catch{return null}return/[\x00-\x1f\x7f\\]/.test(t)||t.startsWith("//")||/^www\./i.test(t)||/^[a-z][a-z\d+.-]*:/i.test(t)||(t=t.replace(/:\d+(?::\d+)?$/,""),!/[^/]\.[a-z\d_-]{1,20}$/i.test(t))?null:t}function OI({path:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){var u,d;if(!l.current){l.current=!0,o(!0),s("");try{const p=await t.act("canvas.openFile",{sessionId:t.sessionId,workspace:t.workspace,path:e});((u=p==null?void 0:p.result)==null?void 0:u.status)!=="opened"&&s(((d=p==null?void 0:p.result)==null?void 0:d.message)||"This file could not be opened.")}catch{s("This file could not be opened.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.openFile",title:"Open in Canvas: "+e,onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function MI(){return e=>{let t=100;function a(r){!r.children||["link","image","code","html"].includes(r.type)||(r.children=r.children.flatMap(o=>{if(!t)return[o];if(o.type==="inlineCode"){const i=js(o.value);if(i)return t--,[{type:"link",url:i,children:[o]}]}if(o.type==="text"){const i=[];let s=0;const l=new RegExp("(?s&&i.push({type:"text",value:o.value.slice(s,c.index)}),i.push({type:"link",url:u,children:[{type:"text",value:u}]}),s=c.index+u.length,t--)}if(s)return sn.createElement("a",{...r,href:t,target:t!=null&&t.startsWith("#")?void 0:"_blank",rel:"noopener noreferrer"},a),img:({src:e,alt:t})=>n.createElement("a",{href:e,target:"_blank",rel:"noopener noreferrer"},t?`Image: ${t}`:"Open image"),table:({node:e,...t})=>n.createElement("div",{className:"a-table-scroll"},n.createElement("table",t))},Jv=v.createContext(null);function zI({node:e,href:t,children:a,...r}){const o=v.useContext(Jv),i=o&&Wv(t),s=(o==null?void 0:o.workspace)&&js(t);return i?n.createElement(PI,{key:t,reference:i,context:o},a):s?n.createElement(OI,{key:JSON.stringify([o.sessionId,o.workspace,s]),path:s,context:o},a):n.createElement(Zv.a,{href:t,...r},a)}const ml=v.memo(function({text:t,className:a="",overrides:r={},writingContext:o,fileContext:i,mapSource:s=!1}){const l=!!(i!=null&&i.sessionId&&(i!=null&&i.act)),c=!!(l&&i.workspace),u=(d,p)=>n.createElement(gR,{remarkPlugins:[TI,...Number.isInteger(p)?[vS(d,p)]:[],...c?[MI]:[]],skipHtml:!0,urlTransform:m=>l&&Wv(m)||c&&js(m)?m:kv(m),components:{...Zv,...l?{a:zI}:{},...r}},d);return n.createElement(Jv.Provider,{value:l?i:null},n.createElement("div",{className:`a-markdown ${a}`.trim()},...AI(t,{offsets:s}).map((d,p)=>{const m=h=>u(h,h===d.text?d.sourceOffset:void 0);return d.type==="writing"?n.createElement(_I,{key:d.id+":"+p,part:d,context:o,render:m}):n.createElement(n.Fragment,{key:p},m(d.text))})))}),$s=(e,t,a)=>t("canvas.view",{id:e.id,patch:a});function vd(e,t,a="preview"){const r=v.useRef(t);return r.current=t,v.useMemo(()=>(o,i="")=>{e.id&&r.current("canvas.report",{id:e.id,part:a,status:o,message:String(i).slice(0,2e3)})},[e.id,a])}function LI(e){return t1.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:["foreignObject","script","image","a","use","animate","set"],FORBID_ATTR:["href","xlink:href"]})}let Ah;function Kv({kind:e,source:t,canvas:a,act:r,part:o="preview",embedded:i=!1}){var S,w;const s=v.useId().replace(/[^a-zA-Z0-9]/g,""),l=vd(a,r,o),[c,u]=v.useState({}),d=v.useRef(null),p=v.useRef(null),m=a.view||{},h=m.zoom||1,f=m.panX||0,g=m.panY||0;v.useEffect(()=>{let N=!0,x,A;u({}),l("pending");const C=O=>{N&&(clearTimeout(A),x==null||x.terminate(),u(O),l(O.error?"error":"ready",O.error||"Diagram rendered"))};if(t.length>5e4){C({error:"Diagrams must be 50,000 characters or smaller."});return}return e==="dot"?(x=new Worker(new URL("/assets/graphviz.worker-CZ5dJQ9S.js",import.meta.url),{type:"module"}),A=setTimeout(()=>C({error:"Diagram layout took too long. Simplify the graph and try again."}),15e3),x.onmessage=O=>C(O.data),x.onerror=O=>C({error:O.message||"Graph renderer failed"}),x.postMessage({source:t,engine:m.engine||"dot"})):(Ah||(Ah=zg(async()=>{const{default:O}=await import("./mermaid.core-BQ5lTCZr.js").then(k=>k.ca);return{default:O}},__vite__mapDeps([0,1])).then(({default:O})=>(O.initialize({startOnLoad:!1,securityLevel:"strict",maxTextSize:5e4,maxEdges:500,suppressErrorRendering:!0,theme:"default",flowchart:{htmlLabels:!1},htmlLabels:!1}),O))),Ah.then(O=>O.render(`canvas${s}`,t)).then(({svg:O})=>C({svg:O})).catch(O=>C({error:O.message||String(O)}))),()=>{N=!1,clearTimeout(A),x==null||x.terminate()}},[e,t,m.engine,s,l]);const E=v.useMemo(()=>c.svg?"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(LI(c.svg)):null,[c.svg]),y=N=>$s(a,r,N),b=(S=c.nodes)==null?void 0:S.find(N=>N.name===m.node);return n.createElement("div",{className:`a-diagram ${i?"embedded":""}`},!i&&n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom out","data-action":"canvas.view",onClick:()=>y({zoom:Math.max(.2,h-.2)})},n.createElement(kx,null)),n.createElement("span",null,Math.round(h*100),"%"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom in","data-action":"canvas.view",onClick:()=>y({zoom:Math.min(4,h+.2)})},n.createElement(wx,null)),n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.view",onClick:()=>y({zoom:1,panX:0,panY:0})},n.createElement(Gk,null),"Fit"),e==="dot"&&n.createElement("select",{"aria-label":"Graph layout","data-action":"canvas.view",value:m.engine||"dot",onChange:N=>y({engine:N.target.value,node:""})},["dot","neato","fdp","sfdp","circo","twopi"].map(N=>n.createElement("option",{key:N},N))))),c.error?n.createElement("div",{className:"a-canvas-result error",role:"alert"},n.createElement(zn,null),n.createElement("span",null,c.error)):E?n.createElement("div",{ref:p,className:"a-diagram-stage",tabIndex:0,"aria-label":"Diagram. Drag to pan; arrow keys move the view.",onKeyDown:N=>{const x={ArrowLeft:[-30,0],ArrowRight:[30,0],ArrowUp:[0,-30],ArrowDown:[0,30]};x[N.key]&&(N.preventDefault(),y({panX:f+x[N.key][0],panY:g+x[N.key][1]}))},onPointerDown:N=>{i||(d.current={x:N.clientX,y:N.clientY},N.currentTarget.setPointerCapture(N.pointerId))},onPointerUp:N=>{d.current&&(y({panX:Math.max(-1e4,Math.min(1e4,f+N.clientX-d.current.x)),panY:Math.max(-1e4,Math.min(1e4,g+N.clientY-d.current.y))}),d.current=null)}},n.createElement("img",{alt:a.title||"Diagram",draggable:"false",src:E,style:{transform:i?void 0:`translate(${f}px,${g}px) scale(${h})`}})):n.createElement("p",{role:"status"},"Drawing diagram…"),!i&&((w=c.nodes)==null?void 0:w.length)>0&&n.createElement("div",{className:"a-node-inspector"},n.createElement("label",null,"Inspect a node",n.createElement("select",{"aria-label":"Inspect graph node","data-action":"canvas.view",value:m.node||"",onChange:N=>y({node:N.target.value})},n.createElement("option",{value:""},"Choose a node…"),c.nodes.map(N=>n.createElement("option",{key:N.name,value:N.name},N.name)))),b&&n.createElement("dl",null,Object.entries(b).map(([N,x])=>n.createElement(n.Fragment,{key:N},n.createElement("dt",null,N),n.createElement("dd",null,typeof x=="object"?JSON.stringify(x):String(x)))))))}function DI({canvas:e,act:t}){const a=v.useMemo(()=>({pre:({children:r})=>n.createElement("div",{className:"a-canvas-code-block"},r),code:({className:r,children:o,node:i,...s})=>{var u,d,p;const l=(u=/language-(\w+)/.exec(r||""))==null?void 0:u[1],c=String(o).replace(/\n$/,"");return["mermaid","dot","graphviz"].includes(l)?n.createElement(Kv,{kind:l==="mermaid"?"mermaid":"dot",source:c,canvas:e,act:t,embedded:!0,part:`fence-${((p=(d=i==null?void 0:i.position)==null?void 0:d.start)==null?void 0:p.offset)||0}`}):n.createElement("code",{className:r,...s},o)}}),[e.id,t]);return n.createElement(ml,{text:e.content,overrides:a,mapSource:!0})}function lu({text:e}){const[t,a]=v.useState("");return v.useEffect(()=>{let r=!0;return a(""),e.length<1e5&&zg(async()=>{const{default:o}=await import("./index-D1m6Llf0.js");return{default:o}},__vite__mapDeps([2,1])).then(({default:o})=>{const i=o.highlightAuto(e).value;r&&a(i)}),()=>{r=!1}},[e]),t?n.createElement("pre",{className:"a-canvas-code"},n.createElement("code",{dangerouslySetInnerHTML:{__html:t}})):n.createElement("pre",{className:"a-canvas-code"},e)}function FI({canvas:e,act:t}){var N,x;const a=vd(e,t),r=e.view||{},o=e.content||"",i=!["text","image"].includes(e.kind),s=v.useRef(null),l=v.useRef(null),c=v.useRef(!1),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=["markdown","text"].includes(e.kind)&&!r.source;v.useEffect(()=>{if(d(null),f(""),!g)return;const A=()=>{var C;c.current||(C=l.current)!=null&&C.contains(document.activeElement)||(d(ES(s.current,window.getSelection(),o)),f(""))};return document.addEventListener("selectionchange",A),()=>document.removeEventListener("selectionchange",A)},[o,g,e.id,e.resourceRevision]);async function E(){var A,C;if(!(!(u!=null&&u.excerpt)||c.current)){c.current=!0,m(!0),f("");try{const O=await t("canvas.reference",{id:e.id,sessionId:e.sessionId,version:e.selectedVersion||e.revision||e.latestVersion,...u});((A=O==null?void 0:O.result)==null?void 0:A.status)==="referenced"&&(f("Reference added to your draft. Nothing was sent."),d(null),(C=window.getSelection())==null||C.removeAllRanges())}catch(O){f(O.message||"The reference could not be added.")}finally{c.current=!1,m(!1)}}}const y=v.useMemo(()=>{if(!["json","jsonl"].includes(e.kind))return{};try{return{value:e.kind==="json"?JSON.parse(o):o.split(` +`).filter(A=>A.trim()).map(A=>JSON.parse(A))}}catch(A){return{error:A.message}}},[e.kind,o]);v.useEffect(()=>{["html","babylon","image","dot","mermaid"].includes(e.kind)||a(y.error?"error":"ready",y.error||"Preview ready")},[e.id,e.kind,y.error,a]);const b=Object.values(e.renderReports||{}),S=b.find(A=>A.status==="error"),w=b.some(A=>A.status==="pending");return n.createElement("div",{className:"a-canvas-viewer"},n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},i&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-soft","aria-pressed":!r.source,"data-action":"canvas.view",onClick:()=>$s(e,t,{source:!1})},n.createElement($k,null),"Preview"),n.createElement("button",{type:"button",className:"a-soft","aria-pressed":!!r.source,"data-action":"canvas.view",onClick:()=>$s(e,t,{source:!0})},n.createElement(jk,null),"Source")),n.createElement("span",{className:"a-canvas-format"},e.kind),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy canvas source","data-action":"canvas.copy",onClick:()=>t("canvas.copy",{id:e.id})},n.createElement(rr,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Download canvas source","data-action":"canvas.download",onClick:()=>t("canvas.download",{id:e.id})},n.createElement(wa,null)))),g&&n.createElement("div",{className:"a-canvas-reference",ref:l},n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.reference",disabled:p||!(u!=null&&u.excerpt),onMouseDown:A=>A.preventDefault(),onClick:E},p?"Adding reference…":"Reference in chat"),n.createElement("span",{role:"status",className:"a-caption"},h||(u==null?void 0:u.error)||(u!=null&&u.excerpt?`${[...u.excerpt].length} characters selected`:"Select document text to quote in your draft."))),n.createElement("div",{className:"a-canvas-preview",ref:s,tabIndex:g?0:void 0,"aria-label":g?"Document text":void 0},r.source?e.contentResource?n.createElement(jI,{canvas:e}):n.createElement(lu,{text:o}):["html","babylon"].includes(e.kind)?n.createElement(UI,{canvas:e,act:t}):["mermaid","dot"].includes(e.kind)?n.createElement(Kv,{kind:e.kind,source:o,canvas:e,act:t}):e.kind==="markdown"?n.createElement(DI,{canvas:e,act:t}):e.kind==="image"?n.createElement("img",{className:"a-canvas-image",src:o,alt:e.title||"Workspace image",onLoad:()=>a("ready","Image loaded"),onError:()=>a("error","This image could not be decoded")}):["json","jsonl"].includes(e.kind)?y.error?n.createElement("div",{className:"a-canvas-result error",role:"alert"},y.error):n.createElement(qI,{value:y.value,canvas:e,act:t}):e.kind==="code"?n.createElement(lu,{text:o}):n.createElement("pre",{className:"a-canvas-plain"},n.createElement("span",{"data-canvas-source-start":"0","data-canvas-source-end":o.length,"data-canvas-literal":"true"},o))),n.createElement(yr,{inline:!!S||w},n.createElement("div",{className:`a-canvas-result ${S?"error":w?"":"success"}`,role:"status"},S?n.createElement(zn,null):w?null:n.createElement(Pt,null),n.createElement("span",null,S?S.message||"Preview needs attention":w?"Rendering…":((x=(N=e.renderReports)==null?void 0:N.clipboard)==null?void 0:x.message)||(["html","babylon"].includes(e.kind)?"Isolated HTML preview":"Ready")))))}function qI({value:e,canvas:t,act:a}){var s;const r=((s=t.view)==null?void 0:s.query)||"",o=Array.isArray(e)?e:[e],i=o.map((l,c)=>({v:l,i:c})).filter(({v:l})=>!r||JSON.stringify(l).toLowerCase().includes(r.toLowerCase()));return n.createElement("div",{className:"a-canvas-data"},n.createElement("input",{"aria-label":"Filter data records",type:"search",placeholder:"Filter records…",value:r,"data-action":"canvas.view",onChange:l=>$s(t,a,{query:l.target.value})}),n.createElement("small",null,i.length," of ",o.length," records"),i.slice(0,200).map(({v:l,i:c})=>n.createElement("pre",{key:c},JSON.stringify(l,null,2))),i.length>200&&n.createElement("p",null,"Showing the first 200 matches. Narrow the filter to see more."))}function UI({canvas:e,act:t}){const a=v.useRef(null),r=vd(e,t),o=v.useRef(t),i=v.useRef(null);return o.current=t,v.useEffect(()=>{r("pending","Loading HTML document");const s=l=>{var c,u;if(!(l.source!==((c=a.current)==null?void 0:c.contentWindow)||((u=l.data)==null?void 0:u.id)!==e.id)&&(l.data.type==="canvas-render"&&["ready","error"].includes(l.data.status)&&r(l.data.status,String(l.data.message||"").slice(0,2e3)),l.data.type==="canvas-snapshot")){const d=l.data.document;if(!d||typeof d.text!="string"||!Array.isArray(d.controls))return;const p={text:d.text.slice(0,16e3),controls:d.controls.slice(0,100).map(m=>({id:String(m.id||"").slice(0,100),tag:String(m.tag||"").slice(0,30),type:String(m.type||"").slice(0,30),label:String(m.label||"").slice(0,200),value:String(m.value||"").slice(0,4e3),disabled:!!m.disabled}))};o.current("canvas.snapshot",{id:e.id,document:p})}};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)},[e.id,r]),v.useEffect(()=>{var l,c;const s=e.interaction;s&&i.current!==s.requestId&&(i.current=s.requestId,(c=(l=a.current)==null?void 0:l.contentWindow)==null||c.postMessage({type:"canvas-interact",...s},"*"))},[e.interaction]),n.createElement("iframe",{ref:a,title:e.title||"Interactive canvas",className:"a-canvas-html",sandbox:"allow-scripts",referrerPolicy:"no-referrer",src:$i(`/api/canvas/${e.id}/document`+(e.viewId?"?"+new URLSearchParams({viewId:e.viewId,resourceId:e.id,resourceRevision:e.resourceRevision,generation:e.generation}):""))})}function jI({canvas:e}){const[t,a]=v.useState({});return v.useEffect(()=>{const r=new AbortController;return a({}),fetch($i(`/api/canvas/${e.id}/source?version=${e.selectedVersion??e.revision??1}`),{signal:r.signal}).then(async o=>{if(!o.ok)throw Error("The saved source could not be loaded.");return o.text()}).then(o=>a({text:o})).catch(o=>{o.name!=="AbortError"&&a({error:o.message})}),()=>r.abort()},[e.id,e.selectedVersion,e.revision]),t.error?n.createElement("p",{role:"alert"},t.error):t.text===void 0?n.createElement("p",{role:"status"},"Loading saved source…"):n.createElement(lu,{text:t.text})}var $I=Object.create,bd=Object.defineProperty,BI=Object.getOwnPropertyDescriptor,HI=Object.getOwnPropertyNames,VI=Object.getPrototypeOf,WI=Object.prototype.hasOwnProperty,ZI=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),JI=(e,t)=>{let a={};for(var r in e)bd(a,r,{get:e[r],enumerable:!0});return a},KI=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=HI(t),i=0,s=o.length,l;it[c]).bind(null,l),enumerable:!(r=BI(t,l))||r.enumerable});return e},YI=(e,t,a)=>(a=e!=null?$I(VI(e)):{},KI(bd(a,"default",{value:e,enumerable:!0}),e));const GI=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function QI(e){return typeof e=="string"&&GI.has(e.replace(/#$/,""))}function cu(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function _h(e,t="|"){return e.map(a=>eb(a)).join(t)}function uu(e,t){return typeof t=="bigint"?t.toString():t}class XI{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function hl(e){return new XI(e)}function e2(e){return e==null}function yd(e){const t=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(t,a)}function t2(e,t){const a=e/t,r=Math.round(a),o=4*Number.EPSILON*Math.max(Math.abs(a),1);return Math.abs(a-r){const l=t._zod.def.shape[i];return r?r(l,i):l}):Gv(e,i,r?r(s.value,i):s.value))}}function a2(e,t){for(const a of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,a);r.enumerable&&(r.get?Yv(e,a,()=>t[a]):Gv(e,a,r.value))}}function ya(...e){const t={};for(const a of e){const r=Object.getOwnPropertyDescriptors(a);Object.assign(t,r)}return Object.defineProperties({},t)}function r2(e){return JSON.stringify(e)}function o2(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Qv="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Si(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const i2=hl(()=>{var e;if(qa.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function yo(e){if(Si(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const a=t.prototype;return!(Si(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function Xv(e){return yo(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const s2=new Set(["string","number","symbol"]);function Eo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xr(e,t,a){const r=new e._zod.constr(t??e._zod.def);return(!t||a!=null&&a.parent)&&(r._zod.parent=e),r}function Ve(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function eb(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function l2(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const tb={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]},c2={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function u2(e,t){const a=e._zod.def,r=a.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return $r(i,e,fl(e,t)),xr(e,ya(a,{shape:i,checks:[]}))}function fl(e,t){var o;const a=ar(e),r=[];for(const i of Reflect.ownKeys(t)){if(!((o=Object.getOwnPropertyDescriptor(a,i))!=null&&o.enumerable))throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function d2(e,t){const a=e._zod.def,r=a.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(fl(e,t)),s={};return $r(s,e,Reflect.ownKeys(ar(e)).filter(l=>!i.has(l))),xr(e,ya(a,{shape:s,checks:[]}))}function p2(e,t){if(!yo(t))throw new Error("Invalid input to extend: expected a plain object");const a=e._zod.def.checks;if(a&&a.length>0){const o=ar(e);for(const i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xr(e,ya(e._zod.def,{shape:nb(e,t)}))}function nb(e,t){const a={};return $r(a,e,Reflect.ownKeys(ar(e))),a2(a,t),a}function m2(e,t){if(!yo(t))throw new Error("Invalid input to safeExtend: expected a plain object");return xr(e,ya(e._zod.def,{shape:nb(e,t)}))}function h2(e,t){var o,i;if(!((o=t==null?void 0:t._zod)!=null&&o.def))throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if((i=e._zod.def.checks)!=null&&i.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const a={};$r(a,e,Reflect.ownKeys(ar(e))),$r(a,t,Reflect.ownKeys(ar(t)));const r=ya(e._zod.def,{shape:a,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return xr(e,r)}function Oh(e,t,a,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const l=a?new Set(fl(t,a)):void 0,c={};return $r(c,t,Reflect.ownKeys(ar(t)),e&&((u,d)=>l&&!l.has(d)?u:new e({type:"optional",innerType:u}))),xr(t,ya(t._zod.def,{shape:c,checks:[]}))}function f2(e,t,a){const r=a?new Set(fl(t,a)):void 0,o={};return $r(o,t,Reflect.ownKeys(ar(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),xr(t,ya(t._zod.def,{shape:o}))}function er(e,t=0){var a;if(e.aborted===!0)return!0;for(let r=t;r{var r;return(r=a).path??(r.path=[]),a.path.unshift(e),a})}function Qo(e){return typeof e=="string"?e:e==null?void 0:e.message}function Mh(e,t,a){var r;for(let o=t;oe;return t[x2]=!0,t}var Lh;const C2=Object.freeze({status:"aborted"}),gc={value:void 0,enumerable:!1};let Dh="captureStackTrace"in Error?Error:null;function N2(e){const t=Dh;if(t){const a=t.stackTraceLimit;if(typeof a=="number"){try{t.stackTraceLimit=0}catch{return Dh=null,new e}try{return new e}finally{t.stackTraceLimit=a}}}return new e}function ce(e,t,a,r){const o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;const s=a,l=s&&new WeakSet;function c(m,h){if(!m._zod){gc.value=new i(h);try{Object.defineProperty(m,"_zod",gc)}finally{gc.value=void 0}}if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,h),l){const g=Object.getPrototypeOf(m),E=m._zod.constr.prototype;let y=g;for(;y&&y!==E;)y=Object.getPrototypeOf(y);const b=y??g;l.has(b)||(l.add(b),y2(b,s))}const f=p.prototype;for(const g in f)Object.prototype.hasOwnProperty.call(f,g)&&(g in m||(m[g]=f[g].bind(m)))}const u=(r==null?void 0:r.Parent)??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function p(m){var E;const h=r!=null&&r.Parent?N2(d):this;c(h,m);const f=h._zod.deferred;if(f){for(const y of f)y();h._zod.deferred=void 0}const g=(E=globalThis.__zod_globalConfig)==null?void 0:E.postProcessor;return g&&g(h),h}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:m=>{var h,f;return r!=null&&r.Parent&&m instanceof r.Parent?!0:(f=(h=m==null?void 0:m._zod)==null?void 0:h.traits)==null?void 0:f.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class zr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ob extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Lh=globalThis).__zod_globalConfig??(Lh.__zod_globalConfig={});const qa=globalThis.__zod_globalConfig;function Ka(e){return e&&Object.assign(qa,e),qa}function R2(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,uu,2)),e.message}function T2(e){this._zod.message=e}const I2={get:R2,set:T2,enumerable:!0,configurable:!0},vc={value:void 0,enumerable:!1},Fh=new WeakSet([Object.prototype,Error.prototype]),A2=(e,t)=>{e.name="$ZodError",vc.value=t,Object.defineProperty(e,"issues",vc),vc.value=void 0,Object.defineProperty(e,"message",I2);const a=Object.getPrototypeOf(e);Fh.has(a)||(Fh.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},_2=ce("$ZodError",A2);function P2(e,t,a){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:a(),writable:!0,enumerable:!0,configurable:!0}):e[t]=a()),e[t]}function O2(e,t=a=>a.message){const a={},r=[];for(const o of e.issues)o.path.length>0?P2(a,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:a}}function M2(e,t=a=>a.message){const a={_errors:[]},r=(o,i=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>r({issues:l},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{const l=[...i,...s.path];if(l.length===0)a._errors.push(t(s));else{let c=a,u=0;for(;u{const t=(a,r,o,i)=>{const s=o?{...o,async:!1}:{async:!1},l=a._zod.run({value:r,issues:[]},s);if(l instanceof Promise)throw new zr;if(l.issues.length){const c=new((i==null?void 0:i.Err)??e)(l.issues.map(u=>Er(u,s,Ka())));throw Qv(c,(i==null?void 0:i.callee)??t),c}return l.value};return t},Sd=e=>{const t=async(a,r,o,i)=>{const s=o?{...o,async:!0}:{async:!0};let l=a._zod.run({value:r,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const c=new((i==null?void 0:i.Err)??e)(l.issues.map(u=>Er(u,s,Ka())));throw Qv(c,(i==null?void 0:i.callee)??t),c}return l.value};return t},Cd=e=>(t,a,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:a,issues:[]},o);if(i instanceof Promise)throw new zr;return i.issues.length?ib(e,i.issues,o):{success:!0,data:i.value}};function ib(e,t,a){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>Er(o,a,Ka()))),t=void 0,a=void 0),r},set error(o){r=o,t=void 0,a=void 0}}}const Nd=e=>async(t,a,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:a,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?ib(e,i.issues,o):{success:!0,data:i.value}},z2=Symbol.for("zod.compile.invalid"),L2=Symbol.for("zod.compile.fallback"),D2=((e,t,a)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==z2)return!0;if(r.definite===!0&&a===void 0)return!1}return F2(e,t,a)});function F2(e,t,a){const r=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;let i;if(o?(r[L2]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new zr;return i.issues.length===0}const q2=async(e,t,a)=>{const r=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},U2=e=>{const t=xd(e),a=(r,o,i,s)=>{const l=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,l,gl(a,s))};return a},j2=e=>{const t=xd(e),a=(r,o,i,s)=>t(r,o,i,gl(a,s));return a},$2=e=>{const t=Sd(e),a=async(r,o,i,s)=>{const l=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,l,gl(a,s))};return a},B2=e=>{const t=Sd(e),a=async(r,o,i,s)=>await t(r,o,i,gl(a,s));return a},H2=e=>(t,a,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Cd(e)(t,a,o)},V2=e=>(t,a,r)=>Cd(e)(t,a,r),W2=e=>async(t,a,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Nd(e)(t,a,o)},Z2=e=>async(t,a,r)=>Nd(e)(t,a,r),J2=/^[cC][0-9a-z]{6,}$/,K2=/^[0-9a-z]+$/,Y2=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,G2=/^[0-9a-vA-V]{20}$/,Q2=/^[A-Za-z0-9]{27}$/,X2=/^[a-zA-Z0-9_-]{21}$/;function eA(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const tA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nA=/^([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})$/,qh=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,aA=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rA="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function oA(){return new RegExp(rA,"u")}const iA=/^(?:(?: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])$/,sA=/^(([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}|:))$/,lA=/^((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])$/,cA=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dA=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,pA=/^https?$/,mA=/^\+[1-9]\d{6,14}$/,sb="(?:(?:\\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])))";function hA(e){return new RegExp(`^${e}$`)}const fA=hA(sb);function du(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gA(e){return new RegExp(`^${du(e)}$`)}function vA(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${du({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${a}|${du({precision:e.precision})}`:a;return new RegExp(`^${sb}T(?:${r})$`)}const bA=/^[\s\S]{0,}$/,yA=/^-?\d+$/,Rd=/^-?\d+(?:\.\d+)?$/,EA=/^(?:true|false)$/i,wA=/^null$/i,kA=/^undefined$/i,xA=/^[^A-Z]*$/,SA=/^[^a-z]*$/,ca=ce("$ZodCheck",(e,t)=>{var a;e._zod??(e._zod={}),e._zod.def=t,(a=e._zod).onattach??(a.onattach=[])}),Td=e=>{const t=e.value;return!e2(t)&&t.length!==void 0},Bs={number:"number",bigint:"bigint",object:"date"},lb=ce("$ZodCheckLessThan",(e,t)=>{ca.init(e,t);const a=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{ca.init(e,t);const a=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Bs[typeof r.value]??a,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),CA=ce("$ZodCheckMultipleOf",(e,t)=>{ca.init(e,t),e._zod.check=a=>{if(typeof a.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?t.value!==BigInt(0)&&a.value%t.value===BigInt(0):t2(a.value,t.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:t.value,input:a.value,inst:e,continue:!t.abort})}}),NA=ce("$ZodCheckNumberFormat",(e,t)=>{var s;ca.init(e,t),t.format=t.format||"float64";const a=(s=t.format)==null?void 0:s.includes("int"),r=a?"int":"number",[o,i]=tb[t.format];e._zod.check=l=>{const c=l.value;if(a){if(!Number.isInteger(c)){l.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?l.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):l.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}ci&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),RA=ce("$ZodCheckMaxLength",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?wd(o):i)<=t.maximum)return;const l=kd(o);r.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),TA=ce("$ZodCheckMinLength",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i=t.minimum)return;const l=kd(o);r.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),IA=ce("$ZodCheckLengthEquals",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?wd(o):i;if(s===t.length)return;const l=kd(o),c=s>t.length;r.issues.push({origin:l,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),vl=ce("$ZodCheckStringFormat",(e,t)=>{var a,r;ca.init(e,t),t.pattern?(a=e._zod).check??(a.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),AA=ce("$ZodCheckRegex",(e,t)=>{vl.init(e,t),e._zod.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_A=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xA),vl.init(e,t)}),PA=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=SA),vl.init(e,t)}),OA=ce("$ZodCheckIncludes",(e,t)=>{ca.init(e,t);const a=Eo(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${a}`:a);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),MA=ce("$ZodCheckStartsWith",(e,t)=>{ca.init(e,t);const a=new RegExp(`^${Eo(t.prefix)}.*`);t.pattern??(t.pattern=a),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),zA=ce("$ZodCheckEndsWith",(e,t)=>{ca.init(e,t);const a=new RegExp(`.*${Eo(t.suffix)}$`);t.pattern??(t.pattern=a),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),LA=ce("$ZodCheckOverwrite",(e,t)=>{ca.init(e,t),e._zod.check=a=>{a.value=t.tx(a.value)}});class DA{constructor(t=[],a={}){this.content=[],this.indent=0,this.args=t,this.closed=a}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(` `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,a=(this==null?void 0:this.content)??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) { ${a.join(` `)} -};`)(...Object.values(this.closed))}}const FA={major:4,minor:6,patch:2},Vt=ce("$ZodType",(e,t)=>{var i;var a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=FA;const r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r!=null&&r.length?[...r]:[];for(const s of o)for(const l of s._zod.onattach)l(e);if(o.length===0)(a=e._zod).deferred??(a.deferred=[]),(i=e._zod.deferred)==null||i.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,u,d)=>{if(c.memo)return c;let p=er(c),m;for(const h of u){if(h._zod.def.when){if(g2(c)||!h._zod.def.when(c))continue}else if(p)continue;const f=c.issues.length,g=h._zod.check(c);if(g instanceof Promise&&(d==null?void 0:d.async)===!1)throw new zr;if(m||g instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await g,c.issues.length!==f&&(Mh(c.issues,f,e),p||(p=er(c,f)))});else{if(c.issues.length===f)continue;Mh(c.issues,f,e),p||(p=er(c,f))}}return m?m.then(()=>c):c},l=(c,u,d)=>{if(er(c))return c.aborted=!0,c;const p=s(u,o,d);if(p instanceof Promise){if(d.async===!1)throw new zr;return p.then(m=>e._zod.parse(m,d))}return e._zod.parse(p,d)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){const p=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});return p instanceof Promise?p.then(m=>l(m,c,u)):l(p,c,u)}const d=e._zod.parse(c,u);if(d instanceof Promise){if(u.async===!1)throw new zr;return d.then(p=>s(p,o,u))}return s(d,o,u)}}},{get"~standard"(){return ab(this,"~standard",db(this))},set"~standard"(e){wr(this,"~standard",e)}}),ub=(e,t)=>e.issues.length?{issues:e.issues.map(a=>Er(a,t,Ka()))}:{value:e.value};async function qA(e,t){const a={async:!0};return ub(await e._zod.run({value:t,issues:[]},a),a)}function db(e){return{validate:t=>{const a={async:!1};try{const r=e._zod.run({value:t,issues:[]},a);if(!(r instanceof Promise))return ub(r,a)}catch{}return qA(e,t)},vendor:"zod",version:1}}const Id=ce("$ZodString",(e,t)=>{Vt.init(e,t),e._zod.pattern=t.pattern??bA,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),tn=ce("$ZodStringFormat",(e,t)=>{vl.init(e,t),Id.init(e,t)}),UA=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=nA),tn.init(e,t)}),jA=ce("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=qh(r))}else t.pattern??(t.pattern=qh());tn.init(e,t)}),$A=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=aA),tn.init(e,t)}),pb=1,mb=2;function BA(e,t){var a;if(!t.normalize&&((a=t.protocol)==null?void 0:a.source)===pA.source&&!/^https?:\/\//i.test(e))return pb;try{return new URL(e)}catch{return mb}}const HA=/[\t\n\r]/g;function VA(e){return e.replace(HA,"")}function WA(e,t){return t.lastIndex=0,t.test(e.hostname)}function ZA(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const JA=ce("$ZodURL",(e,t)=>{tn.init(e,t),e._zod.check=a=>{try{const r=a.value.trim(),o=BA(r,t);if(o===pb){a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:e,continue:!t.abort});return}if(o===mb){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort});return}t.hostname&&!WA(o,t.hostname)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:a.value,inst:e,continue:!t.abort}),t.protocol&&!ZA(o,t.protocol)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:a.value,inst:e,continue:!t.abort}),a.value=t.normalize?o.href:VA(r);return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort})}}}),KA=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=oA()),tn.init(e,t)}),YA=ce("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?X2:eA(t.length)),tn.init(e,t)}),GA=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=J2),tn.init(e,t)}),QA=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=K2),tn.init(e,t)}),XA=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Y2),tn.init(e,t)}),e_=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=G2),tn.init(e,t)}),t_=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Q2),tn.init(e,t)}),n_=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vA(t)),tn.init(e,t)}),a_=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fA),tn.init(e,t)}),r_=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gA(t)),tn.init(e,t)}),o_=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tA),tn.init(e,t)}),i_=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=iA),tn.init(e,t)}),s_=/^[0-9a-fA-F:.]+$/;function hb(e){if(!s_.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const l_=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=sA),tn.init(e,t),e._zod.check=a=>{hb(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:e,continue:!t.abort})}}),c_=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=lA),tn.init(e,t)});function u_(e){const t=e.split("/");if(t.length!==2)return!1;const[a,r]=t;if(!r)return!1;const o=Number(r);return`${o}`!==r||o<0||o>128?!1:hb(a)}const d_=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=cA),tn.init(e,t),e._zod.check=a=>{u_(a.value)||a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:e,continue:!t.abort})}});function fb(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const gb=/^[0-9a-zA-Z+/]*={0,2}$/,p_=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gb),tn.init(e,t),e._zod.check=a=>{fb(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:e,continue:!t.abort})}}),Ad=/^[A-Za-z0-9_-]*$/;function m_(e){if(!Ad.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),a=t.padEnd(Math.ceil(t.length/4)*4,"=");return fb(a)}const h_=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ad),tn.init(e,t),e._zod.check=a=>{m_(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:e,continue:!t.abort})}}),f_=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=mA),tn.init(e,t)});function g_(e,t=null){try{const a=e.split(".");if(a.length!==3)return!1;const[r]=a;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const v_=ce("$ZodJWT",(e,t)=>{tn.init(e,t),e._zod.check=a=>{g_(a.value,t.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:e,continue:!t.abort})}}),vb=ce("$ZodNumber",(e,t)=>{Vt.init(e,t),e._zod.pattern=Rd,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=Number(a.value)}catch{}const o=a.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return a;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),a}}),b_=ce("$ZodNumberFormat",(e,t)=>{NA.init(e,t),vb.init(e,t)}),y_=ce("$ZodBoolean",(e,t)=>{Vt.init(e,t),e._zod.pattern=EA,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=!!a.value}catch{}const o=a.value;return typeof o=="boolean"||a.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),a}}),E_=ce("$ZodUndefined",(e,t)=>{Vt.init(e,t),e._zod.pattern=kA,e._zod.values=new Set([void 0]),e._zod.parse=(a,r)=>{const o=a.value;return typeof o>"u"||a.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),a}}),w_=ce("$ZodNull",(e,t)=>{Vt.init(e,t),e._zod.pattern=wA,e._zod.values=new Set([null]),e._zod.parse=(a,r)=>{const o=a.value;return o===null||a.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),a}}),k_=ce("$ZodAny",(e,t)=>{Vt.init(e,t),e._zod.parse=a=>a}),x_=ce("$ZodUnknown",(e,t)=>{Vt.init(e,t),e._zod.parse=a=>a}),S_=ce("$ZodNever",(e,t)=>{Vt.init(e,t),e._zod.parse=(a,r)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:e}),a)});function Uh(e,t,a){e.issues.length&&t.issues.push(...no(a,e.issues)),t.value[a]=e.value}const C_=ce("$ZodArray",(e,t)=>{Vt.init(e,t);const a=qa.memoizer;a==null||a.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=a?a.alloc(e,r,Array(i.length),o):Array(i.length);const s=[],l=o==null?void 0:o.abortEarly;for(let c=0;cUh(p,r,c)));else if(Uh(d,r,c),l&&d.issues.length!==0&&er(d))break}return s.length?Promise.all(s).then(()=>r):r}});function Hs(e,t,a,r,o,i){const s=a in r,l=i==="optional";if(!(!s&&l&&o==="optional")){if(e.issues.length){if(o!==void 0&&l&&!s)return;t.issues.push(...no(a,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}e.value===void 0?(s||o==="defaulted"&&!l)&&(t.value[a]=void 0):t.value[a]=e.value}}const N_=[];function bb(e){var s,l,c,u;const t=Object.keys(e.shape),a=Object.getOwnPropertySymbols(e.shape),r=a.length?a:N_,o=r.length?[...t,...r]:t;for(const d of o)if(!((u=(c=(l=(s=e.shape)==null?void 0:s[d])==null?void 0:l._zod)==null?void 0:c.traits)!=null&&u.has("$ZodType")))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const i=l2(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function yb(e,t,a,r,o,i,s){const l=[],c=o.keySet,u=o.catchall._zod,d=u.def.type,p=u.optin,m=u.optout;let h=0;for(const f in t){if(s&&a.issues.length!==h){if(er(a,h))break;h=a.issues.length}if(c.has(f))continue;if(f==="__proto__"){d==="never"&&l.push(f);continue}if(d==="never"){l.push(f);continue}const g=u.run({value:t[f],issues:[]},r);g instanceof Promise?e.push(g.then(y=>Hs(y,a,f,t,p,m))):Hs(g,a,f,t,p,m)}return l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>a):a}const R_=ce("$ZodObject",(e,t)=>{Vt.init(e,t);const a=Object.getOwnPropertyDescriptor(t,"shape"),r=a!=null&&a.get?a.get.raw:t.shape??{};if(r){const u=()=>{const d={...r};return Object.defineProperty(t,"shape",{value:d}),u.raw=d,d};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const o=hl(()=>bb(t));Ct(e,"propValues",u=>{const d=u.def.shape,p={};for(const m in d){const h=d[m]._zod;if(h.values){Object.prototype.hasOwnProperty.call(p,m)||Ua(p,m,new Set);for(const f of h.values)p[m].add(f);h.optin!==void 0&&p[m].add(void 0)}}return p});const i=Si,s=t.catchall;let l;const c=qa.memoizer;c==null||c.attach(e),e._zod.parse=(u,d)=>{l??(l=o.value);const p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},d):{};const m=[],h=l.shape,f=d==null?void 0:d.abortEarly;let g=u.issues.length;for(const y of l.allKeys){if(f&&u.issues.length!==g){if(er(u,g))break;g=u.issues.length}if(y==="__proto__")continue;const E=h[y],b=E._zod.optin,S=E._zod.optout,w=E._zod.run({value:p[y],issues:[]},d);w instanceof Promise?m.push(w.then(N=>Hs(N,u,y,p,b,S))):Hs(w,u,y,p,b,S)}return s?yb(m,p,u,d,o.value,e,f===!0):m.length?Promise.all(m).then(()=>u):u}}),T_=ce("$ZodObjectJIT",(e,t)=>{R_.init(e,t);const a=e._zod.parse,r=hl(()=>bb(t)),o=qa.memoizer,i=h=>{var N,x;const f=r.value,g=f.symbolKeys,y=new DA(["payload","ctx"],{shape:h,inst:e,memo:o,syms:g}),E=A=>`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`,b=(A,C)=>` +};`)(...Object.values(this.closed))}}const FA={major:4,minor:6,patch:2},Vt=ce("$ZodType",(e,t)=>{var i;var a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=FA;const r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r!=null&&r.length?[...r]:[];for(const s of o)for(const l of s._zod.onattach)l(e);if(o.length===0)(a=e._zod).deferred??(a.deferred=[]),(i=e._zod.deferred)==null||i.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,u,d)=>{if(c.memo)return c;let p=er(c),m;for(const h of u){if(h._zod.def.when){if(g2(c)||!h._zod.def.when(c))continue}else if(p)continue;const f=c.issues.length,g=h._zod.check(c);if(g instanceof Promise&&(d==null?void 0:d.async)===!1)throw new zr;if(m||g instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await g,c.issues.length!==f&&(Mh(c.issues,f,e),p||(p=er(c,f)))});else{if(c.issues.length===f)continue;Mh(c.issues,f,e),p||(p=er(c,f))}}return m?m.then(()=>c):c},l=(c,u,d)=>{if(er(c))return c.aborted=!0,c;const p=s(u,o,d);if(p instanceof Promise){if(d.async===!1)throw new zr;return p.then(m=>e._zod.parse(m,d))}return e._zod.parse(p,d)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){const p=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});return p instanceof Promise?p.then(m=>l(m,c,u)):l(p,c,u)}const d=e._zod.parse(c,u);if(d instanceof Promise){if(u.async===!1)throw new zr;return d.then(p=>s(p,o,u))}return s(d,o,u)}}},{get"~standard"(){return ab(this,"~standard",db(this))},set"~standard"(e){wr(this,"~standard",e)}}),ub=(e,t)=>e.issues.length?{issues:e.issues.map(a=>Er(a,t,Ka()))}:{value:e.value};async function qA(e,t){const a={async:!0};return ub(await e._zod.run({value:t,issues:[]},a),a)}function db(e){return{validate:t=>{const a={async:!1};try{const r=e._zod.run({value:t,issues:[]},a);if(!(r instanceof Promise))return ub(r,a)}catch{}return qA(e,t)},vendor:"zod",version:1}}const Id=ce("$ZodString",(e,t)=>{Vt.init(e,t),e._zod.pattern=t.pattern??bA,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),tn=ce("$ZodStringFormat",(e,t)=>{vl.init(e,t),Id.init(e,t)}),UA=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=nA),tn.init(e,t)}),jA=ce("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=qh(r))}else t.pattern??(t.pattern=qh());tn.init(e,t)}),$A=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=aA),tn.init(e,t)}),pb=1,mb=2;function BA(e,t){var a;if(!t.normalize&&((a=t.protocol)==null?void 0:a.source)===pA.source&&!/^https?:\/\//i.test(e))return pb;try{return new URL(e)}catch{return mb}}const HA=/[\t\n\r]/g;function VA(e){return e.replace(HA,"")}function WA(e,t){return t.lastIndex=0,t.test(e.hostname)}function ZA(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const JA=ce("$ZodURL",(e,t)=>{tn.init(e,t),e._zod.check=a=>{try{const r=a.value.trim(),o=BA(r,t);if(o===pb){a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:e,continue:!t.abort});return}if(o===mb){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort});return}t.hostname&&!WA(o,t.hostname)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:a.value,inst:e,continue:!t.abort}),t.protocol&&!ZA(o,t.protocol)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:a.value,inst:e,continue:!t.abort}),a.value=t.normalize?o.href:VA(r);return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort})}}}),KA=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=oA()),tn.init(e,t)}),YA=ce("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?X2:eA(t.length)),tn.init(e,t)}),GA=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=J2),tn.init(e,t)}),QA=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=K2),tn.init(e,t)}),XA=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Y2),tn.init(e,t)}),e_=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=G2),tn.init(e,t)}),t_=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Q2),tn.init(e,t)}),n_=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vA(t)),tn.init(e,t)}),a_=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fA),tn.init(e,t)}),r_=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gA(t)),tn.init(e,t)}),o_=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tA),tn.init(e,t)}),i_=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=iA),tn.init(e,t)}),s_=/^[0-9a-fA-F:.]+$/;function hb(e){if(!s_.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const l_=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=sA),tn.init(e,t),e._zod.check=a=>{hb(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:e,continue:!t.abort})}}),c_=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=lA),tn.init(e,t)});function u_(e){const t=e.split("/");if(t.length!==2)return!1;const[a,r]=t;if(!r)return!1;const o=Number(r);return`${o}`!==r||o<0||o>128?!1:hb(a)}const d_=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=cA),tn.init(e,t),e._zod.check=a=>{u_(a.value)||a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:e,continue:!t.abort})}});function fb(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const gb=/^[0-9a-zA-Z+/]*={0,2}$/,p_=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gb),tn.init(e,t),e._zod.check=a=>{fb(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:e,continue:!t.abort})}}),Ad=/^[A-Za-z0-9_-]*$/;function m_(e){if(!Ad.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),a=t.padEnd(Math.ceil(t.length/4)*4,"=");return fb(a)}const h_=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ad),tn.init(e,t),e._zod.check=a=>{m_(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:e,continue:!t.abort})}}),f_=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=mA),tn.init(e,t)});function g_(e,t=null){try{const a=e.split(".");if(a.length!==3)return!1;const[r]=a;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const v_=ce("$ZodJWT",(e,t)=>{tn.init(e,t),e._zod.check=a=>{g_(a.value,t.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:e,continue:!t.abort})}}),vb=ce("$ZodNumber",(e,t)=>{Vt.init(e,t),e._zod.pattern=Rd,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=Number(a.value)}catch{}const o=a.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return a;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),a}}),b_=ce("$ZodNumberFormat",(e,t)=>{NA.init(e,t),vb.init(e,t)}),y_=ce("$ZodBoolean",(e,t)=>{Vt.init(e,t),e._zod.pattern=EA,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=!!a.value}catch{}const o=a.value;return typeof o=="boolean"||a.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),a}}),E_=ce("$ZodUndefined",(e,t)=>{Vt.init(e,t),e._zod.pattern=kA,e._zod.values=new Set([void 0]),e._zod.parse=(a,r)=>{const o=a.value;return typeof o>"u"||a.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),a}}),w_=ce("$ZodNull",(e,t)=>{Vt.init(e,t),e._zod.pattern=wA,e._zod.values=new Set([null]),e._zod.parse=(a,r)=>{const o=a.value;return o===null||a.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),a}}),k_=ce("$ZodAny",(e,t)=>{Vt.init(e,t),e._zod.parse=a=>a}),x_=ce("$ZodUnknown",(e,t)=>{Vt.init(e,t),e._zod.parse=a=>a}),S_=ce("$ZodNever",(e,t)=>{Vt.init(e,t),e._zod.parse=(a,r)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:e}),a)});function Uh(e,t,a){e.issues.length&&t.issues.push(...no(a,e.issues)),t.value[a]=e.value}const C_=ce("$ZodArray",(e,t)=>{Vt.init(e,t);const a=qa.memoizer;a==null||a.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=a?a.alloc(e,r,Array(i.length),o):Array(i.length);const s=[],l=o==null?void 0:o.abortEarly;for(let c=0;cUh(p,r,c)));else if(Uh(d,r,c),l&&d.issues.length!==0&&er(d))break}return s.length?Promise.all(s).then(()=>r):r}});function Hs(e,t,a,r,o,i){const s=a in r,l=i==="optional";if(!(!s&&l&&o==="optional")){if(e.issues.length){if(o!==void 0&&l&&!s)return;t.issues.push(...no(a,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}e.value===void 0?(s||o==="defaulted"&&!l)&&(t.value[a]=void 0):t.value[a]=e.value}}const N_=[];function bb(e){var s,l,c,u;const t=Object.keys(e.shape),a=Object.getOwnPropertySymbols(e.shape),r=a.length?a:N_,o=r.length?[...t,...r]:t;for(const d of o)if(!((u=(c=(l=(s=e.shape)==null?void 0:s[d])==null?void 0:l._zod)==null?void 0:c.traits)!=null&&u.has("$ZodType")))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const i=l2(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function yb(e,t,a,r,o,i,s){const l=[],c=o.keySet,u=o.catchall._zod,d=u.def.type,p=u.optin,m=u.optout;let h=0;for(const f in t){if(s&&a.issues.length!==h){if(er(a,h))break;h=a.issues.length}if(c.has(f))continue;if(f==="__proto__"){d==="never"&&l.push(f);continue}if(d==="never"){l.push(f);continue}const g=u.run({value:t[f],issues:[]},r);g instanceof Promise?e.push(g.then(E=>Hs(E,a,f,t,p,m))):Hs(g,a,f,t,p,m)}return l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>a):a}const R_=ce("$ZodObject",(e,t)=>{Vt.init(e,t);const a=Object.getOwnPropertyDescriptor(t,"shape"),r=a!=null&&a.get?a.get.raw:t.shape??{};if(r){const u=()=>{const d={...r};return Object.defineProperty(t,"shape",{value:d}),u.raw=d,d};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const o=hl(()=>bb(t));Ct(e,"propValues",u=>{const d=u.def.shape,p={};for(const m in d){const h=d[m]._zod;if(h.values){Object.prototype.hasOwnProperty.call(p,m)||Ua(p,m,new Set);for(const f of h.values)p[m].add(f);h.optin!==void 0&&p[m].add(void 0)}}return p});const i=Si,s=t.catchall;let l;const c=qa.memoizer;c==null||c.attach(e),e._zod.parse=(u,d)=>{l??(l=o.value);const p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},d):{};const m=[],h=l.shape,f=d==null?void 0:d.abortEarly;let g=u.issues.length;for(const E of l.allKeys){if(f&&u.issues.length!==g){if(er(u,g))break;g=u.issues.length}if(E==="__proto__")continue;const y=h[E],b=y._zod.optin,S=y._zod.optout,w=y._zod.run({value:p[E],issues:[]},d);w instanceof Promise?m.push(w.then(N=>Hs(N,u,E,p,b,S))):Hs(w,u,E,p,b,S)}return s?yb(m,p,u,d,o.value,e,f===!0):m.length?Promise.all(m).then(()=>u):u}}),T_=ce("$ZodObjectJIT",(e,t)=>{R_.init(e,t);const a=e._zod.parse,r=hl(()=>bb(t)),o=qa.memoizer,i=h=>{var N,x;const f=r.value,g=f.symbolKeys,E=new DA(["payload","ctx"],{shape:h,inst:e,memo:o,syms:g}),y=A=>`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`,b=(A,C)=>` let ${A}_ab = false; for (let i = 0; i < ${A}.issues.length; i++) { const iss = ${A}.issues[i]; @@ -568,25 +568,25 @@ ${a.join(` if (${A}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; - }`;y.write("const input = payload.value;");const S=Object.create(null);let w=0;for(const A of f.allKeys)S[A]=`key_${w++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const A of f.allKeys){if(A==="__proto__")continue;const C=S[A],O=typeof A=="symbol"?`syms[${g.indexOf(A)}]`:r2(A),k=`${O} in input`,T=h[A],I=(N=T==null?void 0:T._zod)==null?void 0:N.optin,F=I!==void 0,z=((x=T==null?void 0:T._zod)==null?void 0:x.optout)==="optional";if(y.write(`const ${C} = ${E(O)};`),F&&z){const U=I==="optional"?`${C}_present`:`${C}.value !== undefined || ${C}_present`;y.write(` + }`;E.write("const input = payload.value;");const S=Object.create(null);let w=0;for(const A of f.allKeys)S[A]=`key_${w++}`;E.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const A of f.allKeys){if(A==="__proto__")continue;const C=S[A],O=typeof A=="symbol"?`syms[${g.indexOf(A)}]`:r2(A),k=`${O} in input`,T=h[A],I=(N=T==null?void 0:T._zod)==null?void 0:N.optin,F=I!==void 0,z=((x=T==null?void 0:T._zod)==null?void 0:x.optout)==="optional";if(E.write(`const ${C} = ${y(O)};`),F&&z){const q=I==="optional"?`${C}_present`:`${C}.value !== undefined || ${C}_present`;E.write(` const ${C}_present = ${k}; if (!${C}.issues.length || ${C}_present) { if (${C}.issues.length) {${b(C,O)} } - if (${U}) { + if (${q}) { newResult[${O}] = ${C}.value; } } - `)}else F?(y.write(` + `)}else F?(E.write(` if (${C}.issues.length) {${b(C,O)} } - `),I==="defaulted"?y.write(`newResult[${O}] = ${C}.value;`):y.write(` + `),I==="defaulted"?E.write(`newResult[${O}] = ${C}.value;`):E.write(` if (${C}.value !== undefined || ${k}) { newResult[${O}] = ${C}.value; } - `)):y.write(` + `)):E.write(` const ${C}_present = ${k}; if (${C}.issues.length) {${b(C,O)} } @@ -607,9 +607,9 @@ ${a.join(` newResult[${O}] = ${C}.value; } - `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()};let s;const l=Si,c=!qa.jitless,d=c&&i2.value,p=t.catchall;let m;e._zod.parse=(h,f)=>{m??(m=r.value);const g=h.value;return l(g)?c&&d&&(f==null?void 0:f.async)===!1&&f.jitless!==!0?(s||(s=i(t.shape)),h=s(h,f),p?yb([],g,h,f,m,e,(f==null?void 0:f.abortEarly)===!0):h):a(h,f):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h)}});function jh(e,t,a,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!er(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(i=>i.issues.map(s=>Er(s,r,Ka())))}),t)}const Eb=ce("$ZodUnion",(e,t)=>{Vt.init(e,t),Ct(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),Ct(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Ct(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),Ct(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){const o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>yd(i.source)).join("|")})$`)}});const a=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(a)return a(r,o);let i=!1;const s=[];for(const l of t.options){const c=l._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(l=>jh(l,r,e,o)):jh(s,r,e,o)}});function I_(e){var a;const t=new Map;for(const r of e.options){const o=(a=r._zod.propValues)==null?void 0:a[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(const i of o)if(t.has(i)){if(i!==void 0)throw new Error(`Duplicate discriminator value "${String(i)}"`);t.set(i,null)}else t.set(i,r)}return t}const A_=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Eb.init(e,t);const a=e._zod.parse;Ct(e,"propValues",o=>{var l,c;const i={};let s=0;for(const u of o.def.options){const d=u._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(u)}"`);(l=d[o.def.discriminator])!=null&&l.has(void 0)&&s++;for(const[p,m]of Object.entries(d)){Object.prototype.hasOwnProperty.call(i,p)||Ua(i,p,new Set);for(const h of m)i[p].add(h)}}return!o.def.unionFallback&&s>1&&((c=i[o.def.discriminator])==null||c.delete(void 0)),i}),t.options.forEach((o,i)=>{const s=Ed(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});const r=hl(()=>I_(t));e._zod.parse=(o,i)=>{const s=o.value;if(!Si(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const l=s==null?void 0:s[t.discriminator],c=r.value.get(l);return c&&(l!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?a(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),__=ce("$ZodIntersection",(e,t)=>{Vt.init(e,t),e._zod.parse=(a,r)=>{const o=a.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>$h(a,c,u)):$h(a,i,s)}});function pu(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yo(e)&&yo(t)){const a=Object.keys(t),r=Object.keys(e).filter(i=>a.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const i of r){if(i==="__proto__")continue;const s=pu(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let r=0;r{var m,h;let p;if(u.code==="unrecognized_keys"&&!((m=u.path)!=null&&m.length))o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&((h=u.path)==null?void 0:h.length)===1){const f=String(u.path[0]);i.has(f)||i.set(f,u),p=[f]}else return!1;for(const f of p)r.has(f)||r.set(f,{}),r.get(f)[d]=!0;return!0};for(const u of t.issues)s(u,"l")||e.issues.push(u);for(const u of a.issues)s(u,"r")||e.issues.push(u);const l=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(l.length){const u=o?l.filter(d=>o.keys.includes(d)):[];u.length&&e.issues.push({...o,keys:u});for(const d of l)!u.includes(d)&&i.has(d)&&e.issues.push(i.get(d))}const c=pu(t.value,a.value);if(!c.valid){if(er(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const P_=ce("$ZodRecord",(e,t)=>{Vt.init(e,t);const a=qa.memoizer;a==null||a.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!yo(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const s=[],l=t.keyType._zod.values;if(l&&!t.partial){r.value=a?a.alloc(e,r,{},o):{};const c=new Set;for(const d of l)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){if(c.add(typeof d=="number"?d.toString():d),d==="__proto__")continue;const p=t.keyType._zod.run({value:d,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(f=>Er(f,o,Ka())),input:d,path:[d],inst:e});continue}const m=p.value;if(m==="__proto__")continue;const h=t.valueType._zod.run({value:i[d],issues:[]},o);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...no(d,f.issues)),r.value[m]=f.value})):(h.issues.length&&r.issues.push(...no(d,h.issues)),r.value[m]=h.value)}let u;for(const d in i)if(!c.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;r.value[d]=i[d]}else u=u??[],u.push(d);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=a?a.alloc(e,r,{},o):{};let c;for(const u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Rd.test(u)&&d.issues.length){const f=t.keyType._zod.run({value:Number(u),issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(d=f)}if(d.issues.length){t.mode==="loose"?r.value[u]=i[u]:l?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>Er(f,o,Ka())),input:u,path:[u],inst:e});continue}const m=d.value;if(m==="__proto__")continue;const h=t.valueType._zod.run({value:i[u],issues:[]},o);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...no(u,f.issues)),r.value[m]=f.value})):(h.issues.length&&r.issues.push(...no(u,h.issues)),r.value[m]=h.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),O_=ce("$ZodEnum",(e,t)=>{Vt.init(e,t);const a=cu(t.entries),r=new Set(a);e._zod.values=r,Ct(e,"pattern",o=>{const i=cu(o.def.entries).filter(s=>s2.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Eo(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{const s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:a,input:s,inst:e}),o}}),M_=ce("$ZodLiteral",(e,t)=>{Vt.init(e,t);const a=new Set(t.values);e._zod.values=a,Ct(e,"pattern",r=>{const o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Eo(i):i?Eo(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{const i=r.value;return a.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),z_=ce("$ZodTransform",(e,t)=>{var a;Vt.init(e,t),e._zod.optin="optional",(a=qa.memoizer)==null||a.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ob(e.constructor.name);const i=t.transform(r.value,r);if(o.async)return(i instanceof Promise?i:Promise.resolve(i)).then(l=>(r.value=l,r));if(i instanceof Promise)throw new zr;return r.value=i,r}});function Bh(e,t){return e.value=t.issues.length?void 0:t.value,e}const wb=ce("$ZodOptional",(e,t)=>{Vt.init(e,t),Ct(e,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Ct(e,"values",a=>{const r=a.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Ct(e,"pattern",a=>{const r=a.def.innerType._zod.pattern;return r?new RegExp(`^(${yd(r.source)})?$`):void 0}),e._zod.parse=(a,r)=>{if(a.value===void 0){if(t.innerType._zod.optin!=="defaulted")return a;const o=t.innerType._zod.run({value:a.value,issues:[]},r);return o instanceof Promise?o.then(i=>Bh(a,i)):Bh(a,o)}return t.innerType._zod.run(a,r)}}),L_=ce("$ZodExactOptional",(e,t)=>{wb.init(e,t),Ct(e,"values",a=>a.def.innerType._zod.values),Ct(e,"pattern",a=>a.def.innerType._zod.pattern),e._zod.parse=(a,r)=>t.innerType._zod.run(a,r)}),D_=ce("$ZodNullable",(e,t)=>{Vt.init(e,t),Ct(e,"optin",a=>a.def.innerType._zod.optin),Ct(e,"optout",a=>a.def.innerType._zod.optout),Ct(e,"pattern",a=>{const r=a.def.innerType._zod.pattern;return r?new RegExp(`^(${yd(r.source)}|null)$`):void 0}),Ct(e,"values",a=>a.def.innerType._zod.values?new Set([...a.def.innerType._zod.values,null]):void 0),e._zod.parse=(a,r)=>a.value===null?a:t.innerType._zod.run(a,r)}),F_=ce("$ZodDefault",(e,t)=>{Vt.init(e,t),e._zod.optin="defaulted",Ct(e,"values",a=>a.def.innerType._zod.values),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);if(a.value===void 0)return a.value=t.defaultValue,a;const o=t.innerType._zod.run(a,r);return o instanceof Promise?o.then(i=>Hh(i,t)):Hh(o,t)}});function Hh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const q_=ce("$ZodPrefault",(e,t)=>{Vt.init(e,t),e._zod.optin="defaulted",Ct(e,"values",a=>a.def.innerType._zod.values),e._zod.parse=(a,r)=>(r.direction==="backward"||a.value===void 0&&(a.value=t.defaultValue),t.innerType._zod.run(a,r))}),U_=ce("$ZodNonOptional",(e,t)=>{Vt.init(e,t),Ct(e,"values",a=>{const r=a.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(a,r)=>{const o=t.innerType._zod.run(a,r);return o instanceof Promise?o.then(i=>Vh(i,e)):Vh(o,e)}});function Vh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Wh(e,t,a,r){return t.issues.length?(e.value=a.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Er(o,r,Ka()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const j_=ce("$ZodCatch",(e,t)=>{Vt.init(e,t),Ct(e,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Ct(e,"optout",a=>a.def.innerType._zod.optout),Ct(e,"values",a=>a.def.innerType._zod.values),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);const o=t.innerType._zod.run({value:a.value,issues:[]},r);return o instanceof Promise?o.then(i=>Wh(a,i,t,r)):Wh(a,o,t,r)}}),kb=ce("$ZodPipe",(e,t)=>{Vt.init(e,t),Ct(e,"values",a=>a.def.in._zod.values),Ct(e,"optin",a=>a.def.in._zod.optin),Ct(e,"optout",a=>a.def.out._zod.optout),Ct(e,"propValues",a=>a.def.in._zod.propValues),e._zod.parse=(a,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(a,r);return i instanceof Promise?i.then(s=>ns(s,t.in,r)):ns(i,t.in,r)}const o=t.in._zod.run(a,r);return o instanceof Promise?o.then(i=>ns(i,t.out,r)):ns(o,t.out,r)}});function ns(e,t,a){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},a)}const $_=ce("$ZodPreprocess",(e,t)=>{kb.init(e,t)}),B_=ce("$ZodReadonly",(e,t)=>{Vt.init(e,t),Ct(e,"propValues",a=>a.def.innerType._zod.propValues),Ct(e,"values",a=>a.def.innerType._zod.values),Ct(e,"optin",a=>{var r,o;return(o=(r=a.def.innerType)==null?void 0:r._zod)==null?void 0:o.optin}),Ct(e,"optout",a=>{var r,o;return(o=(r=a.def.innerType)==null?void 0:r._zod)==null?void 0:o.optout}),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);const o=t.innerType._zod.run(a,r);return o instanceof Promise?o.then(Zh):Zh(o)}});function Zh(e){return e.memo||(e.value=Object.freeze(e.value)),e}const H_=ce("$ZodLazy",(e,t)=>{Vt.init(e,t),n2(e._zod,"innerType",()=>{const a=t;return a._cachedInner||(a._cachedInner=t.getter()),a._cachedInner}),Ct(e,"pattern",a=>{var r,o;return(o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.pattern}),Ct(e,"propValues",a=>{var r,o;return(o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.propValues}),Ct(e,"optin",a=>{var r,o;return((o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.optin)??void 0}),Ct(e,"optout",a=>{var r,o;return((o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.optout)??void 0}),e._zod.parse=(a,r)=>e._zod.innerType._zod.run(a,r)}),V_=ce("$ZodCustom",(e,t)=>{ca.init(e,t),Vt.init(e,t),e._zod.parse=(a,r)=>a,e._zod.check=a=>{const r=a.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Jh(i,a,r,e));Jh(o,a,r,e)}});function Jh(e,t,a,r){if(!e){const o={code:"custom",input:a,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Ci(o))}}class W_ extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const mu="~memo",Kh=[];function xb(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function bc(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const Sb=new WeakMap,li=0,Cs=1,gi=2;function Ns(e,t,a){const r=Sb.get(e);if(r!==void 0)return r?gi:li;if(t.has(e))return gi;t.add(e);let o=li;const i=d=>{if(o!==gi&&(d!=null&&d._zod)){const p=Ns(d,t);p>o&&(o=p)}},s=(d,p)=>{var h;let m=li;for(const f of Reflect.ownKeys(d)){const g=Object.getOwnPropertyDescriptor(d,f);if(p&&!g.enumerable)continue;const y=g.get?Cs:(h=g.value)!=null&&h._zod?Ns(g.value,t):li;y>m&&(m=y)}return m},l=d=>{d>o&&(o=d)},c=e._zod.def;switch(c.type){case"object":{const d=Ed(c);l(d?s(d,!0):Cs),i(c.catchall);break}case"properties":l(s(c.shape,!1));break;case"array":i(c.element);break;case"tuple":for(const d of c.items)i(d);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(const d of c.options)i(d);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{const d=c._cachedInner??void 0;l(d?Ns(d,t):Cs);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const d in c){const p=Object.getOwnPropertyDescriptor(c,d);if(!p||p.get)continue;const m=p.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(const h of m)i(h)}}}return t.delete(e),Z_(e,o)}function Z_(e,t){return t!==Cs&&Sb.set(e,t===gi),t}function J_(e,t){let a=e.buckets.get(t);return a||(a=new WeakMap,e.buckets.set(t,a)),a}let as;const rs=[],K_={alloc(e,t,a){const r=as;if(!r)return a;as=void 0;const o={value:a,issues:null};return r.set(t.value,o),rs.push(o),a},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const a=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&G_(i,o.value))throw new W_;return a(o,i)};e._zod.parse=r,e._zod.run===a&&(e._zod.run=r)})},attach(e){var t;let a,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const s=e._zod.parse,l=(c,u)=>{if(a===void 0){const E=Ns(e,new Set);if(E===li)return e._zod.parse=s,e._zod.run===l&&(e._zod.run=s),s(c,u);E===gi||r?a=!0:r=!0}const d=c.value;if(!xb(d))return s(c,u);let p=u[mu];p||(p={buckets:new WeakMap,backEdges:void 0},u[mu]=p);let m;o===u?m=i:(m=J_(p,e),o=u,i=m);const h=m.get(d);if(h)return c.value=h.value,h.issues?h.issues.length&&c.issues.push(...bc(h.issues)):(c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value)),c;as=m;const f=rs.length,g=s(c,u);as=void 0;const y=rs.length>f?rs.pop():void 0;return g instanceof Promise?g.then(E=>(y&&(y.issues=E.issues.length?bc(E.issues):Kh),E)):(y&&(y.issues=g.issues.length?bc(g.issues):Kh),g)};e._zod.parse=l,e._zod.run===s&&(e._zod.run=l)})}};function Y_(){return K_}function G_(e,t){var r;const a=(r=e[mu])==null?void 0:r.backEdges;return a!==void 0&&xb(t)&&a.has(t)}const Q_=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}const a={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{const s=o(i.expected),l=b2(i.input),c=o(l,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${eb(i.values[0])}`:`Invalid option: expected one of ${_h(i.values,"|")}`;case"too_big":{const s=i.exact?"exactly ":i.inclusive?"<=":"<",l=t(i.origin);return l?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${l.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{const s=i.exact?"exactly ":i.inclusive?">=":">",l=t(i.origin);return l?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${l.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{const s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${a[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${_h(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(l=>`'${l}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function X_(){return{localeError:Q_()}}var Yh;class eP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...a){const r=a[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const a=this._map.get(t);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(t),this}get(t){const a=t._zod.parent;if(a){const r={...this.get(a)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function tP(){return new eP}(Yh=globalThis).__zod_globalRegistry??(Yh.__zod_globalRegistry=tP());const ci=globalThis.__zod_globalRegistry;function nP(e,t){return new e({type:"string",...Ve(t)})}function Cb(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ve(t)})}function aP(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ve(t)})}function rP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ve(t)})}function oP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ve(t)})}function iP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ve(t)})}function sP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ve(t)})}function Nb(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ve(t)})}function lP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ve(t)})}function cP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ve(t)})}function uP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ve(t)})}function dP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ve(t)})}function pP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ve(t)})}function mP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ve(t)})}function hP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ve(t)})}function fP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ve(t)})}function gP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ve(t)})}function vP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ve(t)})}function bP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ve(t)})}function yP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ve(t)})}function EP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ve(t)})}function wP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ve(t)})}function kP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ve(t)})}function Rb(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ve(t)})}function Tb(e,t){return new e({type:"string",format:"date",check:"string_format",...Ve(t)})}function xP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ve(t)})}function SP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ve(t)})}function CP(e,t){return new e({type:"number",checks:[],...Ve(t)})}function NP(e,t){return new e({type:"number",coerce:!0,checks:[],...Ve(t)})}function RP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ve(t)})}function TP(e,t){return new e({type:"boolean",...Ve(t)})}function IP(e,t){return new e({type:"undefined",...Ve(t)})}function AP(e,t){return new e({type:"null",...Ve(t)})}function _P(e){return new e({type:"any"})}function PP(e){return new e({type:"unknown"})}function OP(e,t){return new e({type:"never",...Ve(t)})}function Gh(e,t){return new lb({check:"less_than",...Ve(t),value:e,inclusive:!1})}function yc(e,t){return new lb({check:"less_than",...Ve(t),value:e,inclusive:!0})}function Qh(e,t){return new cb({check:"greater_than",...Ve(t),value:e,inclusive:!1})}function Ec(e,t){return new cb({check:"greater_than",...Ve(t),value:e,inclusive:!0})}function Xh(e,t){return new CA({check:"multiple_of",...Ve(t),value:e})}function Ib(e,t){return new RA({check:"max_length",...Ve(t),maximum:e})}function Vs(e,t){return new TA({check:"min_length",...Ve(t),minimum:e})}function Ab(e,t){return new IA({check:"length_equals",...Ve(t),length:e})}function MP(e,t){return new AA({check:"string_format",format:"regex",...Ve(t),pattern:e})}function zP(e){return new _A({check:"string_format",format:"lowercase",...Ve(e)})}function LP(e){return new PA({check:"string_format",format:"uppercase",...Ve(e)})}function DP(e,t){return new OA({check:"string_format",format:"includes",...Ve(t),includes:e})}function FP(e,t){return new MA({check:"string_format",format:"starts_with",...Ve(t),prefix:e})}function qP(e,t){return new zA({check:"string_format",format:"ends_with",...Ve(t),suffix:e})}function _o(e){return new LA({check:"overwrite",tx:e})}function UP(e){return _o(t=>t.normalize(e))}function jP(){return _o(e=>e.trim())}function $P(){return _o(e=>e.toLowerCase())}function BP(){return _o(e=>e.toUpperCase())}function HP(){return _o(e=>o2(e))}function VP(e,t,a){return new e({type:"array",element:t,...Ve(a)})}function WP(e,t,a){return new e({type:"custom",check:"custom",fn:t,...Ve(a)})}function ZP(e,t){const a=JP(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Ci(o,r.value,a._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=a),i.continue??(i.continue=!a._zod.def.abort),r.issues.push(Ci(i))}},e(r.value,r)),t);return a}function JP(e,t){const a=new ca({check:"custom",...Ve(t)});return a._zod.check=e,a}function vi(e,...t){for(const a of t)for(const r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&Ua(e,r,a[r]);return e}function Ws(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??ci,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",intersections:[],deferred:[],external:(e==null?void 0:e.external)??void 0}}function Tn(e,t,a,r,o){const i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(a,i),!0}function Ht(e,t,a={path:[],schemaPath:[]}){var d,p;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,a.schemaPath.includes(e)&&(i.cycle=a.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:a.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const l=(p=(d=e._zod).toJSONSchema)==null?void 0:p.call(d);if(l)s.schema=l;else{const m={...a,schemaPath:[...a.schemaPath,e],path:a.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,m);else{const f=s.schema,g=t.processors[o.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,f,m)}const h=e._zod.parent;h&&(s.ref||(s.ref=h),Ht(h,t,m),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&vi(s.schema,c),t.io==="input"&&Vn(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ef(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Zs(e,t){var s,l,c,u;const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const d of e.seen.entries()){const p=(s=e.metadataRegistry.get(d[0]))==null?void 0:s.id;if(p){const m=r.get(p);if(m&&m!==d[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,d[0])}}const o=d=>{var g;const p=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=(g=e.external.registry.get(d[0]))==null?void 0:g.id,E=e.external.uri??(S=>S);if(y)return{ref:E(y)};const b=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=b,{defId:b,ref:`${E("__shared")}#/${p}/${ef(b)}`}}const m="#",h=`${m}/${p}/`;if(d[1]===a&&!d[1].schema.id)return{ref:m};const f=d[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:h+ef(f)}},i=d=>{if(d[1].schema.$ref)return;const p=d[1],{ref:m,defId:h}=o(d);p.def={...p.schema},h&&(p.defId=h);const f=p.schema;for(const g in f)delete f[g];f.$ref=m};if(e.cycles==="throw")for(const d of e.seen.entries()){const p=d[1];if(p.cycle)throw new Error(`Cycle detected: #/${(l=p.cycle)==null?void 0:l.join("/")}/ + `)}return E.write("payload.value = newResult;"),E.write("return payload;"),E.compile()};let s;const l=Si,c=!qa.jitless,d=c&&i2.value,p=t.catchall;let m;e._zod.parse=(h,f)=>{m??(m=r.value);const g=h.value;return l(g)?c&&d&&(f==null?void 0:f.async)===!1&&f.jitless!==!0?(s||(s=i(t.shape)),h=s(h,f),p?yb([],g,h,f,m,e,(f==null?void 0:f.abortEarly)===!0):h):a(h,f):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h)}});function jh(e,t,a,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!er(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(i=>i.issues.map(s=>Er(s,r,Ka())))}),t)}const Eb=ce("$ZodUnion",(e,t)=>{Vt.init(e,t),Ct(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),Ct(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Ct(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),Ct(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){const o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>yd(i.source)).join("|")})$`)}});const a=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(a)return a(r,o);let i=!1;const s=[];for(const l of t.options){const c=l._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(l=>jh(l,r,e,o)):jh(s,r,e,o)}});function I_(e){var a;const t=new Map;for(const r of e.options){const o=(a=r._zod.propValues)==null?void 0:a[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(const i of o)if(t.has(i)){if(i!==void 0)throw new Error(`Duplicate discriminator value "${String(i)}"`);t.set(i,null)}else t.set(i,r)}return t}const A_=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Eb.init(e,t);const a=e._zod.parse;Ct(e,"propValues",o=>{var l,c;const i={};let s=0;for(const u of o.def.options){const d=u._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(u)}"`);(l=d[o.def.discriminator])!=null&&l.has(void 0)&&s++;for(const[p,m]of Object.entries(d)){Object.prototype.hasOwnProperty.call(i,p)||Ua(i,p,new Set);for(const h of m)i[p].add(h)}}return!o.def.unionFallback&&s>1&&((c=i[o.def.discriminator])==null||c.delete(void 0)),i}),t.options.forEach((o,i)=>{const s=Ed(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});const r=hl(()=>I_(t));e._zod.parse=(o,i)=>{const s=o.value;if(!Si(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const l=s==null?void 0:s[t.discriminator],c=r.value.get(l);return c&&(l!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?a(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),__=ce("$ZodIntersection",(e,t)=>{Vt.init(e,t),e._zod.parse=(a,r)=>{const o=a.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>$h(a,c,u)):$h(a,i,s)}});function pu(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yo(e)&&yo(t)){const a=Object.keys(t),r=Object.keys(e).filter(i=>a.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const i of r){if(i==="__proto__")continue;const s=pu(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let r=0;r{var m,h;let p;if(u.code==="unrecognized_keys"&&!((m=u.path)!=null&&m.length))o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&((h=u.path)==null?void 0:h.length)===1){const f=String(u.path[0]);i.has(f)||i.set(f,u),p=[f]}else return!1;for(const f of p)r.has(f)||r.set(f,{}),r.get(f)[d]=!0;return!0};for(const u of t.issues)s(u,"l")||e.issues.push(u);for(const u of a.issues)s(u,"r")||e.issues.push(u);const l=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(l.length){const u=o?l.filter(d=>o.keys.includes(d)):[];u.length&&e.issues.push({...o,keys:u});for(const d of l)!u.includes(d)&&i.has(d)&&e.issues.push(i.get(d))}const c=pu(t.value,a.value);if(!c.valid){if(er(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const P_=ce("$ZodRecord",(e,t)=>{Vt.init(e,t);const a=qa.memoizer;a==null||a.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!yo(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const s=[],l=t.keyType._zod.values;if(l&&!t.partial){r.value=a?a.alloc(e,r,{},o):{};const c=new Set;for(const d of l)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){if(c.add(typeof d=="number"?d.toString():d),d==="__proto__")continue;const p=t.keyType._zod.run({value:d,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(f=>Er(f,o,Ka())),input:d,path:[d],inst:e});continue}const m=p.value;if(m==="__proto__")continue;const h=t.valueType._zod.run({value:i[d],issues:[]},o);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...no(d,f.issues)),r.value[m]=f.value})):(h.issues.length&&r.issues.push(...no(d,h.issues)),r.value[m]=h.value)}let u;for(const d in i)if(!c.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;r.value[d]=i[d]}else u=u??[],u.push(d);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=a?a.alloc(e,r,{},o):{};let c;for(const u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Rd.test(u)&&d.issues.length){const f=t.keyType._zod.run({value:Number(u),issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(d=f)}if(d.issues.length){t.mode==="loose"?r.value[u]=i[u]:l?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>Er(f,o,Ka())),input:u,path:[u],inst:e});continue}const m=d.value;if(m==="__proto__")continue;const h=t.valueType._zod.run({value:i[u],issues:[]},o);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...no(u,f.issues)),r.value[m]=f.value})):(h.issues.length&&r.issues.push(...no(u,h.issues)),r.value[m]=h.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),O_=ce("$ZodEnum",(e,t)=>{Vt.init(e,t);const a=cu(t.entries),r=new Set(a);e._zod.values=r,Ct(e,"pattern",o=>{const i=cu(o.def.entries).filter(s=>s2.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Eo(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{const s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:a,input:s,inst:e}),o}}),M_=ce("$ZodLiteral",(e,t)=>{Vt.init(e,t);const a=new Set(t.values);e._zod.values=a,Ct(e,"pattern",r=>{const o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Eo(i):i?Eo(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{const i=r.value;return a.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),z_=ce("$ZodTransform",(e,t)=>{var a;Vt.init(e,t),e._zod.optin="optional",(a=qa.memoizer)==null||a.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ob(e.constructor.name);const i=t.transform(r.value,r);if(o.async)return(i instanceof Promise?i:Promise.resolve(i)).then(l=>(r.value=l,r));if(i instanceof Promise)throw new zr;return r.value=i,r}});function Bh(e,t){return e.value=t.issues.length?void 0:t.value,e}const wb=ce("$ZodOptional",(e,t)=>{Vt.init(e,t),Ct(e,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Ct(e,"values",a=>{const r=a.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Ct(e,"pattern",a=>{const r=a.def.innerType._zod.pattern;return r?new RegExp(`^(${yd(r.source)})?$`):void 0}),e._zod.parse=(a,r)=>{if(a.value===void 0){if(t.innerType._zod.optin!=="defaulted")return a;const o=t.innerType._zod.run({value:a.value,issues:[]},r);return o instanceof Promise?o.then(i=>Bh(a,i)):Bh(a,o)}return t.innerType._zod.run(a,r)}}),L_=ce("$ZodExactOptional",(e,t)=>{wb.init(e,t),Ct(e,"values",a=>a.def.innerType._zod.values),Ct(e,"pattern",a=>a.def.innerType._zod.pattern),e._zod.parse=(a,r)=>t.innerType._zod.run(a,r)}),D_=ce("$ZodNullable",(e,t)=>{Vt.init(e,t),Ct(e,"optin",a=>a.def.innerType._zod.optin),Ct(e,"optout",a=>a.def.innerType._zod.optout),Ct(e,"pattern",a=>{const r=a.def.innerType._zod.pattern;return r?new RegExp(`^(${yd(r.source)}|null)$`):void 0}),Ct(e,"values",a=>a.def.innerType._zod.values?new Set([...a.def.innerType._zod.values,null]):void 0),e._zod.parse=(a,r)=>a.value===null?a:t.innerType._zod.run(a,r)}),F_=ce("$ZodDefault",(e,t)=>{Vt.init(e,t),e._zod.optin="defaulted",Ct(e,"values",a=>a.def.innerType._zod.values),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);if(a.value===void 0)return a.value=t.defaultValue,a;const o=t.innerType._zod.run(a,r);return o instanceof Promise?o.then(i=>Hh(i,t)):Hh(o,t)}});function Hh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const q_=ce("$ZodPrefault",(e,t)=>{Vt.init(e,t),e._zod.optin="defaulted",Ct(e,"values",a=>a.def.innerType._zod.values),e._zod.parse=(a,r)=>(r.direction==="backward"||a.value===void 0&&(a.value=t.defaultValue),t.innerType._zod.run(a,r))}),U_=ce("$ZodNonOptional",(e,t)=>{Vt.init(e,t),Ct(e,"values",a=>{const r=a.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(a,r)=>{const o=t.innerType._zod.run(a,r);return o instanceof Promise?o.then(i=>Vh(i,e)):Vh(o,e)}});function Vh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Wh(e,t,a,r){return t.issues.length?(e.value=a.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Er(o,r,Ka()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const j_=ce("$ZodCatch",(e,t)=>{Vt.init(e,t),Ct(e,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Ct(e,"optout",a=>a.def.innerType._zod.optout),Ct(e,"values",a=>a.def.innerType._zod.values),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);const o=t.innerType._zod.run({value:a.value,issues:[]},r);return o instanceof Promise?o.then(i=>Wh(a,i,t,r)):Wh(a,o,t,r)}}),kb=ce("$ZodPipe",(e,t)=>{Vt.init(e,t),Ct(e,"values",a=>a.def.in._zod.values),Ct(e,"optin",a=>a.def.in._zod.optin),Ct(e,"optout",a=>a.def.out._zod.optout),Ct(e,"propValues",a=>a.def.in._zod.propValues),e._zod.parse=(a,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(a,r);return i instanceof Promise?i.then(s=>ns(s,t.in,r)):ns(i,t.in,r)}const o=t.in._zod.run(a,r);return o instanceof Promise?o.then(i=>ns(i,t.out,r)):ns(o,t.out,r)}});function ns(e,t,a){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},a)}const $_=ce("$ZodPreprocess",(e,t)=>{kb.init(e,t)}),B_=ce("$ZodReadonly",(e,t)=>{Vt.init(e,t),Ct(e,"propValues",a=>a.def.innerType._zod.propValues),Ct(e,"values",a=>a.def.innerType._zod.values),Ct(e,"optin",a=>{var r,o;return(o=(r=a.def.innerType)==null?void 0:r._zod)==null?void 0:o.optin}),Ct(e,"optout",a=>{var r,o;return(o=(r=a.def.innerType)==null?void 0:r._zod)==null?void 0:o.optout}),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);const o=t.innerType._zod.run(a,r);return o instanceof Promise?o.then(Zh):Zh(o)}});function Zh(e){return e.memo||(e.value=Object.freeze(e.value)),e}const H_=ce("$ZodLazy",(e,t)=>{Vt.init(e,t),n2(e._zod,"innerType",()=>{const a=t;return a._cachedInner||(a._cachedInner=t.getter()),a._cachedInner}),Ct(e,"pattern",a=>{var r,o;return(o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.pattern}),Ct(e,"propValues",a=>{var r,o;return(o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.propValues}),Ct(e,"optin",a=>{var r,o;return((o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.optin)??void 0}),Ct(e,"optout",a=>{var r,o;return((o=(r=a.innerType)==null?void 0:r._zod)==null?void 0:o.optout)??void 0}),e._zod.parse=(a,r)=>e._zod.innerType._zod.run(a,r)}),V_=ce("$ZodCustom",(e,t)=>{ca.init(e,t),Vt.init(e,t),e._zod.parse=(a,r)=>a,e._zod.check=a=>{const r=a.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Jh(i,a,r,e));Jh(o,a,r,e)}});function Jh(e,t,a,r){if(!e){const o={code:"custom",input:a,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Ci(o))}}class W_ extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const mu="~memo",Kh=[];function xb(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function bc(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const Sb=new WeakMap,li=0,Cs=1,gi=2;function Ns(e,t,a){const r=Sb.get(e);if(r!==void 0)return r?gi:li;if(t.has(e))return gi;t.add(e);let o=li;const i=d=>{if(o!==gi&&(d!=null&&d._zod)){const p=Ns(d,t);p>o&&(o=p)}},s=(d,p)=>{var h;let m=li;for(const f of Reflect.ownKeys(d)){const g=Object.getOwnPropertyDescriptor(d,f);if(p&&!g.enumerable)continue;const E=g.get?Cs:(h=g.value)!=null&&h._zod?Ns(g.value,t):li;E>m&&(m=E)}return m},l=d=>{d>o&&(o=d)},c=e._zod.def;switch(c.type){case"object":{const d=Ed(c);l(d?s(d,!0):Cs),i(c.catchall);break}case"properties":l(s(c.shape,!1));break;case"array":i(c.element);break;case"tuple":for(const d of c.items)i(d);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(const d of c.options)i(d);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{const d=c._cachedInner??void 0;l(d?Ns(d,t):Cs);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const d in c){const p=Object.getOwnPropertyDescriptor(c,d);if(!p||p.get)continue;const m=p.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(const h of m)i(h)}}}return t.delete(e),Z_(e,o)}function Z_(e,t){return t!==Cs&&Sb.set(e,t===gi),t}function J_(e,t){let a=e.buckets.get(t);return a||(a=new WeakMap,e.buckets.set(t,a)),a}let as;const rs=[],K_={alloc(e,t,a){const r=as;if(!r)return a;as=void 0;const o={value:a,issues:null};return r.set(t.value,o),rs.push(o),a},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const a=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&G_(i,o.value))throw new W_;return a(o,i)};e._zod.parse=r,e._zod.run===a&&(e._zod.run=r)})},attach(e){var t;let a,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const s=e._zod.parse,l=(c,u)=>{if(a===void 0){const y=Ns(e,new Set);if(y===li)return e._zod.parse=s,e._zod.run===l&&(e._zod.run=s),s(c,u);y===gi||r?a=!0:r=!0}const d=c.value;if(!xb(d))return s(c,u);let p=u[mu];p||(p={buckets:new WeakMap,backEdges:void 0},u[mu]=p);let m;o===u?m=i:(m=J_(p,e),o=u,i=m);const h=m.get(d);if(h)return c.value=h.value,h.issues?h.issues.length&&c.issues.push(...bc(h.issues)):(c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value)),c;as=m;const f=rs.length,g=s(c,u);as=void 0;const E=rs.length>f?rs.pop():void 0;return g instanceof Promise?g.then(y=>(E&&(E.issues=y.issues.length?bc(y.issues):Kh),y)):(E&&(E.issues=g.issues.length?bc(g.issues):Kh),g)};e._zod.parse=l,e._zod.run===s&&(e._zod.run=l)})}};function Y_(){return K_}function G_(e,t){var r;const a=(r=e[mu])==null?void 0:r.backEdges;return a!==void 0&&xb(t)&&a.has(t)}const Q_=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}const a={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{const s=o(i.expected),l=b2(i.input),c=o(l,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${eb(i.values[0])}`:`Invalid option: expected one of ${_h(i.values,"|")}`;case"too_big":{const s=i.exact?"exactly ":i.inclusive?"<=":"<",l=t(i.origin);return l?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${l.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{const s=i.exact?"exactly ":i.inclusive?">=":">",l=t(i.origin);return l?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${l.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{const s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${a[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${_h(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(l=>`'${l}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function X_(){return{localeError:Q_()}}var Yh;class eP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...a){const r=a[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const a=this._map.get(t);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(t),this}get(t){const a=t._zod.parent;if(a){const r={...this.get(a)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function tP(){return new eP}(Yh=globalThis).__zod_globalRegistry??(Yh.__zod_globalRegistry=tP());const ci=globalThis.__zod_globalRegistry;function nP(e,t){return new e({type:"string",...Ve(t)})}function Cb(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ve(t)})}function aP(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ve(t)})}function rP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ve(t)})}function oP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ve(t)})}function iP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ve(t)})}function sP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ve(t)})}function Nb(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ve(t)})}function lP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ve(t)})}function cP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ve(t)})}function uP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ve(t)})}function dP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ve(t)})}function pP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ve(t)})}function mP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ve(t)})}function hP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ve(t)})}function fP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ve(t)})}function gP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ve(t)})}function vP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ve(t)})}function bP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ve(t)})}function yP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ve(t)})}function EP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ve(t)})}function wP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ve(t)})}function kP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ve(t)})}function Rb(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ve(t)})}function Tb(e,t){return new e({type:"string",format:"date",check:"string_format",...Ve(t)})}function xP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ve(t)})}function SP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ve(t)})}function CP(e,t){return new e({type:"number",checks:[],...Ve(t)})}function NP(e,t){return new e({type:"number",coerce:!0,checks:[],...Ve(t)})}function RP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ve(t)})}function TP(e,t){return new e({type:"boolean",...Ve(t)})}function IP(e,t){return new e({type:"undefined",...Ve(t)})}function AP(e,t){return new e({type:"null",...Ve(t)})}function _P(e){return new e({type:"any"})}function PP(e){return new e({type:"unknown"})}function OP(e,t){return new e({type:"never",...Ve(t)})}function Gh(e,t){return new lb({check:"less_than",...Ve(t),value:e,inclusive:!1})}function yc(e,t){return new lb({check:"less_than",...Ve(t),value:e,inclusive:!0})}function Qh(e,t){return new cb({check:"greater_than",...Ve(t),value:e,inclusive:!1})}function Ec(e,t){return new cb({check:"greater_than",...Ve(t),value:e,inclusive:!0})}function Xh(e,t){return new CA({check:"multiple_of",...Ve(t),value:e})}function Ib(e,t){return new RA({check:"max_length",...Ve(t),maximum:e})}function Vs(e,t){return new TA({check:"min_length",...Ve(t),minimum:e})}function Ab(e,t){return new IA({check:"length_equals",...Ve(t),length:e})}function MP(e,t){return new AA({check:"string_format",format:"regex",...Ve(t),pattern:e})}function zP(e){return new _A({check:"string_format",format:"lowercase",...Ve(e)})}function LP(e){return new PA({check:"string_format",format:"uppercase",...Ve(e)})}function DP(e,t){return new OA({check:"string_format",format:"includes",...Ve(t),includes:e})}function FP(e,t){return new MA({check:"string_format",format:"starts_with",...Ve(t),prefix:e})}function qP(e,t){return new zA({check:"string_format",format:"ends_with",...Ve(t),suffix:e})}function _o(e){return new LA({check:"overwrite",tx:e})}function UP(e){return _o(t=>t.normalize(e))}function jP(){return _o(e=>e.trim())}function $P(){return _o(e=>e.toLowerCase())}function BP(){return _o(e=>e.toUpperCase())}function HP(){return _o(e=>o2(e))}function VP(e,t,a){return new e({type:"array",element:t,...Ve(a)})}function WP(e,t,a){return new e({type:"custom",check:"custom",fn:t,...Ve(a)})}function ZP(e,t){const a=JP(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Ci(o,r.value,a._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=a),i.continue??(i.continue=!a._zod.def.abort),r.issues.push(Ci(i))}},e(r.value,r)),t);return a}function JP(e,t){const a=new ca({check:"custom",...Ve(t)});return a._zod.check=e,a}function vi(e,...t){for(const a of t)for(const r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&Ua(e,r,a[r]);return e}function Ws(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??ci,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",intersections:[],deferred:[],external:(e==null?void 0:e.external)??void 0}}function Tn(e,t,a,r,o){const i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(a,i),!0}function Ht(e,t,a={path:[],schemaPath:[]}){var d,p;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,a.schemaPath.includes(e)&&(i.cycle=a.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:a.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const l=(p=(d=e._zod).toJSONSchema)==null?void 0:p.call(d);if(l)s.schema=l;else{const m={...a,schemaPath:[...a.schemaPath,e],path:a.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,m);else{const f=s.schema,g=t.processors[o.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,f,m)}const h=e._zod.parent;h&&(s.ref||(s.ref=h),Ht(h,t,m),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&vi(s.schema,c),t.io==="input"&&Vn(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ef(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Zs(e,t){var s,l,c,u;const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const d of e.seen.entries()){const p=(s=e.metadataRegistry.get(d[0]))==null?void 0:s.id;if(p){const m=r.get(p);if(m&&m!==d[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,d[0])}}const o=d=>{var g;const p=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const E=(g=e.external.registry.get(d[0]))==null?void 0:g.id,y=e.external.uri??(S=>S);if(E)return{ref:y(E)};const b=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=b,{defId:b,ref:`${y("__shared")}#/${p}/${ef(b)}`}}const m="#",h=`${m}/${p}/`;if(d[1]===a&&!d[1].schema.id)return{ref:m};const f=d[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:h+ef(f)}},i=d=>{if(d[1].schema.$ref)return;const p=d[1],{ref:m,defId:h}=o(d);p.def={...p.schema},h&&(p.defId=h);const f=p.schema;for(const g in f)delete f[g];f.$ref=m};if(e.cycles==="throw")for(const d of e.seen.entries()){const p=d[1];if(p.cycle)throw new Error(`Cycle detected: #/${(l=p.cycle)==null?void 0:l.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const p=d[1];if(t===d[0]){i(d);continue}if(e.external){const h=(c=e.external.registry.get(d[0]))==null?void 0:c.id;if(t!==d[0]&&h){i(d);continue}}if((u=e.metadataRegistry.get(d[0]))==null?void 0:u.id){i(d);continue}if(p.cycle){i(d);continue}p.count>1&&e.reused==="ref"&&i(d)}e.external&&(e.sharedDefsExtractedFor=e.external)}function _b(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const a=[];for(const r of t){if(!r||typeof r!="object")return;_b(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const i=r.type;for(const s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;a.includes(s)||a.push(s)}}delete e.anyOf,e.type=a.length===1?a[0]:a}const Pb=new Set(["type","properties","required","additionalProperties"]),tf=["oneOf","anyOf"];function nf(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function hu(e){var i;const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const l in s)if(!Pb.has(l))return null;t.push(s)}const a={},r=new Set;for(const s of t){for(const l in s.properties){if(Object.prototype.hasOwnProperty.call(a,l))continue;const c=[];for(const d of t){const p=((i=d.properties)==null?void 0:i[l])??nf(d);p!=null&&(c.some(m=>JSON.stringify(m)===JSON.stringify(p))||c.push(p))}const u=c.length===1?c[0]:hu(c)??{allOf:c};Ua(a,l,u)}for(const l of s.required??[])r.add(l)}const o={type:"object",properties:a};if(r.size&&(o.required=[...r]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{const s=[];for(const l of t){const c=nf(l);c&&!s.some(u=>JSON.stringify(u)===JSON.stringify(c))&&s.push(c)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function KP(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of Pb)if(o in e)return;const a=t.filter(o=>tf.some(i=>Array.isArray(o[i])));let r=null;if(!a.length)r=hu(t);else{const o=a[0],i=tf.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;const s=t.filter(c=>c!==o),l=o[i].map(c=>hu([...s,c]));if(l.some(c=>!c))return;r={[i]:l}}r&&(delete e.allOf,vi(e,r))}function Js(e,t){var l,c,u,d;const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const m=e.seen.get(p);if(m.ref===null)return;const h=m.def??m.schema,f={...h},g=m.ref;if(m.ref=null,g){r(g);const E=e.seen.get(g),b=E.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(b)):vi(h,b),vi(h,f),p._zod.parent===g)for(const w in h)w==="$ref"||w==="allOf"||w in f||delete h[w];if(b.$ref&&E.def)for(const w in h)w==="$ref"||w==="allOf"||w in E.def&&JSON.stringify(h[w])===JSON.stringify(E.def[w])&&delete h[w]}const y=p._zod.parent;if(y&&y!==g){r(y);const E=e.seen.get(y);if(E!=null&&E.schema.$ref&&(h.$ref=E.schema.$ref,E.def))for(const b in h)b==="$ref"||b==="allOf"||b in E.def&&JSON.stringify(h[b])===JSON.stringify(E.def[b])&&delete h[b]}e.override({zodSchema:p,jsonSchema:h,path:m.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const p of[...e.seen.entries()].reverse())r(p[0]);if(e.target!=="openapi-3.0")for(const p of e.seen.entries())_b(p[1].def??p[1].schema);for(const p of e.deferred)p();if(e.intersections.length){const p=new Map;for(const m of e.seen.values())for(const h of[m.schema,m.def]){const f=h==null?void 0:h.allOf;if(!Array.isArray(f))continue;const g=p.get(f);g?g.push(h):p.set(f,[h])}for(const m of e.intersections)for(const h of p.get(m)??[])KP(h)}}const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(l=e.external)!=null&&l.uri){const p=(c=e.external.registry.get(t))==null?void 0:c.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}vi(o,a.defId?a.schema:a.def??a.schema);const i=(u=e.metadataRegistry.get(t))==null?void 0:u.id;i!==void 0&&o.id===i&&delete o.id;const s=((d=e.external)==null?void 0:d.defs)??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const p of e.seen.entries()){const m=p[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,Ua(s,m.defId,m.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ks(t,"input",e.processors),output:Ks(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Vn(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Vn(r.element,a);if(r.type==="set")return Vn(r.valueType,a);if(r.type==="lazy")return Vn(r.getter(),a);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return Vn(r.innerType,a);if(r.type==="intersection")return Vn(r.left,a)||Vn(r.right,a);if(r.type==="record"||r.type==="map")return Vn(r.keyType,a)||Vn(r.valueType,a);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Vn(r.in,a)||Vn(r.out,a);if(r.type==="object"){for(const o in r.shape)if(Vn(r.shape[o],a))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Vn(o,a))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Vn(o,a))return!0;return!!(r.rest&&Vn(r.rest,a))}return!1}const YP=(e,t={})=>a=>{const r=Ws({...a,processors:t});return Ht(e,r),Zs(r,e),Js(r,e)},Ks=(e,t,a={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=Ws({...o??{},target:i,io:t,processors:a});return Ht(e,s),Zs(s,e),Js(s,e)},wo=(e,t,a)=>{(e[t]===void 0||a>e[t])&&(e[t]=a)},ko=(e,t,a)=>{(e[t]===void 0||a{wo(e,"minimum",t),ko(e,"maximum",t)},Ob=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Mb=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},zb=(e,t)=>{e.mime=e.mime?e.mime.filter(a=>t.includes(a)):[...t]},Lb=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},rf=(e,t)=>wo(e,"minimum",t.minimum),of=(e,t)=>ko(e,"maximum",t.maximum),sf=e=>(t,a)=>{Lb(t,a.format);const[r,o]=e[a.format];wo(t,"minimum",r),ko(t,"maximum",o)},wc={greater_than:(e,t)=>wo(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ko(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ob(e,t.value),number_format:sf(tb),bigint_format:sf(c2),min_length:rf,max_length:of,length_equals:(e,t)=>af(e,t.length),min_size:rf,max_size:of,size_equals:(e,t)=>af(e,t.size),string_format:(e,t)=>{Lb(e,t.format),t.pattern&&Mb(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>zb(e,t.mime)};function Ea(e){var i;const t={},a=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...a.checks??[]]:a.checks??[];for(const s of r)(i=wc[s._zod.def.check])==null||i.call(wc,t,s._zod.def);const o=e._zod.bag;o.minimum!==void 0&&wo(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&wo(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&ko(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&ko(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Ob(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&zb(t,o.mime);for(const s of o.patterns??[])Mb(t,s);return t}const GP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},QP=new Map([[gb,uA],[Ad,dA]]),Db=e=>QP.get(e)??e,Fb=(e,t,a,r)=>{const o=a;o.type="string";const{minimum:i,maximum:s,format:l,patterns:c,contentEncoding:u,laxFormat:d}=Ea(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),l&&(o.format=GP[l]??l,o.format===""&&delete o.format,(l==="time"||d)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const p=[...c].map(Db);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},qb=(e,t,a,r)=>{const o=a,{minimum:i,maximum:s,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u,isInt:d}=Ea(e);o.type=d?"integer":"number";const p=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p?h?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?h?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),l){const f=new Set;for(const E of l)Number.isFinite(E)&&E!==0?f.add(Math.abs(E)):Tn(e,t,o,r,`A multipleOf divisor of ${E} cannot be represented in JSON Schema`);const[g,...y]=f;g!==void 0&&(o.multipleOf=g),y.length&&(o.allOf=[...o.allOf??[],...y.map(E=>({multipleOf:E}))])}},Ub=(e,t,a,r)=>{a.type="boolean"},XP=(e,t,a,r)=>{Tn(e,t,a,r,"BigInt cannot be represented in JSON Schema")},eO=(e,t,a,r)=>{Tn(e,t,a,r,"Symbols cannot be represented in JSON Schema")},jb=(e,t,a,r)=>{t.target==="openapi-3.0"?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},$b=(e,t,a,r)=>{Tn(e,t,a,r,"Undefined cannot be represented in JSON Schema")},tO=(e,t,a,r)=>{Tn(e,t,a,r,"Void cannot be represented in JSON Schema")},Bb=(e,t,a,r)=>{a.not={}},Hb=(e,t,a,r)=>{},Vb=(e,t,a,r)=>{},nO=(e,t,a,r)=>{Tn(e,t,a,r,"Date cannot be represented in JSON Schema")},Wb=(e,t,a,r)=>{const o=e._zod.def,i=cu(o.entries);if(i.length===0){a.not={};return}i.every(s=>typeof s=="number")&&(a.type="number"),i.every(s=>typeof s=="string")&&(a.type="string"),a.enum=i},Zb=(e,t,a,r)=>{const o=e._zod.def;if(o.values.length===0){a.not={};return}const i=[];for(const s of o.values)if(s===void 0){if(Tn(e,t,a,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Tn(e,t,a,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];a.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?a.enum=[s]:a.const=s}else i.every(s=>typeof s=="number")&&(a.type="number"),i.every(s=>typeof s=="string")&&(a.type="string"),i.every(s=>typeof s=="boolean")&&(a.type="boolean"),i.every(s=>s===null)&&(a.type="null"),a.enum=i},aO=(e,t,a,r)=>{Tn(e,t,a,r,"NaN cannot be represented in JSON Schema")},rO=(e,t,a,r)=>{const o=a,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},oO=(e,t,a,r)=>{const o=a;o.type="string",o.format="binary",o.contentEncoding="binary";const{minimum:i,maximum:s,mime:l}=Ea(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),l&&(l.length===0?o.not={}:l.length===1?o.contentMediaType=l[0]:o.anyOf=l.map(c=>({contentMediaType:c})))},iO=(e,t,a,r)=>{a.type="boolean"},Jb=(e,t,a,r)=>{Tn(e,t,a,r,"Custom types cannot be represented in JSON Schema")},sO=(e,t,a,r)=>{Tn(e,t,a,r,"Function types cannot be represented in JSON Schema")},Kb=(e,t,a,r)=>{Tn(e,t,a,r,"Transforms cannot be represented in JSON Schema")},lO=(e,t,a,r)=>{Tn(e,t,a,r,"Map cannot be represented in JSON Schema")},cO=(e,t,a,r)=>{Tn(e,t,a,r,"Set cannot be represented in JSON Schema")},Yb=(e,t,a,r)=>{const o=a,i=e._zod.def,{minimum:s,maximum:l}=Ea(e);typeof s=="number"&&(o.minItems=s),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Ht(i.element,t,{...r,path:[...r.path,"items"]})};function xo(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?xo(t.out):t.type==="catch"?xo(t.innerType):e._zod.optin}const Gb=(e,t,a,r)=>{var d;const o=a,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Tn(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const p in s)Ua(o.properties,p,Ht(s[p],t,{...r,path:[...r.path,"properties",p]}));const c=new Set(Object.keys(s)),u=new Set([...c].filter(p=>{const m=i.shape[p];return t.io==="input"?xo(m)===void 0:m._zod.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((d=i.catchall)==null?void 0:d._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ht(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},uO=(e,t,a,r)=>{const o=a,i=e._zod.def;if(Object.getOwnPropertySymbols(i.shape).length&&Tn(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;if(t.io==="output"){for(const l in i.shape)if(Vn(i.shape[l])&&Tn(e,t,o,r,`z.properties() returns its input, so the output of a transforming schema at key "${l}" cannot be represented in JSON Schema`))return}o.type="object",o.properties={};for(const l in i.shape)Ua(o.properties,l,Ht(i.shape[l],t,{...r,path:[...r.path,"properties",l]}));const s=Object.keys(i.shape).filter(l=>xo(i.shape[l])===void 0);s.length>0&&(o.required=s)},Qb=(e,t,a,r)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((l,c)=>Ht(l,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?a.oneOf=s:a.anyOf=s},Xb=(e,t,a,r)=>{const o=e._zod.def,i=Ht(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=Ht(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(i)?i.allOf:[i],...l(s)?s.allOf:[s]];a.allOf=c,t.intersections.push(c)},dO=(e,t,a,r)=>{const o=a,i=e._zod.def;o.type="array";const s=t.target==="draft-2020-12"?"prefixItems":"items",l=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((g,y)=>Ht(g,t,{...r,path:[...r.path,s,y]})),u=i.rest?Ht(i.rest,t,{...r,path:[...r.path,l,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;let d=i.items.length;for(;d>0;){const g=i.items[d-1];if(!(t.io==="input"?xo(g)!==void 0:g._zod.optout==="optional"))break;d--}const p=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,m?o.items=!1:u&&(o.items=u),d>0&&(o.minItems=d),m&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),d>0&&(o.minItems=d),m&&(o.maxItems=p)):(o.items=c,m?o.additionalItems=!1:u&&(o.additionalItems=u),d>0&&(o.minItems=d),m&&(o.maxItems=p));const{minimum:h,maximum:f}=Ea(e);typeof h=="number"&&(o.minItems=h),typeof f=="number"&&(o.maxItems=f)};function fu(e,t,a){var f;if(t.$ref){if(a.has(t))return t;a.add(t);const g=(f=e.get(t))==null?void 0:f.def;if(!g)return t;const y=fu(e,g,a);return y===g?t:y}for(const g of["anyOf","oneOf"]){const y=t[g];if(!Array.isArray(y))continue;const E=y.map(b=>fu(e,b,a));E.some((b,S)=>b!==y[S])&&(t={...t,[g]:E})}const r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!(i!=null&&i.some(g=>typeof g=="number")))return t;const{minimum:s,maximum:l,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:d,format:p,id:m,...h}=t;return h.enum?h.enum=h.enum.map(g=>typeof g=="number"?String(g):g):typeof h.const=="number"&&(h.const=String(h.const)),o&&(h.type="string",i||(h.pattern=(r.includes("number")?Rd:yA).source)),h}const gu=new WeakMap;function pO(e){var r;const t=new Map;for(const o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);const a=new Map;for(const o of gu.get(e)??[]){const i=e.seen.get(o),s=(r=(i==null?void 0:i.def)??(i==null?void 0:i.schema))==null?void 0:r.propertyNames;if(!s||s===!0||a.has(s))continue;const l=fu(t,s,new Set);l!==s&&a.set(s,l)}if(a.size)for(const o of e.seen.values())for(const i of[o.schema,o.def]){const s=i&&a.get(i.propertyNames);s&&(i.propertyNames=s)}}const ey=(e,t,a,r)=>{const o=a,i=e._zod.def;o.type="object";const s=i.keyType,l=Ea(s).patterns;if(i.mode==="loose"&&l&&l.size>0){const d=Ht(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const p of l)Ua(o.patternProperties,Db(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=Ht(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let d=gu.get(t);d||(d=[],gu.set(t,d),t.deferred.push(()=>pO(t))),d.push(e)}o.additionalProperties=Ht(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const c=s._zod.values,u=t.io==="input"&&xo(i.valueType)!==void 0;if(c&&!i.partial&&!u){const d=[...c].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(o.required=d.map(String))}},ty=(e,t,a,r)=>{const o=e._zod.def,i=Ht(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,a.nullable=!0):a.anyOf=[i,{type:"null"}]},ny=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},_d=Symbol();function ay(e,t,a,r,o){let i=!1;const s=JSON.stringify(e,(l,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(Tn(t,a,r,o,"BigInt defaults cannot be represented in JSON Schema"),_d):JSON.parse(s)}const ry=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;const s=ay(o.defaultValue,e,t,a,r);s!==_d&&(a.default=s)},oy=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;const s=ay(o.defaultValue,e,t,a,r);s!==_d&&(a._prefault=s)},iy=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Tn(e,t,a,r,"Dynamic catch values are not supported in JSON Schema");return}a.default=s},sy=(e,t,a,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;Ht(s,t,r);const l=t.seen.get(e);l.ref=s},ly=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,a.readOnly=!0},mO=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Pd=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},cy=(e,t,a,r)=>{const o=e._zod.innerType;Ht(o,t,r);const i=t.seen.get(e);i.ref=o},lf={string:Fb,number:qb,boolean:Ub,bigint:XP,symbol:eO,null:jb,undefined:$b,void:tO,never:Bb,any:Hb,unknown:Vb,date:nO,enum:Wb,literal:Zb,nan:aO,template_literal:rO,file:oO,success:iO,custom:Jb,properties:uO,function:sO,transform:Kb,map:lO,set:cO,array:Yb,object:Gb,union:Qb,intersection:Xb,tuple:dO,record:ey,nullable:ty,nonoptional:ny,default:ry,prefault:oy,catch:iy,pipe:sy,readonly:ly,promise:mO,optional:Pd,lazy:cy};function uy(e,t){if("_idmap"in e){const r=e,o=Ws({...t,processors:lf}),i={};for(const c of r._idmap.entries()){const[u,d]=c;Ht(d,o)}const s={},l={registry:r,uri:t==null?void 0:t.uri,defs:i};o.external=l;for(const c of r._idmap.entries()){const[u,d]=c;Zs(o,d),Ua(s,u,Js(o,d))}if(Object.keys(i).length>0){const c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}const a=Ws({...t,processors:lf});return Ht(e,a),Zs(a,e),Js(a,e)}const cf=new WeakSet([Object.prototype,Error.prototype]);function os(e,t,a){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=a(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const hO=(e,t)=>{_2.init(e,t),e.name="ZodError";const a=Object.getPrototypeOf(e);cf.has(a)||(cf.add(a),os(a,"format",r=>o=>M2(r,o)),os(a,"flatten",r=>o=>O2(r,o)),os(a,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,uu,2)}),os(a,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,uu,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},za=ce("ZodError",hO,void 0,{Parent:Error}),fO=xd(za),gO=Sd(za),dy=Cd(za),vO=Nd(za),bO=U2(za),yO=j2(za),EO=$2(za),wO=B2(za),kO=H2(za),xO=V2(za),SO=W2(za),CO=Z2(za);function NO(){qa.localeError||Ka(X_())}function bl(){qa.memoizer||Ka({memoizer:Y_()})}const Wt=ce("ZodType",(e,t)=>(NO(),Vt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(ya(t,{checks:[...t.checks??[],...e.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return xr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(yM(e,t))},superRefine(e,t){return this.check(EM(e,t))},overwrite(e){return this.check(_o(e))},optional(){return We(this)},exactOptional(){return oM(this)},nullable(){return pf(this)},nullish(){return We(pf(this))},nonoptional(e){return dM(this,e)},array(){return re(this)},or(e){return Te([this,e])},and(e){return Br(this,e)},transform(e){return mf(this,Ey(e))},default(e){return lM(this,e)},prefault(e){return uM(this,e)},catch(e){return mM(this,e)},pipe(e){return mf(this,e)},readonly(){return gM(this)},describe(e){const t=this.clone();return ci.add(t,{description:e}),t},meta(...e){if(e.length===0)return ci.get(this);const t=this.clone();return ci.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ab(this,"~standard",{...db(this),jsonSchema:{input:Ks(this,"input"),output:Ks(this,"output")}})},set"~standard"(e){wr(this,"~standard",e)},parse:function e(t,a){return fO(this,t,a,{callee:e})},parseAsync:async function e(t,a){return await gO(this,t,a,{callee:e})},safeParse(e,t){return dy(this,e,t)},async safeParseAsync(e,t){return vO(this,e,t)},get spa(){return this==null?void 0:this.safeParseAsync},set spa(e){wr(this,"spa",e)},validate(e,t){return D2(this,e,t)},validateAsync(e,t){return q2(this,e,t)},encode:function e(t,a){return bO(this,t,a,{callee:e})},decode:function e(t,a){return yO(this,t,a,{callee:e})},encodeAsync:async function e(t,a){return await EO(this,t,a,{callee:e})},decodeAsync:async function e(t,a){return await wO(this,t,a,{callee:e})},safeEncode(e,t){return kO(this,e,t)},safeDecode(e,t){return xO(this,e,t)},async safeEncodeAsync(e,t){return SO(this,e,t)},async safeDecodeAsync(e,t){return CO(this,e,t)},toJSONSchema(e){return YP(this,{})(e)},get description(){var e;return(e=ci.get(this))==null?void 0:e.description},get _def(){return this._zod.def}}),py=ce("_ZodString",(e,t)=>{Id.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Fb(e,a,r)},rb({format:e=>Ea(e).format??null,minLength:e=>Ea(e).minimum??null,maxLength:e=>Ea(e).maximum??null},{regex(...e){return this.check(MP(...e))},includes(...e){return this.check(DP(...e))},startsWith(...e){return this.check(FP(...e))},endsWith(...e){return this.check(qP(...e))},min(...e){return this.check(Vs(...e))},max(...e){return this.check(Ib(...e))},length(...e){return this.check(Ab(...e))},nonempty(...e){return this.check(Vs(1,...e))},lowercase(e){return this.check(zP(e))},uppercase(e){return this.check(LP(e))},trim(){return this.check(jP())},normalize(...e){return this.check(UP(...e))},toLowerCase(){return this.check($P())},toUpperCase(){return this.check(BP())},slugify(){return this.check(HP())}})),RO=ce("ZodString",(e,t)=>{Id.init(e,t),py.init(e,t)},{email(e){return this.check(Cb(fy,e))},url(e){return this.check(Nb(gy,e))},jwt(e){return this.check(kP(WO,e))},emoji(e){return this.check(lP(PO,e))},guid(e){return this.check(aP(_O,e))},uuid(e){return this.check(rP(is,e))},uuidv4(e){return this.check(oP(is,e))},uuidv6(e){return this.check(iP(is,e))},uuidv7(e){return this.check(sP(is,e))},nanoid(e){return this.check(cP(OO,e))},cuid(e){return this.check(uP(MO,e))},cuid2(e){return this.check(dP(zO,e))},ulid(e){return this.check(pP(LO,e))},base64(e){return this.check(yP(BO,e))},base64url(e){return this.check(EP(HO,e))},xid(e){return this.check(mP(DO,e))},ksuid(e){return this.check(hP(FO,e))},ipv4(e){return this.check(fP(qO,e))},ipv6(e){return this.check(gP(UO,e))},cidrv4(e){return this.check(vP(jO,e))},cidrv6(e){return this.check(bP($O,e))},e164(e){return this.check(wP(VO,e))},datetime(e){return this.check(Rb(my,e))},date(e){return this.check(Tb(hy,e))},time(e){return this.check(xP(TO,e))},duration(e){return this.check(SP(IO,e))}});function R(e){return nP(RO,e)}const an=ce("ZodStringFormat",(e,t)=>{tn.init(e,t),py.init(e,t)}),my=ce("ZodISODateTime",(e,t)=>{n_.init(e,t),an.init(e,t)}),hy=ce("ZodISODate",(e,t)=>{a_.init(e,t),an.init(e,t)}),TO=ce("ZodISOTime",(e,t)=>{r_.init(e,t),an.init(e,t)}),IO=ce("ZodISODuration",(e,t)=>{o_.init(e,t),an.init(e,t)}),fy=ce("ZodEmail",(e,t)=>{$A.init(e,t),an.init(e,t)});function AO(e){return Cb(fy,e)}const _O=ce("ZodGUID",(e,t)=>{UA.init(e,t),an.init(e,t)}),is=ce("ZodUUID",(e,t)=>{jA.init(e,t),an.init(e,t)}),gy=ce("ZodURL",(e,t)=>{JA.init(e,t),an.init(e,t)});function vy(e){return Nb(gy,e)}const PO=ce("ZodEmoji",(e,t)=>{KA.init(e,t),an.init(e,t)}),OO=ce("ZodNanoID",(e,t)=>{YA.init(e,t),an.init(e,t)}),MO=ce("ZodCUID",(e,t)=>{GA.init(e,t),an.init(e,t)}),zO=ce("ZodCUID2",(e,t)=>{QA.init(e,t),an.init(e,t)}),LO=ce("ZodULID",(e,t)=>{XA.init(e,t),an.init(e,t)}),DO=ce("ZodXID",(e,t)=>{e_.init(e,t),an.init(e,t)}),FO=ce("ZodKSUID",(e,t)=>{t_.init(e,t),an.init(e,t)}),qO=ce("ZodIPv4",(e,t)=>{i_.init(e,t),an.init(e,t)}),UO=ce("ZodIPv6",(e,t)=>{l_.init(e,t),an.init(e,t)}),jO=ce("ZodCIDRv4",(e,t)=>{c_.init(e,t),an.init(e,t)}),$O=ce("ZodCIDRv6",(e,t)=>{d_.init(e,t),an.init(e,t)}),BO=ce("ZodBase64",(e,t)=>{p_.init(e,t),an.init(e,t)}),HO=ce("ZodBase64URL",(e,t)=>{h_.init(e,t),an.init(e,t)}),VO=ce("ZodE164",(e,t)=>{f_.init(e,t),an.init(e,t)}),WO=ce("ZodJWT",(e,t)=>{v_.init(e,t),an.init(e,t)}),Od=ce("ZodNumber",(e,t)=>{vb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>qb(e,a,r,o),e.isFinite=!0},rb({minValue:e=>{const{minimum:t,exclusiveMinimum:a}=Ea(e);return Math.max(t??Number.NEGATIVE_INFINITY,a??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:a}=Ea(e);return Math.min(t??Number.POSITIVE_INFINITY,a??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:a}=Ea(e);return!!t||!!(a!=null&&a.some(Number.isSafeInteger))},format:e=>Ea(e).format??null},{gt(e,t){return this.check(Qh(e,t))},gte(e,t){return this.check(Ec(e,t))},min(e,t){return this.check(Ec(e,t))},lt(e,t){return this.check(Gh(e,t))},lte(e,t){return this.check(yc(e,t))},max(e,t){return this.check(yc(e,t))},int(e){return this.check(uf(e))},safe(e){return this.check(uf(e))},positive(e){return this.check(Qh(0,e))},nonnegative(e){return this.check(Ec(0,e))},negative(e){return this.check(Gh(0,e))},nonpositive(e){return this.check(yc(0,e))},multipleOf(e,t){return this.check(Xh(e,t))},step(e,t){return this.check(Xh(e,t))},finite(){return this}}));function be(e){return CP(Od,e)}const ZO=ce("ZodNumberFormat",(e,t)=>{b_.init(e,t),Od.init(e,t)});function uf(e){return RP(ZO,e)}const JO=ce("ZodBoolean",(e,t)=>{y_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Ub(e,a,r)});function Ae(e){return TP(JO,e)}const KO=ce("ZodUndefined",(e,t)=>{E_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>$b(e,a,r,o)});function vu(e){return IP(KO,e)}const YO=ce("ZodNull",(e,t)=>{w_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>jb(e,a,r)});function Ni(e){return AP(YO,e)}const GO=ce("ZodAny",(e,t)=>{k_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Hb()});function Md(){return _P(GO)}const QO=ce("ZodUnknown",(e,t)=>{x_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Vb()});function He(){return PP(QO)}const XO=ce("ZodNever",(e,t)=>{S_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Bb(e,a,r)});function bu(e){return OP(XO,e)}const eM=ce("ZodArray",(e,t)=>{bl(),C_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Yb(e,a,r,o),e.element=t.element},{min(e,t){return this.check(Vs(e,t))},nonempty(e){return this.check(Vs(1,e))},max(e,t){return this.check(Ib(e,t))},length(e,t){return this.check(Ab(e,t))},unwrap(){return this.element}});function re(e,t){return VP(eM,e,t)}const by=ce("ZodObject",(e,t)=>{bl(),T_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Gb(e,a,r,o),k2(e,"shape",a=>a._zod.def.shape,!1)},{keyof(){return lt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ya(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ya(this._zod.def,{catchall:He()}))},loose(){return this.clone(ya(this._zod.def,{catchall:He()}))},strict(){return this.clone(ya(this._zod.def,{catchall:bu()}))},strip(){return this.clone(ya(this._zod.def,{catchall:void 0}))},extend(e){return p2(this,e)},safeExtend(e){return m2(this,e)},merge(e){return h2(this,e)},pick(e){return u2(this,e)},omit(e){return d2(this,e)},partial(...e){return Oh(wy,this,e[0])},exactPartial(...e){return Oh(ky,this,e[0],"exactPartial")},required(...e){return f2(xy,this,e[0])}});function B(e,t){const a={type:"object",shape:e??{},...Ve(t)};return new by(a)}function Qe(e,t){return new by({type:"object",shape:e,catchall:He(),...Ve(t)})}const yy=ce("ZodUnion",(e,t)=>{Eb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Qb(e,a,r,o),e.options=t.options});function Te(e,t){return new yy({type:"union",options:e,...Ve(t)})}const tM=ce("ZodDiscriminatedUnion",(e,t)=>{yy.init(e,t),A_.init(e,t)});function Ys(e,t,a){return new tM({type:"union",options:t,discriminator:e,...Ve(a)})}const nM=ce("ZodIntersection",(e,t)=>{__.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Xb(e,a,r,o)});function Br(e,t){return new nM({type:"intersection",left:e,right:t})}const df=ce("ZodRecord",(e,t)=>{bl(),P_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ey(e,a,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ne(e,t,a){return!t||!t._zod?new df({type:"record",keyType:R(),valueType:e,...Ve(t)}):new df({type:"record",keyType:e,valueType:t,...Ve(a)})}const yu=ce("ZodEnum",(e,t)=>{O_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Wb(e,r,o),e.enum=t.entries,e.options=[...e._zod.values];const a=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(a.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new yu({...t,checks:[],...Ve(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(a.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new yu({...t,checks:[],...Ve(o),entries:i})}});function lt(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new yu({type:"enum",entries:a,...Ve(t)})}const aM=ce("ZodLiteral",(e,t)=>{M_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Zb(e,a,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new aM({type:"literal",values:Array.isArray(e)?e:[e],...Ve(t)})}const rM=ce("ZodTransform",(e,t)=>{bl(),z_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Kb(e,a,r,o),e._zod.parse=(a,r)=>{if(r.direction==="backward")throw new ob(e.constructor.name);a.addIssue=i=>{if(typeof i=="string")a.issues.push(Ci(i,a.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=a.value),s.inst??(s.inst=e),a.issues.push(Ci(s))}};const o=t.transform(a.value,a);return o instanceof Promise?o.then(i=>(a.value=i,a)):(a.value=o,a)}});function Ey(e){return new rM({type:"transform",transform:e})}const wy=ce("ZodOptional",(e,t)=>{wb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Pd(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function We(e){return new wy({type:"optional",innerType:e})}const ky=ce("ZodExactOptional",(e,t)=>{L_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Pd(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function oM(e){return new ky({type:"optional",innerType:e})}const iM=ce("ZodNullable",(e,t)=>{D_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ty(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function pf(e){return new iM({type:"nullable",innerType:e})}const sM=ce("ZodDefault",(e,t)=>{F_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ry(e,a,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lM(e,t){return new sM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Xv(t)}})}const cM=ce("ZodPrefault",(e,t)=>{q_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>oy(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function uM(e,t){return new cM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Xv(t)}})}const xy=ce("ZodNonOptional",(e,t)=>{U_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ny(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function dM(e,t){return new xy({type:"nonoptional",innerType:e,...Ve(t)})}const pM=ce("ZodCatch",(e,t)=>{j_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>iy(e,a,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mM(e,t){return new pM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:S2(t)})}const Sy=ce("ZodPipe",(e,t)=>{kb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>sy(e,a,r,o),e.in=t.in,e.out=t.out});function mf(e,t){return new Sy({type:"pipe",in:e,out:t})}const hM=ce("ZodPreprocess",(e,t)=>{Sy.init(e,t),$_.init(e,t)}),fM=ce("ZodReadonly",(e,t)=>{B_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ly(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function gM(e){return new fM({type:"readonly",innerType:e})}const vM=ce("ZodLazy",(e,t)=>{H_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>cy(e,a,r,o),e.unwrap=()=>e._zod.def.getter()});function zd(e){return new vM({type:"lazy",getter:e})}const bM=ce("ZodCustom",(e,t)=>{V_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Jb(e,a,r,o)});function yM(e,t={}){return WP(bM,e,t)}function EM(e,t){return ZP(e,t)}function Ri(e,t){return new hM({type:"pipe",in:Ey(e),out:t})}const wM={custom:"custom"};function yl(e){return Rb(my,e)}function kM(e){return Tb(hy,e)}function xM(e){return NP(Od,e)}const SM="2025-11-25",CM=[SM,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],NM="io.modelcontextprotocol/related-task",El="io.modelcontextprotocol/protocolVersion",Ld="io.modelcontextprotocol/clientInfo",bi="io.modelcontextprotocol/serverInfo",wl="io.modelcontextprotocol/clientCapabilities",RM="io.modelcontextprotocol/subscriptionId",Dd="io.modelcontextprotocol/logLevel",kl="2.0",So=zd(()=>Te([R(),be(),Ae(),Ni(),Ne(R(),So),re(So)])),fn=Ne(R(),So),TM=re(So),Fd=Te([R(),be().int()]),qd=R(),Cy=B({ttl:be().optional()}),Ny=B({taskId:R()}),Ud=Qe({progressToken:Fd.optional(),[NM]:Ny.optional()}),Yn=B({_meta:Ud.optional()}),Wi=Yn.extend({task:Cy.optional()}),vn=B({method:R(),params:Yn.loose().optional()}),ua=B({_meta:Ud.optional()}),da=B({method:R(),params:ua.loose().optional()}),jd=Qe({get[bi](){return Oo.optional().catch(void 0)}}),bn=Qe({_meta:jd.optional()}),Zr=Te([R(),be().int()]),$d=B({jsonrpc:J(kl),id:Zr,...vn.shape}).strict(),Bd=B({jsonrpc:J(kl),...da.shape}).strict(),xl=B({jsonrpc:J(kl),id:Zr,result:bn}).strict(),Sl=B({jsonrpc:J(kl),id:Zr.optional(),error:B({code:be().int(),message:R(),data:He().optional()})}).strict(),Ry=Te([$d,Bd,xl,Sl]),IM=Te([xl,Sl]),Cl=bn.strict(),Ty=ua.extend({requestId:Zr.optional(),reason:R().optional()}),Hd=da.extend({method:J("notifications/cancelled"),params:Ty}),Iy=B({src:R(),mimeType:R().optional(),sizes:re(R()).optional(),theme:lt(["light","dark"]).optional()}),Po=B({icons:re(Iy).optional()}),Hr=B({name:R(),title:R().optional()}),Oo=Hr.extend({...Hr.shape,...Po.shape,version:R(),websiteUrl:R().optional(),description:R().optional()}),AM=Br(B({applyDefaults:Ae().optional()}),fn),_M=Ri(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Br(B({form:AM.optional(),url:fn.optional()}),fn.optional())),Ay=Qe({list:fn.optional(),cancel:fn.optional(),requests:Qe({sampling:Qe({createMessage:fn.optional()}).optional(),elicitation:Qe({create:fn.optional()}).optional()}).optional()}),_y=Qe({list:fn.optional(),cancel:fn.optional(),requests:Qe({tools:Qe({call:fn.optional()}).optional()}).optional()}),Py=B({experimental:Ne(R(),fn).optional(),sampling:B({context:fn.optional(),tools:fn.optional()}).optional(),elicitation:_M.optional(),roots:B({listChanged:Ae().optional()}).optional(),tasks:Ay.optional(),extensions:Ne(R(),fn).optional()}),Oy=Yn.extend({protocolVersion:R(),capabilities:Py,clientInfo:Oo}),My=vn.extend({method:J("initialize"),params:Oy}),Vd=B({experimental:Ne(R(),fn).optional(),logging:fn.optional(),completions:fn.optional(),prompts:B({listChanged:Ae().optional()}).optional(),resources:B({subscribe:Ae().optional(),listChanged:Ae().optional()}).optional(),tools:B({listChanged:Ae().optional()}).optional(),tasks:_y.optional(),extensions:Ne(R(),fn).optional()}),zy=bn.extend({protocolVersion:R(),capabilities:Vd,serverInfo:Oo,instructions:R().optional()}),Ly=da.extend({method:J("notifications/initialized"),params:ua.optional()}),Dy=vn.extend({method:J("server/discover"),params:Yn.optional()}),Fy=bn.extend({supportedVersions:re(R()),capabilities:Vd,instructions:R().optional()}),Wd=vn.extend({method:J("ping"),params:Yn.optional()}),qy=B({progress:be(),total:We(be()),message:We(R())}),Uy=B({...ua.shape,...qy.shape,progressToken:Fd}),Zd=da.extend({method:J("notifications/progress"),params:Uy}),jy=Yn.extend({cursor:qd.optional()}),Mo=vn.extend({params:jy.optional()}),zo=bn.extend({nextCursor:qd.optional()}),Jd=B({uri:R(),mimeType:We(R()),_meta:Ne(R(),He()).optional()}),Kd=Jd.extend({text:R()}),Yd=R().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Gd=Jd.extend({blob:Yd}),Lo=lt(["user","assistant"]),Jr=B({audience:re(Lo).optional(),priority:be().min(0).max(1).optional(),lastModified:yl({offset:!0}).optional()}),Qd=B({...Hr.shape,...Po.shape,uri:R(),description:We(R()),mimeType:We(R()),size:We(be()),annotations:Jr.optional(),_meta:We(Qe({}))}),$y=B({...Hr.shape,...Po.shape,uriTemplate:R(),description:We(R()),mimeType:We(R()),annotations:Jr.optional(),_meta:We(Qe({}))}),By=Mo.extend({method:J("resources/list")}),Hy=zo.extend({resources:re(Qd)}),Vy=Mo.extend({method:J("resources/templates/list")}),Wy=zo.extend({resourceTemplates:re($y)}),Nl=Yn.extend({uri:R()}),Zy=Nl,Jy=vn.extend({method:J("resources/read"),params:Zy}),Ky=bn.extend({contents:re(Te([Kd,Gd]))}),Yy=da.extend({method:J("notifications/resources/list_changed"),params:ua.optional()}),Gy=Nl,Qy=vn.extend({method:J("resources/subscribe"),params:Gy}),Xy=Nl,eE=vn.extend({method:J("resources/unsubscribe"),params:Xy}),Xd=B({toolsListChanged:Ae().optional(),promptsListChanged:Ae().optional(),resourcesListChanged:Ae().optional(),resourceSubscriptions:re(R()).optional()}),tE=Yn.extend({notifications:Xd}),nE=vn.extend({method:J("subscriptions/listen"),params:tE}),aE=ua.extend({notifications:Xd}),rE=da.extend({method:J("notifications/subscriptions/acknowledged"),params:aE}),oE=jd.extend({[RM]:Zr}),iE=bn.extend({_meta:oE}),sE=ua.extend({uri:R()}),lE=da.extend({method:J("notifications/resources/updated"),params:sE}),cE=B({name:R(),description:We(R()),required:We(Ae())}),uE=B({...Hr.shape,...Po.shape,description:We(R()),arguments:We(re(cE)),_meta:We(Qe({}))}),dE=Mo.extend({method:J("prompts/list")}),pE=zo.extend({prompts:re(uE)}),mE=Yn.extend({name:R(),arguments:Ne(R(),R()).optional()}),hE=vn.extend({method:J("prompts/get"),params:mE}),Rl=B({type:J("text"),text:R(),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),Tl=B({type:J("image"),data:Yd,mimeType:R(),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),Il=B({type:J("audio"),data:Yd,mimeType:R(),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),fE=B({type:J("tool_use"),name:R(),id:R(),input:Ne(R(),He()),_meta:Ne(R(),He()).optional()}),ep=B({type:J("resource"),resource:Te([Kd,Gd]),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),tp=Qd.extend({type:J("resource_link")}),Do=Te([Rl,Tl,Il,tp,ep]),gE=B({role:Lo,content:Do}),vE=bn.extend({description:R().optional(),messages:re(gE)}),bE=da.extend({method:J("notifications/prompts/list_changed"),params:ua.optional()}),yE=B({title:R().optional(),readOnlyHint:Ae().optional(),destructiveHint:Ae().optional(),idempotentHint:Ae().optional(),openWorldHint:Ae().optional()}),EE=B({taskSupport:lt(["required","optional","forbidden"]).optional()}),Al=B({...Hr.shape,...Po.shape,description:R().optional(),inputSchema:B({type:J("object"),properties:Ne(R(),So).optional(),required:re(R()).optional()}).catchall(He()),outputSchema:Qe({$schema:R().optional()}).optional(),annotations:yE.optional(),execution:EE.optional(),_meta:Ne(R(),He()).optional()}),wE=Mo.extend({method:J("tools/list")}),kE=zo.extend({tools:re(Al)}),_l=bn.extend({content:re(Do).default([]),structuredContent:He().optional(),isError:Ae().optional()}),PM=_l.or(bn.extend({toolResult:He()})),xE=Wi.extend({name:R(),arguments:Ne(R(),He()).optional()}),SE=vn.extend({method:J("tools/call"),params:xE}),CE=da.extend({method:J("notifications/tools/list_changed"),params:ua.optional()}),OM=B({autoRefresh:Ae().default(!0),debounceMs:be().int().nonnegative().default(300)}),np=lt(["debug","info","notice","warning","error","critical","alert","emergency"]),NE=Yn.extend({level:np}),RE=vn.extend({method:J("logging/setLevel"),params:NE}),TE=ua.extend({level:np,logger:R().optional(),data:He()}),ap=da.extend({method:J("notifications/message"),params:TE}),IE=B({name:R().optional()}),AE=B({hints:re(IE).optional(),costPriority:be().min(0).max(1).optional(),speedPriority:be().min(0).max(1).optional(),intelligencePriority:be().min(0).max(1).optional()}),_E=B({mode:lt(["auto","required","none"]).optional()}),PE=B({type:J("tool_result"),toolUseId:R().describe("The unique identifier for the corresponding tool call."),content:re(Do),structuredContent:He().optional(),isError:Ae().optional(),_meta:Ne(R(),He()).optional()}),OE=Ys("type",[Rl,Tl,Il]),Ti=Ys("type",[Rl,Tl,Il,fE,PE]),ME=B({role:Lo,content:Te([Ti,re(Ti)]),_meta:Ne(R(),He()).optional()}),zE=Wi.extend({messages:re(ME),modelPreferences:AE.optional(),systemPrompt:R().optional(),includeContext:lt(["none","thisServer","allServers"]).optional(),temperature:be().optional(),maxTokens:be().int(),stopSequences:re(R()).optional(),metadata:fn.optional(),tools:re(Al).optional(),toolChoice:_E.optional()}),LE=vn.extend({method:J("sampling/createMessage"),params:zE}),DE=bn.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens"]).or(R())),role:Lo,content:OE}),FE=bn.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens","toolUse"]).or(R())),role:Lo,content:Te([Ti,re(Ti)])}),rp=B({type:J("boolean"),title:R().optional(),description:R().optional(),default:Ae().optional()}),Pl=B({type:J("string"),title:R().optional(),description:R().optional(),minLength:be().optional(),maxLength:be().optional(),format:lt(["email","uri","date","date-time"]).optional(),default:R().optional()}),Gs=B({type:lt(["number","integer"]),title:R().optional(),description:R().optional(),minimum:be().optional(),maximum:be().optional(),default:be().optional()}),op=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),default:R().optional()}),ip=B({type:J("string"),title:R().optional(),description:R().optional(),oneOf:re(B({const:R(),title:R()})),default:R().optional()}),sp=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),enumNames:re(R()).optional(),default:R().optional()}),qE=Te([op,ip]),lp=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({type:J("string"),enum:re(R())}),default:re(R()).optional()}),cp=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({anyOf:re(B({const:R(),title:R()}))}),default:re(R()).optional()}),UE=Te([lp,cp]),jE=Te([sp,qE,UE]),up=Te([jE,rp,Pl,Gs]),Ol=Wi.extend({mode:J("form").optional(),message:R(),requestedSchema:B({type:J("object"),properties:Ne(R(),up),required:re(R()).optional()}).catchall(He())}),$E=Wi.extend({mode:J("url"),message:R(),elicitationId:R(),url:R().url()}),BE=Te([Ol,$E]),HE=vn.extend({method:J("elicitation/create"),params:BE}),VE=ua.extend({elicitationId:R()}),WE=da.extend({method:J("notifications/elicitation/complete"),params:VE}),ZE=bn.extend({action:lt(["accept","decline","cancel"]),content:Ri(e=>e===null?void 0:e,Ne(R(),Te([R(),be(),Ae(),re(R())])).optional())}),JE=B({type:J("ref/resource"),uri:R()}),KE=B({type:J("ref/prompt"),name:R()}),YE=Yn.extend({ref:Te([KE,JE]),argument:B({name:R(),value:R()}),context:B({arguments:Ne(R(),R()).optional()}).optional()}),GE=vn.extend({method:J("completion/complete"),params:YE}),QE=bn.extend({completion:Qe({values:re(R()).max(100),total:We(be().int()),hasMore:We(Ae())})}),XE=B({uri:R().startsWith("file://"),name:R().optional(),_meta:Ne(R(),He()).optional()}),ew=vn.extend({method:J("roots/list"),params:Yn.optional()}),tw=bn.extend({roots:re(XE)}),nw=da.extend({method:J("notifications/roots/list_changed"),params:ua.optional()}),MM=Qe({ttl:be().optional(),pollInterval:be().optional()}),aw=lt(["working","input_required","completed","failed","cancelled"]),Fo=B({taskId:R(),status:aw,ttl:Te([be(),Ni()]),createdAt:R(),lastUpdatedAt:R(),pollInterval:We(be()),statusMessage:We(R())}),zM=bn.extend({task:Fo}),rw=ua.merge(Fo),LM=da.extend({method:J("notifications/tasks/status"),params:rw}),DM=vn.extend({method:J("tasks/get"),params:Yn.extend({taskId:R()})}),FM=bn.merge(Fo),qM=vn.extend({method:J("tasks/result"),params:Yn.extend({taskId:R()})}),UM=bn.loose(),jM=Mo.extend({method:J("tasks/list")}),$M=zo.extend({tasks:re(Fo)}),BM=vn.extend({method:J("tasks/cancel"),params:Yn.extend({taskId:R()})}),HM=bn.merge(Fo),VM=Te([Wd,My,Dy,GE,RE,hE,dE,By,Vy,Jy,Qy,eE,nE,SE,wE]),WM=Te([Hd,Zd,Ly,nw]),ZM=Te([Cl,DE,FE,ZE,tw]),JM=Te([Wd,LE,HE,ew]),KM=Te([Hd,Zd,ap,lE,Yy,CE,bE,rE,WE]),YM=Te([Cl,zy,Fy,QE,vE,pE,Hy,Wy,Ky,_l,kE,iE]),$n=vy().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wM.custom,message:"URL must be parseable",fatal:!0}),C2}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),GM=Qe({resource:R().url(),authorization_servers:re($n).optional(),jwks_uri:R().url().optional(),scopes_supported:re(R()).optional(),bearer_methods_supported:re(R()).optional(),resource_signing_alg_values_supported:re(R()).optional(),resource_name:R().optional(),resource_documentation:R().optional(),resource_policy_uri:R().url().optional(),resource_tos_uri:R().url().optional(),tls_client_certificate_bound_access_tokens:Ae().optional(),authorization_details_types_supported:re(R()).optional(),dpop_signing_alg_values_supported:re(R()).optional(),dpop_bound_access_tokens_required:Ae().optional()}),ow=Qe({issuer:R(),authorization_endpoint:$n,token_endpoint:$n,registration_endpoint:$n.optional(),scopes_supported:re(R()).optional(),response_types_supported:re(R()),response_modes_supported:re(R()).optional(),grant_types_supported:re(R()).optional(),token_endpoint_auth_methods_supported:re(R()).optional(),token_endpoint_auth_signing_alg_values_supported:re(R()).optional(),service_documentation:$n.optional(),revocation_endpoint:$n.optional(),revocation_endpoint_auth_methods_supported:re(R()).optional(),revocation_endpoint_auth_signing_alg_values_supported:re(R()).optional(),introspection_endpoint:R().optional(),introspection_endpoint_auth_methods_supported:re(R()).optional(),introspection_endpoint_auth_signing_alg_values_supported:re(R()).optional(),code_challenge_methods_supported:re(R()).optional(),client_id_metadata_document_supported:Ae().optional(),authorization_response_iss_parameter_supported:Ae().optional().catch(void 0)}),iw=Qe({issuer:R(),authorization_endpoint:$n,token_endpoint:$n,userinfo_endpoint:$n.optional(),jwks_uri:$n,registration_endpoint:$n.optional(),scopes_supported:re(R()).optional(),response_types_supported:re(R()),response_modes_supported:re(R()).optional(),grant_types_supported:re(R()).optional(),acr_values_supported:re(R()).optional(),subject_types_supported:re(R()),id_token_signing_alg_values_supported:re(R()),id_token_encryption_alg_values_supported:re(R()).optional(),id_token_encryption_enc_values_supported:re(R()).optional(),userinfo_signing_alg_values_supported:re(R()).optional(),userinfo_encryption_alg_values_supported:re(R()).optional(),userinfo_encryption_enc_values_supported:re(R()).optional(),request_object_signing_alg_values_supported:re(R()).optional(),request_object_encryption_alg_values_supported:re(R()).optional(),request_object_encryption_enc_values_supported:re(R()).optional(),token_endpoint_auth_methods_supported:re(R()).optional(),token_endpoint_auth_signing_alg_values_supported:re(R()).optional(),display_values_supported:re(R()).optional(),claim_types_supported:re(R()).optional(),claims_supported:re(R()).optional(),service_documentation:R().optional(),claims_locales_supported:re(R()).optional(),ui_locales_supported:re(R()).optional(),claims_parameter_supported:Ae().optional(),request_parameter_supported:Ae().optional(),request_uri_parameter_supported:Ae().optional(),require_request_uri_registration:Ae().optional(),op_policy_uri:$n.optional(),op_tos_uri:$n.optional(),client_id_metadata_document_supported:Ae().optional(),authorization_response_iss_parameter_supported:Ae().optional().catch(void 0)}),QM=B({...iw.shape,...ow.pick({code_challenge_methods_supported:!0}).shape}),XM=B({access_token:R(),id_token:R().optional(),token_type:R(),expires_in:xM().optional(),scope:R().optional(),refresh_token:R().optional()}).strip(),e4=B({issued_token_type:J("urn:ietf:params:oauth:token-type:id-jag"),access_token:R(),token_type:R().optional(),expires_in:be().optional(),scope:R().optional()}).strip(),t4=B({error:R(),error_description:R().optional(),error_uri:R().optional()}),hf=$n.optional().or(J("").transform(()=>{})),sw=B({redirect_uris:re($n),token_endpoint_auth_method:R().optional(),grant_types:re(R()).optional(),response_types:re(R()).optional(),application_type:R().optional(),client_name:R().optional(),client_uri:$n.optional(),logo_uri:hf,scope:R().optional(),contacts:re(R()).optional(),tos_uri:hf,policy_uri:R().optional(),jwks_uri:$n.optional(),jwks:Md().optional(),software_id:R().optional(),software_version:R().optional(),software_statement:R().optional()}).strip(),lw=B({client_id:R(),client_secret:R().optional(),client_id_issued_at:be().optional(),client_secret_expires_at:be().optional()}).strip(),n4=sw.merge(lw),a4=B({error:R(),error_description:R().optional()}).strip(),r4=B({token:R(),token_type_hint:R().optional()}).strip(),Eu=Symbol.for("mcp.sdk.errorBrands");function cw(e,t){const a=new Set;let r=t;for(;typeof r=="function";){const o=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,"mcpBrand")&&typeof o=="string"&&a.add(o),r=Object.getPrototypeOf(r)}a.size!==0&&Object.defineProperty(e,Eu,{value:a,enumerable:!1,configurable:!0})}function Qs(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,Eu)){const a=t[Eu];if(a&&typeof a.has=="function"&&a.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let Wn=(function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e})({});var so,Mn=(so=class extends Error{static[Symbol.hasInstance](t){return Qs(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qs(this,t)}constructor(t,a,r){super(a),this.code=t,this.data=r,this.name="SdkError",cw(this,new.target)}},Object.defineProperty(so,"mcpBrand",{value:"mcp.SdkError"}),so);const o4="2026-07-28";function i4(e){return e>=o4}function uw(e){var a;const t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(((a=e.content)==null?void 0:a.some(r=>r.type==="text"))??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}const dw=["task","inputRequests","requestState"];function s4(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||dw.some(t=>t in e)?e:{...e,content:[]}}function l4(){const e=zd(()=>Te([R(),be(),Ae(),Ni(),Ne(R(),e),re(e)])),t=Ne(R(),e),a=Te([R(),be().int()]),r=R(),o=B({ttl:be().optional()}),i=B({taskId:R()}),s=Qe({progressToken:a.optional(),"io.modelcontextprotocol/related-task":i.optional()}),l=B({_meta:s.optional()}),c=l.extend({task:o.optional()}),u=B({method:R(),params:l.loose().optional()}),d=B({_meta:s.optional()}),p=B({method:R(),params:d.loose().optional()}),m=Qe({_meta:s.optional()}),h=Te([R(),be().int()]),f=m.strict(),g=d.extend({requestId:h.optional(),reason:R().optional()}),y=p.extend({method:J("notifications/cancelled"),params:g}),E=B({src:R(),mimeType:R().optional(),sizes:re(R()).optional(),theme:lt(["light","dark"]).optional()}),b=B({icons:re(E).optional()}),S=B({name:R(),title:R().optional()}),w=S.extend({...S.shape,...b.shape,version:R(),websiteUrl:R().optional(),description:R().optional()}),N=Br(B({applyDefaults:Ae().optional()}),t),x=Ri(ee=>ee&&typeof ee=="object"&&!Array.isArray(ee)&&Object.keys(ee).length===0?{form:{}}:ee,Br(B({form:N.optional(),url:t.optional()}),t.optional())),A=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({sampling:Qe({createMessage:t.optional()}).optional(),elicitation:Qe({create:t.optional()}).optional()}).optional()}),C=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({tools:Qe({call:t.optional()}).optional()}).optional()}),O=B({experimental:Ne(R(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:x.optional(),roots:B({listChanged:Ae().optional()}).optional(),tasks:A.optional(),extensions:Ne(R(),t).optional()}),k=l.extend({protocolVersion:R(),capabilities:O,clientInfo:w}),T=u.extend({method:J("initialize"),params:k}),I=B({experimental:Ne(R(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:Ae().optional()}).optional(),resources:B({subscribe:Ae().optional(),listChanged:Ae().optional()}).optional(),tools:B({listChanged:Ae().optional()}).optional(),tasks:C.optional(),extensions:Ne(R(),t).optional()}),F=m.extend({protocolVersion:R(),capabilities:I,serverInfo:w,instructions:R().optional()}),z=p.extend({method:J("notifications/initialized"),params:d.optional()}),U=u.extend({method:J("ping"),params:l.optional()}),H=B({progress:be(),total:We(be()),message:We(R())}),te=B({...d.shape,...H.shape,progressToken:a}),j=p.extend({method:J("notifications/progress"),params:te}),_=l.extend({cursor:r.optional()}),P=u.extend({params:_.optional()}),G=m.extend({nextCursor:r.optional()}),W=B({uri:R(),mimeType:We(R()),_meta:Ne(R(),He()).optional()}),D=W.extend({text:R()}),ne=R().refine(ee=>{try{return atob(ee),!0}catch{return!1}},{message:"Invalid Base64 string"}),q=W.extend({blob:ne}),Z=lt(["user","assistant"]),ie=B({audience:re(Z).optional(),priority:be().min(0).max(1).optional(),lastModified:yl({offset:!0}).optional()}),ke=B({...S.shape,...b.shape,uri:R(),description:We(R()),mimeType:We(R()),size:We(be()),annotations:ie.optional(),_meta:We(Qe({}))}),me=B({...S.shape,...b.shape,uriTemplate:R(),description:We(R()),mimeType:We(R()),annotations:ie.optional(),_meta:We(Qe({}))}),_e=P.extend({method:J("resources/list")}),Je=G.extend({resources:re(ke)}),De=P.extend({method:J("resources/templates/list")}),ue=G.extend({resourceTemplates:re(me)}),ye=l.extend({uri:R()}),M=ye,Y=u.extend({method:J("resources/read"),params:M}),se=m.extend({contents:re(Te([D,q]))}),Fe=p.extend({method:J("notifications/resources/list_changed"),params:d.optional()}),je=ye,oe=u.extend({method:J("resources/subscribe"),params:je}),Ze=ye,it=u.extend({method:J("resources/unsubscribe"),params:Ze}),zt=d.extend({uri:R()}),ct=p.extend({method:J("notifications/resources/updated"),params:zt}),qt=B({name:R(),description:We(R()),required:We(Ae())}),le=B({...S.shape,...b.shape,description:We(R()),arguments:We(re(qt)),_meta:We(Qe({}))}),fe=P.extend({method:J("prompts/list")}),xe=G.extend({prompts:re(le)}),ze=l.extend({name:R(),arguments:Ne(R(),R()).optional()}),Ye=u.extend({method:J("prompts/get"),params:ze}),ht=B({type:J("text"),text:R(),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),bt=B({type:J("image"),data:ne,mimeType:R(),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),ft=B({type:J("audio"),data:ne,mimeType:R(),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),Ce=B({type:J("tool_use"),name:R(),id:R(),input:Ne(R(),He()),_meta:Ne(R(),He()).optional()}),gt=B({type:J("resource"),resource:Te([D,q]),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),Et=ke.extend({type:J("resource_link")}),vt=Te([ht,bt,ft,Et,gt]),at=B({role:Z,content:vt}),X=m.extend({description:R().optional(),messages:re(at)}),Re=p.extend({method:J("notifications/prompts/list_changed"),params:d.optional()}),ae=B({title:R().optional(),readOnlyHint:Ae().optional(),destructiveHint:Ae().optional(),idempotentHint:Ae().optional(),openWorldHint:Ae().optional()}),Le=B({taskSupport:lt(["required","optional","forbidden"]).optional()}),Oe=B({...S.shape,...b.shape,description:R().optional(),inputSchema:B({type:J("object"),properties:Ne(R(),e).optional(),required:re(R()).optional()}).catchall(He()),outputSchema:B({type:J("object"),properties:Ne(R(),e).optional(),required:re(R()).optional()}).catchall(He()).optional(),annotations:ae.optional(),execution:Le.optional(),_meta:Ne(R(),He()).optional()}),et=P.extend({method:J("tools/list")}),st=G.extend({tools:re(Oe)}),It=m.extend({content:re(vt),structuredContent:Ne(R(),He()).optional(),isError:Ae().optional()}),xt=c.extend({name:R(),arguments:Ne(R(),He()).optional()}),Ut=u.extend({method:J("tools/call"),params:xt}),rt=p.extend({method:J("notifications/tools/list_changed"),params:d.optional()}),Xe=lt(["debug","info","notice","warning","error","critical","alert","emergency"]),$e=l.extend({level:Xe}),Nt=u.extend({method:J("logging/setLevel"),params:$e}),Zt=d.extend({level:Xe,logger:R().optional(),data:He()}),rn=p.extend({method:J("notifications/message"),params:Zt}),In=B({name:R().optional()}),yn=B({hints:re(In).optional(),costPriority:be().min(0).max(1).optional(),speedPriority:be().min(0).max(1).optional(),intelligencePriority:be().min(0).max(1).optional()}),Fn=B({mode:lt(["auto","required","none"]).optional()}),Gn=B({type:J("tool_result"),toolUseId:R().describe("The unique identifier for the corresponding tool call."),content:re(vt),structuredContent:B({}).loose().optional(),isError:Ae().optional(),_meta:Ne(R(),He()).optional()}),An=Ys("type",[ht,bt,ft]),Jt=Ys("type",[ht,bt,ft,Ce,Gn]),dn=B({role:Z,content:Te([Jt,re(Jt)]),_meta:Ne(R(),He()).optional()}),ut=c.extend({messages:re(dn),modelPreferences:yn.optional(),systemPrompt:R().optional(),includeContext:lt(["none","thisServer","allServers"]).optional(),temperature:be().optional(),maxTokens:be().int(),stopSequences:re(R()).optional(),metadata:t.optional(),tools:re(Oe).optional(),toolChoice:Fn.optional()}),ve=u.extend({method:J("sampling/createMessage"),params:ut}),ge=m.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens"]).or(R())),role:Z,content:An}),At=m.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens","toolUse"]).or(R())),role:Z,content:Te([Jt,re(Jt)])}),Ot=B({type:J("boolean"),title:R().optional(),description:R().optional(),default:Ae().optional()}),Kt=B({type:J("string"),title:R().optional(),description:R().optional(),minLength:be().optional(),maxLength:be().optional(),format:lt(["email","uri","date","date-time"]).optional(),default:R().optional()}),Q=B({type:lt(["number","integer"]),title:R().optional(),description:R().optional(),minimum:be().optional(),maximum:be().optional(),default:be().optional()}),Yt=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),default:R().optional()}),En=B({type:J("string"),title:R().optional(),description:R().optional(),oneOf:re(B({const:R(),title:R()})),default:R().optional()}),qn=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),enumNames:re(R()).optional(),default:R().optional()}),pn=Te([Yt,En]),wn=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({type:J("string"),enum:re(R())}),default:re(R()).optional()}),mn=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({anyOf:re(B({const:R(),title:R()}))}),default:re(R()).optional()}),_n=Te([wn,mn]),on=Te([qn,pn,_n]),pt=Te([on,Ot,Kt,Q]),mt=c.extend({mode:J("form").optional(),message:R(),requestedSchema:B({type:J("object"),properties:Ne(R(),pt),required:re(R()).optional()}).catchall(He())}),V=c.extend({mode:J("url"),message:R(),elicitationId:R(),url:R().url()}),we=Te([mt,V]),Ge=u.extend({method:J("elicitation/create"),params:we}),Dt=d.extend({elicitationId:R()}),kn=p.extend({method:J("notifications/elicitation/complete"),params:Dt}),sn=m.extend({action:lt(["accept","decline","cancel"]),content:Ri(ee=>ee===null?void 0:ee,Ne(R(),Te([R(),be(),Ae(),re(R())])).optional())}),Ca=B({type:J("ref/resource"),uri:R()}),Na=B({type:J("ref/prompt"),name:R()}),pa=l.extend({ref:Te([Na,Ca]),argument:B({name:R(),value:R()}),context:B({arguments:Ne(R(),R()).optional()}).optional()}),xn=u.extend({method:J("completion/complete"),params:pa}),ta=m.extend({completion:Qe({values:re(R()).max(100),total:We(be().int()),hasMore:We(Ae())})}),Sn=B({uri:R().startsWith("file://"),name:R().optional(),_meta:Ne(R(),He()).optional()}),ma=u.extend({method:J("roots/list"),params:l.optional()}),na=m.extend({roots:re(Sn)}),Ga=p.extend({method:J("notifications/roots/list_changed"),params:d.optional()}),Qa=Qe({ttl:be().optional(),pollInterval:be().optional()}),Xa=lt(["working","input_required","completed","failed","cancelled"]),aa=B({taskId:R(),status:Xa,ttl:Te([be(),Ni()]),createdAt:R(),lastUpdatedAt:R(),pollInterval:We(be()),statusMessage:We(R())}),Cn=m.extend({task:aa}),ir=d.merge(aa),ha=p.extend({method:J("notifications/tasks/status"),params:ir}),Ra=u.extend({method:J("tasks/get"),params:l.extend({taskId:R()})}),ln=m.merge(aa),Qn=u.extend({method:J("tasks/result"),params:l.extend({taskId:R()})}),ja=m.loose(),cn=P.extend({method:J("tasks/list")}),he=G.extend({tasks:re(aa)}),$=u.extend({method:J("tasks/cancel"),params:l.extend({taskId:R()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:a,CursorSchema:r,TaskMetadataSchema:o,RelatedTaskMetadataSchema:i,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:m,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:y,IconSchema:E,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:w,ClientTasksCapabilitySchema:A,ServerTasksCapabilitySchema:C,ClientCapabilitiesSchema:O,InitializeRequestParamsSchema:k,InitializeRequestSchema:T,ServerCapabilitiesSchema:I,InitializeResultSchema:F,InitializedNotificationSchema:z,PingRequestSchema:U,ProgressSchema:H,ProgressNotificationParamsSchema:te,ProgressNotificationSchema:j,PaginatedRequestParamsSchema:_,PaginatedRequestSchema:P,PaginatedResultSchema:G,ResourceContentsSchema:W,TextResourceContentsSchema:D,BlobResourceContentsSchema:q,RoleSchema:Z,AnnotationsSchema:ie,ResourceSchema:ke,ResourceTemplateSchema:me,ListResourcesRequestSchema:_e,ListResourcesResultSchema:Je,ListResourceTemplatesRequestSchema:De,ListResourceTemplatesResultSchema:ue,ResourceRequestParamsSchema:ye,ReadResourceRequestParamsSchema:M,ReadResourceRequestSchema:Y,ReadResourceResultSchema:se,ResourceListChangedNotificationSchema:Fe,SubscribeRequestParamsSchema:je,SubscribeRequestSchema:oe,UnsubscribeRequestParamsSchema:Ze,UnsubscribeRequestSchema:it,ResourceUpdatedNotificationParamsSchema:zt,ResourceUpdatedNotificationSchema:ct,PromptArgumentSchema:qt,PromptSchema:le,ListPromptsRequestSchema:fe,ListPromptsResultSchema:xe,GetPromptRequestParamsSchema:ze,GetPromptRequestSchema:Ye,TextContentSchema:ht,ImageContentSchema:bt,AudioContentSchema:ft,ToolUseContentSchema:Ce,EmbeddedResourceSchema:gt,ResourceLinkSchema:Et,ContentBlockSchema:vt,PromptMessageSchema:at,GetPromptResultSchema:X,PromptListChangedNotificationSchema:Re,ToolAnnotationsSchema:ae,ToolExecutionSchema:Le,ToolSchema:Oe,ListToolsRequestSchema:et,ListToolsResultSchema:st,CallToolResultSchema:It,CallToolRequestParamsSchema:xt,CallToolRequestSchema:Ut,ToolListChangedNotificationSchema:rt,LoggingLevelSchema:Xe,SetLevelRequestParamsSchema:$e,SetLevelRequestSchema:Nt,LoggingMessageNotificationParamsSchema:Zt,LoggingMessageNotificationSchema:rn,ModelHintSchema:In,ModelPreferencesSchema:yn,ToolChoiceSchema:Fn,ToolResultContentSchema:Gn,SamplingContentSchema:An,SamplingMessageContentBlockSchema:Jt,SamplingMessageSchema:dn,CreateMessageRequestParamsSchema:ut,CreateMessageRequestSchema:ve,CreateMessageResultSchema:ge,CreateMessageResultWithToolsSchema:At,BooleanSchemaSchema:Ot,StringSchemaSchema:Kt,NumberSchemaSchema:Q,UntitledSingleSelectEnumSchemaSchema:Yt,TitledSingleSelectEnumSchemaSchema:En,LegacyTitledEnumSchemaSchema:qn,SingleSelectEnumSchemaSchema:pn,UntitledMultiSelectEnumSchemaSchema:wn,TitledMultiSelectEnumSchemaSchema:mn,MultiSelectEnumSchemaSchema:_n,EnumSchemaSchema:on,PrimitiveSchemaDefinitionSchema:pt,ElicitRequestFormParamsSchema:mt,ElicitRequestURLParamsSchema:V,ElicitRequestParamsSchema:we,ElicitRequestSchema:Ge,ElicitationCompleteNotificationParamsSchema:Dt,ElicitationCompleteNotificationSchema:kn,ElicitResultSchema:sn,ResourceTemplateReferenceSchema:Ca,PromptReferenceSchema:Na,CompleteRequestParamsSchema:pa,CompleteRequestSchema:xn,CompleteResultSchema:ta,RootSchema:Sn,ListRootsRequestSchema:ma,ListRootsResultSchema:na,RootsListChangedNotificationSchema:Ga,TaskCreationParamsSchema:Qa,TaskStatusSchema:Xa,TaskSchema:aa,CreateTaskResultSchema:Cn,TaskStatusNotificationParamsSchema:ir,TaskStatusNotificationSchema:ha,GetTaskRequestSchema:Ra,GetTaskResultSchema:ln,GetTaskPayloadRequestSchema:Qn,GetTaskPayloadResultSchema:ja,ListTasksRequestSchema:cn,ListTasksResultSchema:he,CancelTaskRequestSchema:$,CancelTaskResultSchema:m.merge(aa),ClientRequestSchema:Te([U,T,xn,Nt,Ye,fe,_e,De,Y,oe,it,Ut,et,Ra,Qn,cn,$]),ClientNotificationSchema:Te([y,j,z,Ga,ha]),ClientResultSchema:Te([f,ge,At,sn,na,ln,he,Cn]),ServerRequestSchema:Te([U,ve,Ge,ma,Ra,Qn,cn,$]),ServerNotificationSchema:Te([y,j,rn,ct,Fe,rt,Re,ha,kn]),ServerResultSchema:Te([f,F,ta,X,xe,Je,ue,se,It,st,ln,he,Cn]),CallToolResultWireSchema:He().superRefine((ee,pe)=>{if(!(typeof ee!="object"||ee===null||Array.isArray(ee)||ee.content!==void 0)){for(const Me of dw)if(Me in ee){pe.addIssue({code:"custom",message:`content is required when the body carries '${Me}' — another result family cannot default into an empty tools/call success`});return}}}).transform(s4).pipe(It)}}let c4;function pw(){return c4??(c4=l4())}function mw(e){return e.type!=="object"}const u4=new Set(["const","enum","default","examples"]),d4=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function ff(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function p4(e){const t=typeof e.$schema=="string"?e.$schema:void 0;if(ff(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};const a=QI(e.$schema)&&e.$recursiveAnchor!==!0,r=(o,i)=>{if(Array.isArray(o))return o.map(c=>r(c,!1));if(o===null||typeof o!="object"||!i&&ff(o.$id))return o;const s={};let l=!1;for(const[c,u]of Object.entries(o))i?s[c]=r(u,!1):(c==="$ref"||c==="$dynamicRef")&&typeof u=="string"?s[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:c==="$recursiveRef"&&u==="#"&&a?l=!0:u4.has(c)?s[c]=u:d4.has(c)?s[c]=r(u,!0):s[c]=r(u,!1);return l&&("$ref"in s?s.allOf=[...Array.isArray(s.allOf)?s.allOf:[],{$ref:"#/properties/result"}]:s.$ref="#/properties/result"),s};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}const m4={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},h4={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},f4={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};let ss;function dp(){if(ss)return ss;const e=pw();return ss={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},ss}function hw(e){return Object.prototype.hasOwnProperty.call(m4,e)}function fw(e){return Object.prototype.hasOwnProperty.call(h4,e)}function g4(e){return Object.prototype.hasOwnProperty.call(f4,e)}function v4(e){return g4(e)?dp().resultSchemas[e]:void 0}function b4(e){return hw(e)?dp().requestSchemas[e]:void 0}function y4(e){return fw(e)?dp().notificationSchemas[e]:void 0}function wu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ls(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};const a=e.safeParse(t);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}const gf={ok:!1,reason:"not-in-era"};function vf(e){return wu(e)&&wu(e.outputSchema)&&mw(e.outputSchema)}const pp={era:"2025-11-25",hasRequestMethod:hw,hasNotificationMethod:fw,validateRequest:(e,t)=>ls(b4(e),t),validateResult:(e,t)=>ls(v4(e),t),validateNotification:(e,t)=>ls(y4(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>gf,validateInputResponse:()=>gf,samplingResultVariant:((e,t)=>{const a=pw();return ls(e?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){const a=uw(e),r=a.structuredContent;if(r===void 0)return a;const o=typeof r!="object"||r===null||Array.isArray(r),i=t!==void 0&&mw(t);return!o&&!i?a:{...a,structuredContent:{result:r}}},decodeResult(e,t){if(wu(t)&&"resultType"in t){const a={...t};return delete a.resultType,{kind:"complete",result:a}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;const a=t.tools;return!Array.isArray(a)||!a.some(r=>vf(r))?t:{...t,tools:a.map(r=>vf(r)?{...r,outputSchema:p4(r.outputSchema)}:r)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function E4(){const e=zd(()=>Te([R(),be(),Ae(),Ni(),Ne(R(),e),re(e)])),t=Ne(R(),e),a=Te([R(),be().int()]),r=R(),o=Te([R(),be().int()]),i=lt(["user","assistant"]),s=lt(["debug","info","notice","warning","error","critical","alert","emergency"]),l=R().refine(he=>{try{return atob(he),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=B({ttl:be().optional()}),u=B({taskId:R()}),d=Qe({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=B({_meta:d.optional()}),m=p.extend({task:c.optional()}),h=B({_meta:d.optional()}),f=B({method:R(),params:h.loose().optional()}),g=B({src:R(),mimeType:R().optional(),sizes:re(R()).optional(),theme:lt(["light","dark"]).optional()}),y=B({icons:re(g).optional()}),E=B({name:R(),title:R().optional()}),b=E.extend({...E.shape,...y.shape,version:R(),websiteUrl:R().optional(),description:R().optional()}),S=Br(B({applyDefaults:Ae().optional()}),t),w=Ri(he=>he&&typeof he=="object"&&!Array.isArray(he)&&Object.keys(he).length===0?{form:{}}:he,Br(B({form:S.optional(),url:t.optional()}),t.optional())),N=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({sampling:Qe({createMessage:t.optional()}).optional(),elicitation:Qe({create:t.optional()}).optional()}).optional()}),x=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({tools:Qe({call:t.optional()}).optional()}).optional()}),A=B({experimental:Ne(R(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:B({listChanged:Ae().optional()}).optional(),tasks:N.optional(),extensions:Ne(R(),t).optional()}),C=B({experimental:Ne(R(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:Ae().optional()}).optional(),resources:B({subscribe:Ae().optional(),listChanged:Ae().optional()}).optional(),tools:B({listChanged:Ae().optional()}).optional(),tasks:x.optional(),extensions:Ne(R(),t).optional()}),O=B({progress:be(),total:We(be()),message:We(R())}),k=B({...h.shape,...O.shape,progressToken:a}),T=f.extend({method:J("notifications/progress"),params:k}),I=h.extend({level:s,logger:R().optional(),data:He()}),F=f.extend({method:J("notifications/message"),params:I}),z=B({uri:R(),mimeType:We(R()),_meta:Ne(R(),He()).optional()}),U=z.extend({text:R()}),H=z.extend({blob:l}),te=B({audience:re(i).optional(),priority:be().min(0).max(1).optional(),lastModified:yl({offset:!0}).optional()}),j=B({...E.shape,...y.shape,uri:R(),description:We(R()),mimeType:We(R()),size:We(be()),annotations:te.optional(),_meta:We(Qe({}))}),_=B({...E.shape,...y.shape,uriTemplate:R(),description:We(R()),mimeType:We(R()),annotations:te.optional(),_meta:We(Qe({}))}),P=f.extend({method:J("notifications/resources/list_changed"),params:h.optional()}),G=h.extend({uri:R()}),W=f.extend({method:J("notifications/resources/updated"),params:G}),D=B({name:R(),description:We(R()),required:We(Ae())}),ne=B({...E.shape,...y.shape,description:We(R()),arguments:We(re(D)),_meta:We(Qe({}))}),q=f.extend({method:J("notifications/prompts/list_changed"),params:h.optional()}),Z=B({type:J("text"),text:R(),annotations:te.optional(),_meta:Ne(R(),He()).optional()}),ie=B({type:J("image"),data:l,mimeType:R(),annotations:te.optional(),_meta:Ne(R(),He()).optional()}),ke=B({type:J("audio"),data:l,mimeType:R(),annotations:te.optional(),_meta:Ne(R(),He()).optional()}),me=B({type:J("tool_use"),name:R(),id:R(),input:Ne(R(),He()),_meta:Ne(R(),He()).optional()}),_e=B({type:J("resource"),resource:Te([U,H]),annotations:te.optional(),_meta:Ne(R(),He()).optional()}),Je=j.extend({type:J("resource_link")}),De=Te([Z,ie,ke,Je,_e]),ue=B({role:i,content:De}),ye=B({title:R().optional(),readOnlyHint:Ae().optional(),destructiveHint:Ae().optional(),idempotentHint:Ae().optional(),openWorldHint:Ae().optional()}),M=f.extend({method:J("notifications/tools/list_changed"),params:h.optional()}),Y=B({name:R().optional()}),se=B({hints:re(Y).optional(),costPriority:be().min(0).max(1).optional(),speedPriority:be().min(0).max(1).optional(),intelligencePriority:be().min(0).max(1).optional()}),Fe=B({mode:lt(["auto","required","none"]).optional()}),je=B({type:J("boolean"),title:R().optional(),description:R().optional(),default:Ae().optional()}),oe=B({type:J("string"),title:R().optional(),description:R().optional(),minLength:be().optional(),maxLength:be().optional(),format:lt(["email","uri","date","date-time"]).optional(),default:R().optional()}),Ze=B({type:lt(["number","integer"]),title:R().optional(),description:R().optional(),minimum:be().optional(),maximum:be().optional(),default:be().optional()}),it=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),default:R().optional()}),zt=B({type:J("string"),title:R().optional(),description:R().optional(),oneOf:re(B({const:R(),title:R()})),default:R().optional()}),ct=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),enumNames:re(R()).optional(),default:R().optional()}),qt=Te([it,zt]),le=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({type:J("string"),enum:re(R())}),default:re(R()).optional()}),fe=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({anyOf:re(B({const:R(),title:R()}))}),default:re(R()).optional()}),xe=Te([le,fe]),ze=Te([ct,qt,xe]),Ye=Te([ze,je,oe,Ze]),ht=m.extend({mode:J("form").optional(),message:R(),requestedSchema:B({type:J("object"),properties:Ne(R(),Ye),required:re(R()).optional()}).catchall(He())}),bt=B({type:J("ref/resource"),uri:R()}),ft=B({type:J("ref/prompt"),name:R()}),Ce=B({uri:R().startsWith("file://"),name:R().optional(),_meta:Ne(R(),He()).optional()}),gt=A.shape,Et=B({experimental:gt.experimental,sampling:gt.sampling,elicitation:gt.elicitation,roots:gt.roots,extensions:gt.extensions}),vt=C.shape,at=B({experimental:vt.experimental,logging:vt.logging,completions:vt.completions,prompts:vt.prompts,resources:vt.resources,tools:vt.tools,extensions:vt.extensions}),X=Qe({progressToken:a.optional(),[El]:R(),[Ld]:b.optional(),[wl]:Et,[Dd]:s.optional()}),Re=B({...E.shape,...y.shape,description:R().optional(),inputSchema:Qe({$schema:R().optional(),type:J("object")}),outputSchema:Qe({$schema:R().optional()}).optional(),annotations:ye.optional(),_meta:Ne(R(),He()).optional()}),ae=B({type:J("tool_result"),toolUseId:R(),content:re(De),structuredContent:He().optional(),isError:Ae().optional(),_meta:Ne(R(),He()).optional()}),Le=Te([Z,ie,ke,me,ae]),Oe=B({role:i,content:Te([Le,re(Le)]),_meta:Ne(R(),He()).optional()}),et=R(),st=Qe({[bi]:b.optional().catch(void 0)}),It=st.optional();function xt(he){return Qe({_meta:It,resultType:et.default("complete"),...he})}const Ut=xt({}),rt=xt({nextCursor:r.optional()}),Xe=xt({content:re(De),structuredContent:He().optional(),isError:Ae().optional()}),$e=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),tools:re(Re),nextCursor:r.optional()}),Nt=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),prompts:re(ne),nextCursor:r.optional()}),Zt=xt({description:R().optional(),messages:re(ue)}),rn=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resources:re(j),nextCursor:r.optional()}),In=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resourceTemplates:re(_),nextCursor:r.optional()}),yn=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),contents:re(Te([U,H]))}),Fn=xt({completion:B({values:re(R()).max(100),total:be().int().optional(),hasMore:Ae().optional()}).loose()}),Gn=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"])}),An=xt({ttlMs:be().int().min(0).catch(0),cacheScope:lt(["public","private"]).catch("private"),supportedVersions:re(R()),capabilities:at,instructions:R().optional()}),Jt=B({messages:re(Oe),modelPreferences:se.optional(),systemPrompt:R().optional(),includeContext:lt(["none","thisServer","allServers"]).optional(),temperature:be().optional(),maxTokens:be().int(),stopSequences:re(R()).optional(),metadata:t.optional(),tools:re(Re).optional(),toolChoice:Fe.optional()}),dn=B({method:J("sampling/createMessage"),params:Jt}),ut=B({method:J("roots/list"),params:B({_meta:Ne(R(),He()).optional()}).optional()}),ve=B({...Oe.shape,model:R(),stopReason:R().optional()}),ge=B({roots:re(Ce)}),At=B({action:lt(["accept","decline","cancel"]),content:Ne(R(),Te([R(),be(),Ae(),re(R())])).optional()}),Ot=B({mode:J("url"),message:R(),url:R().url()}),Kt=Te([ht,Ot]),Q=B({method:J("elicitation/create"),params:Kt}),Yt=Te([dn,ut,Q]),En=Te([ve,ge,At]),qn=Ne(R(),Yt),pn=Ne(R(),En),wn=xt({inputRequests:qn.optional(),requestState:R().optional()}),mn={inputResponses:pn.optional(),requestState:R().optional()},_n=B({_meta:X,...mn}),on=Qe({progressToken:a.optional()});function pt(he,$){return B({method:J(he),params:B({_meta:X,...$})})}function mt(he,$){return B({method:J(he),params:B({_meta:on.optional(),...$}).optional()})}const V={name:R(),arguments:Ne(R(),He()).optional(),...mn},we={cursor:r.optional()},Ge=pt("tools/call",V),Dt=pt("tools/list",we),kn=pt("prompts/list",we),sn=pt("prompts/get",{name:R(),arguments:Ne(R(),R()).optional(),...mn}),Ca=pt("resources/list",we),Na=pt("resources/templates/list",we),pa=pt("resources/read",{uri:R(),...mn}),xn={ref:Te([ft,bt]),argument:B({name:R(),value:R()}),context:B({arguments:Ne(R(),R()).optional()}).optional()},ta=pt("completion/complete",xn),Sn=pt("server/discover",{}),ma=B({toolsListChanged:Ae().optional(),promptsListChanged:Ae().optional(),resourcesListChanged:Ae().optional(),resourceSubscriptions:re(R()).optional()}),na={notifications:ma},Ga=pt("subscriptions/listen",na),Qa=st.extend({"io.modelcontextprotocol/subscriptionId":o}),Xa=Qe({_meta:Qa,resultType:et.default("complete")}),aa={"tools/call":mt("tools/call",V),"tools/list":mt("tools/list",we),"prompts/get":mt("prompts/get",{name:R(),arguments:Ne(R(),R()).optional()}),"prompts/list":mt("prompts/list",we),"resources/list":mt("resources/list",we),"resources/templates/list":mt("resources/templates/list",we),"resources/read":mt("resources/read",{uri:R()}),"completion/complete":mt("completion/complete",xn),"server/discover":mt("server/discover",{}),"subscriptions/listen":mt("subscriptions/listen",na)};function Cn(he){return Qe({_meta:It,...he})}const ir={"tools/call":Cn({content:re(De),structuredContent:He().optional(),isError:Ae().optional()}),"tools/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),tools:re(Re),nextCursor:r.optional()}),"prompts/get":Cn({description:R().optional(),messages:re(ue)}),"prompts/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),prompts:re(ne),nextCursor:r.optional()}),"resources/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resources:re(j),nextCursor:r.optional()}),"resources/templates/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resourceTemplates:re(_),nextCursor:r.optional()}),"resources/read":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),contents:re(Te([U,H]))}),"completion/complete":Cn({completion:B({values:re(R()).max(100),total:be().int().optional(),hasMore:Ae().optional()}).loose()}),"server/discover":Cn({ttlMs:be().int().min(0).catch(0),cacheScope:lt(["public","private"]).catch("private"),supportedVersions:re(R()),capabilities:at,instructions:R().optional()}),"subscriptions/listen":Cn({})},ha=Qe({"io.modelcontextprotocol/subscriptionId":o.optional()}),Ra=B({method:J("notifications/subscriptions/acknowledged"),params:B({_meta:ha.optional(),notifications:ma})}),ln=B({_meta:ha.optional(),requestId:o,reason:R().optional()}),Qn=B({method:J("notifications/cancelled"),params:ln}),ja={"notifications/cancelled":Qn,"notifications/progress":T,"notifications/message":F,"notifications/resources/updated":W,"notifications/resources/list_changed":P,"notifications/tools/list_changed":M,"notifications/prompts/list_changed":q,"notifications/subscriptions/acknowledged":Ra},cn=he=>B({jsonrpc:J("2.0"),id:Te([R(),be().int()]),result:he}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:a,CursorSchema:r,RequestIdSchema:o,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:m,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:g,IconsSchema:y,BaseMetadataSchema:E,ImplementationSchema:b,ClientTasksCapabilitySchema:N,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:A,ServerCapabilitiesSchema:C,ProgressSchema:O,ProgressNotificationParamsSchema:k,ProgressNotificationSchema:T,LoggingMessageNotificationParamsSchema:I,LoggingMessageNotificationSchema:F,ResourceContentsSchema:z,TextResourceContentsSchema:U,BlobResourceContentsSchema:H,AnnotationsSchema:te,ResourceSchema:j,ResourceTemplateSchema:_,ResourceListChangedNotificationSchema:P,ResourceUpdatedNotificationParamsSchema:G,ResourceUpdatedNotificationSchema:W,PromptArgumentSchema:D,PromptSchema:ne,PromptListChangedNotificationSchema:q,TextContentSchema:Z,ImageContentSchema:ie,AudioContentSchema:ke,ToolUseContentSchema:me,EmbeddedResourceSchema:_e,ResourceLinkSchema:Je,ContentBlockSchema:De,PromptMessageSchema:ue,ToolAnnotationsSchema:ye,ToolListChangedNotificationSchema:M,ModelHintSchema:Y,ModelPreferencesSchema:se,ToolChoiceSchema:Fe,BooleanSchemaSchema:je,StringSchemaSchema:oe,NumberSchemaSchema:Ze,UntitledSingleSelectEnumSchemaSchema:it,TitledSingleSelectEnumSchemaSchema:zt,LegacyTitledEnumSchemaSchema:ct,SingleSelectEnumSchemaSchema:qt,UntitledMultiSelectEnumSchemaSchema:le,TitledMultiSelectEnumSchemaSchema:fe,MultiSelectEnumSchemaSchema:xe,EnumSchemaSchema:ze,PrimitiveSchemaDefinitionSchema:Ye,ElicitRequestFormParamsSchema:ht,ResourceTemplateReferenceSchema:bt,PromptReferenceSchema:ft,RootSchema:Ce,ClientCapabilities2026Schema:Et,ServerCapabilities2026Schema:at,RequestMetaEnvelopeSchema:X,ToolSchema:Re,ToolResultContentSchema:ae,SamplingMessageContentBlockSchema:Le,SamplingMessageSchema:Oe,ResultTypeSchema:et,ResultMetaSchema:st,ResultSchema:Ut,PaginatedResultSchema:rt,CallToolResultSchema:Xe,ListToolsResultSchema:$e,ListPromptsResultSchema:Nt,GetPromptResultSchema:Zt,ListResourcesResultSchema:rn,ListResourceTemplatesResultSchema:In,ReadResourceResultSchema:yn,CompleteResultSchema:Fn,CacheableResultSchema:Gn,DiscoverResultSchema:An,CreateMessageRequestParamsSchema:Jt,CreateMessageRequestSchema:dn,ListRootsRequestSchema:ut,CreateMessageResultSchema:ve,ListRootsResultSchema:ge,ElicitResultSchema:At,ElicitRequestURLParamsSchema:Ot,ElicitRequestParamsSchema:Kt,ElicitRequestSchema:Q,InputRequestSchema:Yt,InputResponseSchema:En,InputRequestsSchema:qn,InputResponsesSchema:pn,InputRequiredResultSchema:wn,InputResponseRequestParamsSchema:_n,CallToolRequestSchema:Ge,ListToolsRequestSchema:Dt,ListPromptsRequestSchema:kn,GetPromptRequestSchema:sn,ListResourcesRequestSchema:Ca,ListResourceTemplatesRequestSchema:Na,ReadResourceRequestSchema:pa,CompleteRequestSchema:ta,DiscoverRequestSchema:Sn,SubscriptionFilterSchema:ma,SubscriptionsListenRequestSchema:Ga,SubscriptionsListenResultMetaSchema:Qa,SubscriptionsListenResultSchema:Xa,dispatchRequestSchemas:aa,dispatchResultSchemas:ir,NotificationMetaSchema:ha,SubscriptionsAcknowledgedNotificationSchema:Ra,CancelledNotificationParamsSchema:ln,CancelledNotificationSchema:Qn,notificationSchemas2026:ja,JSONRPCResultResponseSchema:cn(Ut),CallToolResultResponseSchema:cn(Te([Xe,wn])),ListToolsResultResponseSchema:cn($e),ListPromptsResultResponseSchema:cn(Nt),GetPromptResultResponseSchema:cn(Te([Zt,wn])),ListResourcesResultResponseSchema:cn(rn),ListResourceTemplatesResultResponseSchema:cn(In),ReadResourceResultResponseSchema:cn(Te([yn,wn])),CompleteResultResponseSchema:cn(Fn),DiscoverResultResponseSchema:cn(An)}}let w4;function Vr(){return w4??(w4=E4())}const k4=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function x4(e){return k4.includes(e)}const mp=Symbol("modelcontextprotocol.resultCacheHintFallback");function S4(e){return e[mp]}function gw(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function vw(e){return e==="public"||e==="private"}let wt=(function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({});var Lr,Zn=(Lr=class extends Error{static[Symbol.hasInstance](t){return Qs(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qs(this,t)}constructor(t,a,r){super(a),this.code=t,this.data=r,this.name="ProtocolError",cw(this,new.target)}static fromError(t,a,r){if(t===wt.UrlElicitationRequired&&r){const o=r;if(o.elicitations)return new N4(o.elicitations,a)}if(t===wt.UnsupportedProtocolVersion&&r){const o=r;if(Array.isArray(o.supported)&&typeof o.requested=="string")return new R4({supported:o.supported,requested:o.requested},a)}if(t===wt.InvalidParams||t===wt.ResourceNotFound){const o=r;if(typeof(o==null?void 0:o.uri)=="string"&&(t===wt.ResourceNotFound||Object.keys(o).length===1))return new C4(o.uri,a)}if(t===wt.MissingRequiredClientCapability&&r){const o=r;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities=="object"&&!Array.isArray(o.requiredCapabilities))return new T4({requiredCapabilities:o.requiredCapabilities},a)}return new Lr(t,a,r)}},Object.defineProperty(Lr,"mcpBrand",{value:"mcp.ProtocolError"}),Lr),lo,C4=(lo=class extends Zn{constructor(t,a=`Resource not found: ${t}`){super(wt.InvalidParams,a,{uri:t})}get uri(){return this.data.uri}},Object.defineProperty(lo,"mcpBrand",{value:"mcp.ResourceNotFoundError"}),lo),co,N4=(co=class extends Zn{constructor(t,a=`URL elicitation${t.length>1?"s":""} required`){super(wt.UrlElicitationRequired,a,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}},Object.defineProperty(co,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"}),co),uo,R4=(uo=class extends Zn{constructor(t,a=`Unsupported protocol version: ${t.requested}`){super(wt.UnsupportedProtocolVersion,a,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Object.defineProperty(uo,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"}),uo),po,T4=(po=class extends Zn{constructor(t,a=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(wt.MissingRequiredClientCapability,a,t)}get requiredCapabilities(){return this.data.requiredCapabilities}},Object.defineProperty(po,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"}),po);const I4=0,A4="private",_4=["tools/call","prompts/get","resources/read"];function P4(e,t){const a=t.resultType;if(a===void 0)return{...t,resultType:"complete"};if(a==="complete"||_4.includes(e))return t;throw new Zn(wt.InternalError,`Handler for ${e} returned resultType '${String(a)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function O4(e,t){const a=S4(t);if(t.resultType!=="complete"||!x4(e))return a===void 0?t:F4(t);const r=t,o=gw(r.ttlMs)?r.ttlMs:L4(a),i=vw(r.cacheScope)?r.cacheScope:D4(a),s={...r,ttlMs:o,cacheScope:i};return delete s[mp],s}function M4(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function z4(e,t){if(t===void 0)return e;const a=e._meta;return a===void 0?{...e,_meta:{[bi]:t}}:!M4(a)||a[bi]!==void 0?e:{...e,_meta:{...a,[bi]:t}}}function L4(e){return e!==void 0&&gw(e.ttlMs)?e.ttlMs:I4}function D4(e){return e!==void 0&&vw(e.cacheScope)?e.cacheScope:A4}function F4(e){const t={...e};return delete t[mp],t}const q4=["elicitation/create","sampling/createMessage","roots/list"];let cs;function bw(){if(cs)return cs;const e=Vr();return cs={request:{"elicitation/create":B({method:J("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":B({method:J("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":B({method:J("roots/list"),params:Qe({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},cs}function yw(e){return q4.includes(e)}function kc(e){return yw(e)?bw().request[e]:void 0}function U4(e){return yw(e)?bw().response[e]:void 0}const Ew={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},j4={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ww(e){return Object.prototype.hasOwnProperty.call(Ew,e)}function kw(e){return Object.prototype.hasOwnProperty.call(j4,e)}function $4(e){return Object.prototype.hasOwnProperty.call(Ew,e)}function B4(e){return ww(e)?Vr().dispatchRequestSchemas[e]:void 0}function H4(e){return $4(e)?Vr().dispatchResultSchemas[e]:void 0}function V4(e){return kw(e)?Vr().notificationSchemas2026[e]:void 0}function yi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xo(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};const a=e.safeParse(t);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}const W4={ok:!1,reason:"not-in-era"},Z4=[El,wl];function J4(e,t){let a=t,r=!1;const o=()=>(r||(a={...a},r=!0),a),i=t.tools;e==="tools/list"&&Array.isArray(i)&&i.some(l=>yi(l)&&"execution"in l)&&(o().tools=i.map(l=>{if(!yi(l)||!("execution"in l))return l;const c={...l};return delete c.execution,c}));const s=t.capabilities;if(yi(s)&&"tasks"in s){const l={...s};delete l.tasks,o().capabilities=l}return a}const hp={era:"2026-07-28",hasRequestMethod:ww,hasNotificationMethod:kw,hasInputRequestMethod:e=>kc(e)!==void 0,validateRequest:(e,t)=>Xo(B4(e),t),validateResult:(e,t)=>Xo(H4(e),t),validateNotification:(e,t)=>Xo(V4(e),t),validateInputRequest:(e,t)=>Xo(kc(e),t),validateInputResponse:(e,t)=>Xo(U4(e),t),samplingResultVariant:()=>W4,outboundEnvelope(e){return{[El]:e.protocolVersion,[Ld]:e.clientInfo,[wl]:e.clientCapabilities,...e.logLevel!==void 0&&{[Dd]:e.logLevel}}},validateEnvelopeMeta(e){const t=[];for(const r of Z4)r in e||t.push({key:r,problem:"missing"});const a=Vr().RequestMetaEnvelopeSchema.safeParse(e);if(!a.success)for(const r of a.error.issues){const o=r.path.map(String),i=o.length>0?o.join("."):"_meta";o.length===1&&t.some(s=>s.key===i&&s.problem==="missing")||t.push({key:i,problem:r.message})}return t},projectCallToolResult:e=>uw(e),inputRequestSchema:kc,decodeResult(e,t){if(!yi(t))return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};const a=t.resultType;if(a===void 0)return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof a!="string")return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:a})};if(a==="input_required"){const s=t.inputRequests,l=yi(s)?s:{},c=t.requestState;return Object.keys(l).length===0&&typeof c!="string"?{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:l,...typeof c=="string"&&{requestState:c}}}if(a!=="complete")return{kind:"invalid",error:new Mn(Wn.UnsupportedResultType,`Unsupported result type '${a}' for ${e}`,{resultType:a,method:e})};const r=K4(),o=Object.hasOwn(r,e)?r[e]:void 0;if(o!==void 0){const s=o.safeParse(t);if(!s.success)return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: ${s.error}`,{method:e})}}const i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,a){return z4(O4(e,P4(e,J4(e,t))),a)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";const t=Vr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(a=>a.message).join("; ")}`}};let us;function K4(){if(us)return us;const e=Vr();return us={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},us}const xw="2026-07-28";function Xs(e){return e!==void 0&&i4(e)?hp:pp}function bf(e){return e.revision!==void 0?Xs(e.revision).era:e.era==="modern"?hp.era:pp.era}function xc(e){return Sw.some(t=>t.hasRequestMethod(e))}function Sc(e){return Sw.some(t=>t.hasNotificationMethod(e))}const Sw=[pp,hp];var Y4=JI({AnnotationsSchema:()=>Jr,AudioContentSchema:()=>Il,BaseMetadataSchema:()=>Hr,BaseRequestParamsSchema:()=>Yn,BlobResourceContentsSchema:()=>Gd,BooleanSchemaSchema:()=>rp,CallToolRequestParamsSchema:()=>xE,CallToolRequestSchema:()=>SE,CallToolResultSchema:()=>_l,CancelTaskRequestSchema:()=>BM,CancelTaskResultSchema:()=>HM,CancelledNotificationParamsSchema:()=>Ty,CancelledNotificationSchema:()=>Hd,ClientCapabilitiesSchema:()=>Py,ClientNotificationSchema:()=>WM,ClientRequestSchema:()=>VM,ClientResultSchema:()=>ZM,ClientTasksCapabilitySchema:()=>Ay,CompatibilityCallToolResultSchema:()=>PM,CompleteRequestParamsSchema:()=>YE,CompleteRequestSchema:()=>GE,CompleteResultSchema:()=>QE,ContentBlockSchema:()=>Do,CreateMessageRequestParamsSchema:()=>zE,CreateMessageRequestSchema:()=>LE,CreateMessageResultSchema:()=>DE,CreateMessageResultWithToolsSchema:()=>FE,CreateTaskResultSchema:()=>zM,CursorSchema:()=>qd,DiscoverRequestSchema:()=>Dy,DiscoverResultSchema:()=>Fy,ElicitRequestFormParamsSchema:()=>Ol,ElicitRequestParamsSchema:()=>BE,ElicitRequestSchema:()=>HE,ElicitRequestURLParamsSchema:()=>$E,ElicitResultSchema:()=>ZE,ElicitationCompleteNotificationParamsSchema:()=>VE,ElicitationCompleteNotificationSchema:()=>WE,EmbeddedResourceSchema:()=>ep,EmptyResultSchema:()=>Cl,EnumSchemaSchema:()=>jE,GetPromptRequestParamsSchema:()=>mE,GetPromptRequestSchema:()=>hE,GetPromptResultSchema:()=>vE,GetTaskPayloadRequestSchema:()=>qM,GetTaskPayloadResultSchema:()=>UM,GetTaskRequestSchema:()=>DM,GetTaskResultSchema:()=>FM,IconSchema:()=>Iy,IconsSchema:()=>Po,ImageContentSchema:()=>Tl,ImplementationSchema:()=>Oo,InitializeRequestParamsSchema:()=>Oy,InitializeRequestSchema:()=>My,InitializeResultSchema:()=>zy,InitializedNotificationSchema:()=>Ly,JSONArraySchema:()=>TM,JSONObjectSchema:()=>fn,JSONRPCErrorResponseSchema:()=>Sl,JSONRPCMessageSchema:()=>Ry,JSONRPCNotificationSchema:()=>Bd,JSONRPCRequestSchema:()=>$d,JSONRPCResponseSchema:()=>IM,JSONRPCResultResponseSchema:()=>xl,JSONValueSchema:()=>So,LegacyTitledEnumSchemaSchema:()=>sp,ListChangedOptionsBaseSchema:()=>OM,ListPromptsRequestSchema:()=>dE,ListPromptsResultSchema:()=>pE,ListResourceTemplatesRequestSchema:()=>Vy,ListResourceTemplatesResultSchema:()=>Wy,ListResourcesRequestSchema:()=>By,ListResourcesResultSchema:()=>Hy,ListRootsRequestSchema:()=>ew,ListRootsResultSchema:()=>tw,ListTasksRequestSchema:()=>jM,ListTasksResultSchema:()=>$M,ListToolsRequestSchema:()=>wE,ListToolsResultSchema:()=>kE,LoggingLevelSchema:()=>np,LoggingMessageNotificationParamsSchema:()=>TE,LoggingMessageNotificationSchema:()=>ap,ModelHintSchema:()=>IE,ModelPreferencesSchema:()=>AE,MultiSelectEnumSchemaSchema:()=>UE,NotificationSchema:()=>da,NotificationsParamsSchema:()=>ua,NumberSchemaSchema:()=>Gs,PaginatedRequestParamsSchema:()=>jy,PaginatedRequestSchema:()=>Mo,PaginatedResultSchema:()=>zo,PingRequestSchema:()=>Wd,PrimitiveSchemaDefinitionSchema:()=>up,ProgressNotificationParamsSchema:()=>Uy,ProgressNotificationSchema:()=>Zd,ProgressSchema:()=>qy,ProgressTokenSchema:()=>Fd,PromptArgumentSchema:()=>cE,PromptListChangedNotificationSchema:()=>bE,PromptMessageSchema:()=>gE,PromptReferenceSchema:()=>KE,PromptSchema:()=>uE,ReadResourceRequestParamsSchema:()=>Zy,ReadResourceRequestSchema:()=>Jy,ReadResourceResultSchema:()=>Ky,RelatedTaskMetadataSchema:()=>Ny,RequestIdSchema:()=>Zr,RequestMetaSchema:()=>Ud,RequestSchema:()=>vn,ResourceContentsSchema:()=>Jd,ResourceLinkSchema:()=>tp,ResourceListChangedNotificationSchema:()=>Yy,ResourceRequestParamsSchema:()=>Nl,ResourceSchema:()=>Qd,ResourceTemplateReferenceSchema:()=>JE,ResourceTemplateSchema:()=>$y,ResourceUpdatedNotificationParamsSchema:()=>sE,ResourceUpdatedNotificationSchema:()=>lE,ResultMetaObjectSchema:()=>jd,ResultSchema:()=>bn,RoleSchema:()=>Lo,RootSchema:()=>XE,RootsListChangedNotificationSchema:()=>nw,SamplingContentSchema:()=>OE,SamplingMessageContentBlockSchema:()=>Ti,SamplingMessageSchema:()=>ME,ServerCapabilitiesSchema:()=>Vd,ServerNotificationSchema:()=>KM,ServerRequestSchema:()=>JM,ServerResultSchema:()=>YM,ServerTasksCapabilitySchema:()=>_y,SetLevelRequestParamsSchema:()=>NE,SetLevelRequestSchema:()=>RE,SingleSelectEnumSchemaSchema:()=>qE,StringSchemaSchema:()=>Pl,SubscribeRequestParamsSchema:()=>Gy,SubscribeRequestSchema:()=>Qy,SubscriptionFilterSchema:()=>Xd,SubscriptionsAcknowledgedNotificationParamsSchema:()=>aE,SubscriptionsAcknowledgedNotificationSchema:()=>rE,SubscriptionsListenRequestParamsSchema:()=>tE,SubscriptionsListenRequestSchema:()=>nE,SubscriptionsListenResultMetaSchema:()=>oE,SubscriptionsListenResultSchema:()=>iE,TaskAugmentedRequestParamsSchema:()=>Wi,TaskCreationParamsSchema:()=>MM,TaskMetadataSchema:()=>Cy,TaskSchema:()=>Fo,TaskStatusNotificationParamsSchema:()=>rw,TaskStatusNotificationSchema:()=>LM,TaskStatusSchema:()=>aw,TextContentSchema:()=>Rl,TextResourceContentsSchema:()=>Kd,TitledMultiSelectEnumSchemaSchema:()=>cp,TitledSingleSelectEnumSchemaSchema:()=>ip,ToolAnnotationsSchema:()=>yE,ToolChoiceSchema:()=>_E,ToolExecutionSchema:()=>EE,ToolListChangedNotificationSchema:()=>CE,ToolResultContentSchema:()=>PE,ToolSchema:()=>Al,ToolUseContentSchema:()=>fE,UnsubscribeRequestParamsSchema:()=>Xy,UnsubscribeRequestSchema:()=>eE,UntitledMultiSelectEnumSchemaSchema:()=>lp,UntitledSingleSelectEnumSchemaSchema:()=>op});const G4=e=>$d.safeParse(e).success,Q4=e=>Bd.safeParse(e).success,yf=e=>xl.safeParse(e).success,X4=e=>Sl.safeParse(e).success,Cc=-32020;wt.InvalidRequest,wt.UnsupportedProtocolVersion,wt.InvalidParams,wt.MethodNotFound,wt.InvalidParams,wt.MissingRequiredClientCapability;wt.ParseError+"",wt.InvalidRequest+"",wt.MethodNotFound+"",wt.UnsupportedProtocolVersion+"",wt.MissingRequiredClientCapability+"";function Cw(e,t){return dy(e,t)}function ei(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function ku(e){var a;if(e==null)return!1;const t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof((a=e["~standard"])==null?void 0:a.validate)=="function"}let Ef=!1;const xu="draft-2020-12";function ez(e,t="input"){const a=e["~standard"];let r;if(a.jsonSchema)r=a.jsonSchema[t]({target:xu});else if(a.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");Ef||(Ef=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=uy(e,{target:xu,io:t})}else throw new Error(`Schema library "${a.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return r.type!==void 0?r:Nw(r)?{type:"object",...r}:r;if(r.type!==void 0&&r.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}function Nw(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(const t of["oneOf","anyOf","allOf"]){const a=e[t];if(Array.isArray(a)&&a.length>0)return a.every(r=>r!==null&&typeof r=="object"&&(r.type==="object"||Nw(r)))}return!1}function tz(e){var t;return(t=e.path)!=null&&t.length?`${e.path.map(a=>String(typeof a=="object"?a.key:a)).join(".")}: ${e.message}`:e.message}async function Nc(e,t){const a=await e["~standard"].validate(t);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(r=>tz(r)).join(", ")}:{success:!0,data:a.value}}function nz(e){const t=uy(e,{target:xu,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}const az=/\\\.\\d\{(\d+)\}/;function rz(e){const t=az.exec(e),a=[void 0,-1,0];return t&&a.push(Number(t[1])),[!1,!0].flatMap(r=>[!1,!0].flatMap(o=>a.map(i=>yl({local:r,offset:o,precision:i}))))}function oz(e,t){let a;switch(e){case"email":a=[AO()];break;case"uri":a=[vy()];break;case"date":a=[kM()];break;case"date-time":a=rz(t);break}return new Set(a.map(r=>nz(r)).filter(r=>r!==void 0))}function iz(e,t,a){return a!=="zod"?!0:oz(e,t).has(t)}function Ii(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sz(e){try{return ez(e,"input")}catch(t){const a=t instanceof Error?t.message:String(t);throw new Zn(wt.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${a}`)}}const lz=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function fp(e){return lz.has(e)||e.startsWith("x-")}const cz=new Set(["$schema",...Object.keys(Ol.shape.requestedSchema.shape)]),wf={string:ei([Pl,op,ip,sp]),number:ei([Gs]),integer:ei([Gs]),boolean:ei([rp]),array:ei([lp,cp])},uz=new Set(Pl.shape.format.unwrap().options);function dz(e,t,a,r){if(!Ii(e))return e;const o=typeof e.type=="string"&&Object.hasOwn(wf,e.type)?wf[e.type]:void 0;if(o===void 0)return e;const i={};for(const[s,l]of Object.entries(e))o.has(s)||fp(s)?i[s]=l:s==="pattern"&&e.type==="string"&&typeof e.format=="string"?uz.has(e.format)?(typeof l!="string"||!iz(e.format,l,a))&&r.push(`${t}.${s}`):i[s]=l:r.push(`${t}.${s}`);return i}function pz(e,t){const a={},r=[];for(const[o,i]of Object.entries(e))o==="properties"&&Ii(i)?a[o]=Object.fromEntries(Object.entries(i).map(([s,l])=>[s,dz(l,`properties.${s}`,t,r)])):cz.has(o)?a[o]=i:fp(o)||r.push(o);if(r.length>0)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return a}function mz(e,t){if(!Ii(e.properties))return t;const a=Object.entries(e.properties).filter(([,r])=>!Cw(up,r).success).map(([r])=>`properties.${r}`);return a.length>0?a.join(", "):t}function Su(e,t,a=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((r,o)=>Su(r,t[o],`${a}[${o}]`)):!Ii(e)||!Ii(t)?[]:Object.entries(e).flatMap(([r,o])=>{const i=a?`${a}.${r}`:r;return Object.prototype.hasOwnProperty.call(t,r)?Su(o,t[r],i):fp(r)?[]:[i]})}function hz(e){if(!ku(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};const t=e.requestedSchema["~standard"].vendor,a=pz(sz(e.requestedSchema),t),r=Cw(Ol.shape.requestedSchema,a);if(!r.success)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${mz(a,r.error.message)}`);const o=Su(a,r.data);if(o.length>0)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);const i=(r.data.required??[]).filter(s=>!Object.prototype.hasOwnProperty.call(r.data.properties,s));if(i.length>0)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function fz(e){const t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,a=typeof e.requestState=="string";if(!t&&!a)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(fz,{elicit(e){try{return{method:"elicitation/create",params:hz(e)}}catch(t){throw t instanceof Zn?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});const gz=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],vz={IdJagTokenExchangeResponseSchema:e4,OAuthClientInformationFullSchema:n4,OAuthClientInformationSchema:lw,OAuthClientMetadataSchema:sw,OAuthClientRegistrationErrorSchema:a4,OAuthErrorResponseSchema:t4,OAuthMetadataSchema:ow,OAuthProtectedResourceMetadataSchema:GM,OAuthTokenRevocationRequestSchema:r4,OAuthTokensSchema:XM,OpenIdProviderDiscoveryMetadataSchema:QM,OpenIdProviderMetadataSchema:iw},Rw={},Tw={};function Iw(e,t){const a=e.slice(0,-6);Rw[a]=t,Tw[a]=r=>t.safeParse(r).success}for(const e of gz)Iw(e,Y4[e]);for(const[e,t]of Object.entries(vz))Iw(e,t);Object.freeze(Rw);Object.freeze(Tw);function bz(e){switch(e){case"initialize":case"notifications/initialized":return Xs(void 0);case"server/discover":return Xs(xw);default:return}}const yz=6e4,Ez=[El,Ld,wl,Dd],wz=["inputResponses","requestState"];function kf(e,t){const a=e.params;if(!Rc(a))return{message:e,lifted:{}};const r=a._meta,o=Rc(r)?Ez.filter(c=>c in r):[],i=t==="request"?wz.filter(c=>c in a):[];if(o.length===0&&i.length===0)return{message:e,lifted:{}};const s={},l={...a};if(o.length>0&&Rc(r)){const c={},u={...r};for(const d of o)c[d]=r[d],delete u[d];s.envelope=c,Object.keys(u).length>0?l._meta=u:delete l._meta}for(const c of i)c==="inputResponses"&&(s.inputResponses=l[c]),c==="requestState"&&(s.requestState=l[c]),delete l[c];return{message:{...e,params:l},lifted:s}}function xf(e,t){const a=e.validateResult(t,void 0);if(!(!a.ok&&a.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){const o=e.validateResult(t,r);return o.ok?{value:o.value}:{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function Aw(e){return()=>e}const kz=Aw(void 0);var xz=class{constructor(e){Ke(this,"_transport");Ke(this,"_requestMessageId",0);Ke(this,"_requestHandlers",new Map);Ke(this,"_requestHandlerAbortControllers",new Map);Ke(this,"_notificationHandlers",new Map);Ke(this,"_responseHandlers",new Map);Ke(this,"_progressHandlers",new Map);Ke(this,"_timeoutInfo",new Map);Ke(this,"_pendingDebouncedNotifications",new Set);Ke(this,"_negotiatedProtocolVersion");Ke(this,"_supportedProtocolVersions");Ke(this,"onclose");Ke(this,"onerror");Ke(this,"fallbackRequestHandler");Ke(this,"fallbackNotificationHandler");this._options=e,this._supportedProtocolVersions=(e==null?void 0:e.supportedProtocolVersions)??CM,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){const t=this._outboundMetaEnvelope();if(t===void 0)return e;const a=e.params??{};return{...e,params:{...a,_meta:{...t,...a._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Mn(Wn.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){var t;e.params.requestId&&((t=this._requestHandlerAbortControllers.get(e.params.requestId))==null||t.abort(e.params.reason))}_setupTimeout(e,t,a,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Mn(Wn.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var o,i,s,l;this._transport=e;const t=(o=this.transport)==null?void 0:o.onclose;this._transport.onclose=()=>{try{t==null||t()}finally{this._onclose()}};const a=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=c=>{a==null||a(c),this._onerror(c)};const r=(s=this._transport)==null?void 0:s.onmessage;this._transport.onmessage=(c,u)=>{r==null||r(c,u),yf(c)||X4(c)?this._onresponse(c):G4(c)?this._onrequest(c,u):Q4(c)?this._onnotification(c,u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},(l=e.setSupportedProtocolVersions)==null||l.call(e,this._supportedProtocolVersions),await this._transport.start()}_onclose(){var r;const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(const o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();const t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;const a=new Mn(Wn.ConnectionClosed,"Connection closed");this._transport=void 0;try{(r=this.onclose)==null||r.call(this)}finally{for(const o of e.values())o(a);for(const o of t.values())o.abort(a)}}_onerror(e){var t;(t=this.onerror)==null||t.call(this,e)}_onnotification(e,t){const{message:a}=kf(e,"notification"),r=this._negotiatedWireCodec();if((t==null?void 0:t.classification)===void 0&&this._shouldDropInbound(e)==="drop")return;if((t==null?void 0:t.classification)!==void 0){const s=bf(t.classification);if(s!==r.era){this._onerror(new Error(`Era mismatch on inbound notification '${a.method}': classified as ${s} but this instance serves ${r.era}`));return}}if(Sc(a.method)&&!r.hasNotificationMethod(a.method))return;const o=this._notificationHandlers.get(a.method),i=this.fallbackNotificationHandler;o===void 0&&i===void 0||Promise.resolve().then(()=>o===void 0?i(a):o(a,r)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){var g;const{message:a,lifted:r}=kf(e,"request"),o=this._negotiatedWireCodec();if((t==null?void 0:t.classification)===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}const i=this._transport,s=(y,E,b)=>{const S={jsonrpc:"2.0",id:a.id,error:{code:y,message:E,...b!==void 0&&{data:b}}};i==null||i.send(S).catch(w=>this._onerror(new Error(`Failed to send an error response: ${w}`)))};if((t==null?void 0:t.classification)!==void 0){const y=bf(t.classification);if(y!==o.era){this._onerror(new Error(`Era mismatch on inbound request '${a.method}': classified as ${y} but this instance serves ${o.era}`));const E=t.classification.revision??y;s(wt.UnsupportedProtocolVersion,`Unsupported protocol version: ${E}`,{supported:this._supportedProtocolVersions,requested:E});return}}if(xc(a.method)&&!o.hasRequestMethod(a.method)){s(wt.MethodNotFound,"Method not found");return}const l=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(l===void 0){s(wt.MethodNotFound,"Method not found");return}const c=o.checkInboundEnvelope(r);if(c!==void 0){s(wt.InvalidParams,c);return}const u=(y,E)=>this._notificationViaCodec(this._resolveOutboundCodec(y.method),y,{...E,relatedRequestId:a.id}),d=(y,E,b)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(y.method),y,E,{...b,relatedRequestId:a.id}),p=new AbortController;this._requestHandlerAbortControllers.set(a.id,p);const m=r.inputResponses===void 0?void 0:Sz(r.inputResponses),h={sessionId:i==null?void 0:i.sessionId,mcpReq:{id:a.id,method:a.method,_meta:(g=a.params)==null?void 0:g._meta,...r.envelope!==void 0&&{envelope:r.envelope},...m!==void 0&&{inputResponses:m.accepted},...m!==void 0&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:r.requestState===void 0?kz:Aw(r.requestState),signal:p.signal,send:((y,E,b)=>{const S=this._resolveOutboundCodec(y.method);if(this._assertOutboundRequestInEra(S,y.method),ku(E))return d(y,E,b);const w=xf(S,y.method);if(w===void 0)throw new TypeError(`'${y.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(y,w,E)}),notify:u},http:t!=null&&t.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(h,t);Promise.resolve().then(()=>l(a,f)).then(async y=>{if(p.signal.aborted)return;let E;try{E=o.encodeResult(a.method,y,this._outboundServerInfo())}catch(S){this._onerror(new Error(`Failed to encode result for ${a.method}: ${S}`)),s(wt.InternalError,"Internal error");return}const b={result:E,jsonrpc:"2.0",id:a.id};await(i==null?void 0:i.send(b))},async y=>{if(p.signal.aborted)return;const E=Number.isSafeInteger(y.code)?y.code:wt.InternalError,b={jsonrpc:"2.0",id:a.id,error:{code:o.encodeErrorCode(E),message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};await(i==null?void 0:i.send(b))}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.get(a.id)===p&&this._requestHandlerAbortControllers.delete(a.id)})}_onprogress(e){const{progressToken:t,...a}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const i=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(l);return}o(a)}_onresponse(e){const t=Number(e.id),a=this._responseHandlers.get(t);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),yf(e)?a(e):a(Zn.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){var e;await((e=this._transport)==null?void 0:e.close())}request(e,t,a){const r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),ku(t))return this._requestWithSchemaViaCodec(r,e,t,a);const o=xf(r,e.method);if(o===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,o,t)}_negotiatedWireCodec(){return Xs(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){const t=bz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(xc(t)&&!e.hasRequestMethod(t))throw new Mn(Wn.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,a){const r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,a)}_requestWithSchemaViaCodec(e,t,a,r){const{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,headers:l}=r??{},c=Date.now();let u,d;return new Promise((p,m)=>{var x,A,C,O;const h=k=>{m(k)};if(!this._transport){h(new Error("Not connected"));return}if(((x=this._options)==null?void 0:x.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method)}catch(k){h(k);return}if((A=r==null?void 0:r.signal)!=null&&A.aborted){const k=r.signal.reason;throw k instanceof Mn?k:new Mn(Wn.RequestTimeout,String(k))}const f=e.era===xw&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,g=this._requestMessageId++;d=g;const y={...t,jsonrpc:"2.0",id:g};r!=null&&r.onprogress&&(this._progressHandlers.set(g,r.onprogress),y.params={...t.params,_meta:{...(C=t.params)==null?void 0:C._meta,progressToken:g}});const E=this._envelopeOutbound(y);let b=!1;const S=k=>{var T;b||(this._progressHandlers.delete(g),f===void 0?(T=this._transport)==null||T.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(k)}}),{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))):f.abort(),m(k instanceof Mn?k:new Mn(Wn.RequestTimeout,String(k))))};this._responseHandlers.set(g,k=>{var F;if((F=r==null?void 0:r.signal)!=null&&F.aborted)return;if(b=!0,k instanceof Error)return m(k);let T;try{T=e.decodeResult(t.method,k.result)}catch(z){return m(z instanceof Error?z:new Error(String(z)))}if(T.kind==="invalid")return m(T.error);if(T.kind==="input_required"){if((r==null?void 0:r.allowInputRequired)===!0)return p(Cz(T));const z={codec:e,request:t,resultSchema:a,options:r,flowStartedAt:c,retry:(U,H)=>this._requestWithSchemaViaCodec(e,U===void 0?{method:t.method}:{method:t.method,params:U},a,H)};return p(this._resolveNonCompleteResult(T,z))}const I=T.result;Nc(a,I).then(z=>{z.success?p(z.data):m(new Mn(Wn.InvalidResult,`Invalid result for ${t.method}: ${z.error}`))},m)}),u=()=>{var k;return S((k=r==null?void 0:r.signal)==null?void 0:k.reason)},(O=r==null?void 0:r.signal)==null||O.addEventListener("abort",u,{once:!0});const w=(r==null?void 0:r.timeout)??yz,N=()=>S(new Mn(Wn.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(g,w,r==null?void 0:r.maxTotalTimeout,N,(r==null?void 0:r.resetTimeoutOnProgress)??!1),this._transport.send(E,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,headers:l,requestSignal:f==null?void 0:f.signal}).catch(k=>{this._progressHandlers.delete(g),m(k)})}).finally(()=>{var p;u&&((p=r==null?void 0:r.signal)==null||p.removeEventListener("abort",u)),d!==void 0&&(this._responseHandlers.delete(d),this._cleanupTimeout(d))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,a){var o;if(!this._transport)throw new Mn(Wn.NotConnected,"Not connected");if(Sc(t.method)&&!e.hasNotificationMethod(t.method))throw new Mn(Wn.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);const r=this._envelopeOutbound({jsonrpc:"2.0",...t});if((((o=this._options)==null?void 0:o.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(a!=null&&a.relatedRequestId)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var i;this._pendingDebouncedNotifications.delete(t.method),this._transport&&((i=this._transport)==null||i.send(r,a).catch(s=>this._onerror(s)))});return}await this._transport.send(r,a)}setRequestHandler(e,t,a){this.assertRequestHandlerCapability(e);let r;if(typeof t=="function"){if(!xc(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(o,i)=>{const s=this._negotiatedWireCodec();let l=s.validateRequest(e,o);if(!l.ok&&l.reason==="not-in-era"&&(l=s.validateInputRequest(e,o)),!l.ok)throw l.reason==="not-in-era"?new Zn(wt.InternalError,`No wire schema for ${e} in the resolved era`):new Error(l.message);return Promise.resolve(t(l.value,i))}}else if(a)r=async(o,i)=>{const s=await Nc(t.params,{...o.params});if(!s.success)throw new Zn(wt.InvalidParams,`Invalid params for ${e}: ${s.error}`);return a(s.data,i)};else throw new TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,a){if(typeof t=="function"){if(!Sc(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,o)=>{const i=o.validateNotification(e,r);if(!i.ok)throw i.reason==="not-in-era"?new Zn(wt.InternalError,`No wire schema for ${e} in the resolved era`):new Error(i.message);return Promise.resolve(t(i.value))});return}if(!a)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async r=>{const o=await Nc(t.params,{...r.params});if(!o.success)throw new Zn(wt.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await a(o.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Rc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Sf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Sz(e){const t={},a=[];if(!Sf(e))return{accepted:t,droppedKeys:a};for(const[r,o]of Object.entries(e)){if(!Sf(o)||"method"in o||"result"in o){a.push(r);continue}t[r]=o}return{accepted:t,droppedKeys:a}}function Cz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}/*! +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const p=d[1];if(t===d[0]){i(d);continue}if(e.external){const h=(c=e.external.registry.get(d[0]))==null?void 0:c.id;if(t!==d[0]&&h){i(d);continue}}if((u=e.metadataRegistry.get(d[0]))==null?void 0:u.id){i(d);continue}if(p.cycle){i(d);continue}p.count>1&&e.reused==="ref"&&i(d)}e.external&&(e.sharedDefsExtractedFor=e.external)}function _b(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const a=[];for(const r of t){if(!r||typeof r!="object")return;_b(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const i=r.type;for(const s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;a.includes(s)||a.push(s)}}delete e.anyOf,e.type=a.length===1?a[0]:a}const Pb=new Set(["type","properties","required","additionalProperties"]),tf=["oneOf","anyOf"];function nf(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function hu(e){var i;const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const l in s)if(!Pb.has(l))return null;t.push(s)}const a={},r=new Set;for(const s of t){for(const l in s.properties){if(Object.prototype.hasOwnProperty.call(a,l))continue;const c=[];for(const d of t){const p=((i=d.properties)==null?void 0:i[l])??nf(d);p!=null&&(c.some(m=>JSON.stringify(m)===JSON.stringify(p))||c.push(p))}const u=c.length===1?c[0]:hu(c)??{allOf:c};Ua(a,l,u)}for(const l of s.required??[])r.add(l)}const o={type:"object",properties:a};if(r.size&&(o.required=[...r]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{const s=[];for(const l of t){const c=nf(l);c&&!s.some(u=>JSON.stringify(u)===JSON.stringify(c))&&s.push(c)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function KP(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of Pb)if(o in e)return;const a=t.filter(o=>tf.some(i=>Array.isArray(o[i])));let r=null;if(!a.length)r=hu(t);else{const o=a[0],i=tf.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;const s=t.filter(c=>c!==o),l=o[i].map(c=>hu([...s,c]));if(l.some(c=>!c))return;r={[i]:l}}r&&(delete e.allOf,vi(e,r))}function Js(e,t){var l,c,u,d;const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const m=e.seen.get(p);if(m.ref===null)return;const h=m.def??m.schema,f={...h},g=m.ref;if(m.ref=null,g){r(g);const y=e.seen.get(g),b=y.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(b)):vi(h,b),vi(h,f),p._zod.parent===g)for(const w in h)w==="$ref"||w==="allOf"||w in f||delete h[w];if(b.$ref&&y.def)for(const w in h)w==="$ref"||w==="allOf"||w in y.def&&JSON.stringify(h[w])===JSON.stringify(y.def[w])&&delete h[w]}const E=p._zod.parent;if(E&&E!==g){r(E);const y=e.seen.get(E);if(y!=null&&y.schema.$ref&&(h.$ref=y.schema.$ref,y.def))for(const b in h)b==="$ref"||b==="allOf"||b in y.def&&JSON.stringify(h[b])===JSON.stringify(y.def[b])&&delete h[b]}e.override({zodSchema:p,jsonSchema:h,path:m.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const p of[...e.seen.entries()].reverse())r(p[0]);if(e.target!=="openapi-3.0")for(const p of e.seen.entries())_b(p[1].def??p[1].schema);for(const p of e.deferred)p();if(e.intersections.length){const p=new Map;for(const m of e.seen.values())for(const h of[m.schema,m.def]){const f=h==null?void 0:h.allOf;if(!Array.isArray(f))continue;const g=p.get(f);g?g.push(h):p.set(f,[h])}for(const m of e.intersections)for(const h of p.get(m)??[])KP(h)}}const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(l=e.external)!=null&&l.uri){const p=(c=e.external.registry.get(t))==null?void 0:c.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}vi(o,a.defId?a.schema:a.def??a.schema);const i=(u=e.metadataRegistry.get(t))==null?void 0:u.id;i!==void 0&&o.id===i&&delete o.id;const s=((d=e.external)==null?void 0:d.defs)??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const p of e.seen.entries()){const m=p[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,Ua(s,m.defId,m.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ks(t,"input",e.processors),output:Ks(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Vn(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Vn(r.element,a);if(r.type==="set")return Vn(r.valueType,a);if(r.type==="lazy")return Vn(r.getter(),a);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return Vn(r.innerType,a);if(r.type==="intersection")return Vn(r.left,a)||Vn(r.right,a);if(r.type==="record"||r.type==="map")return Vn(r.keyType,a)||Vn(r.valueType,a);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Vn(r.in,a)||Vn(r.out,a);if(r.type==="object"){for(const o in r.shape)if(Vn(r.shape[o],a))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Vn(o,a))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Vn(o,a))return!0;return!!(r.rest&&Vn(r.rest,a))}return!1}const YP=(e,t={})=>a=>{const r=Ws({...a,processors:t});return Ht(e,r),Zs(r,e),Js(r,e)},Ks=(e,t,a={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=Ws({...o??{},target:i,io:t,processors:a});return Ht(e,s),Zs(s,e),Js(s,e)},wo=(e,t,a)=>{(e[t]===void 0||a>e[t])&&(e[t]=a)},ko=(e,t,a)=>{(e[t]===void 0||a{wo(e,"minimum",t),ko(e,"maximum",t)},Ob=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Mb=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},zb=(e,t)=>{e.mime=e.mime?e.mime.filter(a=>t.includes(a)):[...t]},Lb=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},rf=(e,t)=>wo(e,"minimum",t.minimum),of=(e,t)=>ko(e,"maximum",t.maximum),sf=e=>(t,a)=>{Lb(t,a.format);const[r,o]=e[a.format];wo(t,"minimum",r),ko(t,"maximum",o)},wc={greater_than:(e,t)=>wo(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ko(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ob(e,t.value),number_format:sf(tb),bigint_format:sf(c2),min_length:rf,max_length:of,length_equals:(e,t)=>af(e,t.length),min_size:rf,max_size:of,size_equals:(e,t)=>af(e,t.size),string_format:(e,t)=>{Lb(e,t.format),t.pattern&&Mb(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>zb(e,t.mime)};function Ea(e){var i;const t={},a=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...a.checks??[]]:a.checks??[];for(const s of r)(i=wc[s._zod.def.check])==null||i.call(wc,t,s._zod.def);const o=e._zod.bag;o.minimum!==void 0&&wo(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&wo(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&ko(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&ko(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Ob(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&zb(t,o.mime);for(const s of o.patterns??[])Mb(t,s);return t}const GP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},QP=new Map([[gb,uA],[Ad,dA]]),Db=e=>QP.get(e)??e,Fb=(e,t,a,r)=>{const o=a;o.type="string";const{minimum:i,maximum:s,format:l,patterns:c,contentEncoding:u,laxFormat:d}=Ea(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),l&&(o.format=GP[l]??l,o.format===""&&delete o.format,(l==="time"||d)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const p=[...c].map(Db);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},qb=(e,t,a,r)=>{const o=a,{minimum:i,maximum:s,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u,isInt:d}=Ea(e);o.type=d?"integer":"number";const p=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p?h?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?h?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),l){const f=new Set;for(const y of l)Number.isFinite(y)&&y!==0?f.add(Math.abs(y)):Tn(e,t,o,r,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);const[g,...E]=f;g!==void 0&&(o.multipleOf=g),E.length&&(o.allOf=[...o.allOf??[],...E.map(y=>({multipleOf:y}))])}},Ub=(e,t,a,r)=>{a.type="boolean"},XP=(e,t,a,r)=>{Tn(e,t,a,r,"BigInt cannot be represented in JSON Schema")},eO=(e,t,a,r)=>{Tn(e,t,a,r,"Symbols cannot be represented in JSON Schema")},jb=(e,t,a,r)=>{t.target==="openapi-3.0"?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},$b=(e,t,a,r)=>{Tn(e,t,a,r,"Undefined cannot be represented in JSON Schema")},tO=(e,t,a,r)=>{Tn(e,t,a,r,"Void cannot be represented in JSON Schema")},Bb=(e,t,a,r)=>{a.not={}},Hb=(e,t,a,r)=>{},Vb=(e,t,a,r)=>{},nO=(e,t,a,r)=>{Tn(e,t,a,r,"Date cannot be represented in JSON Schema")},Wb=(e,t,a,r)=>{const o=e._zod.def,i=cu(o.entries);if(i.length===0){a.not={};return}i.every(s=>typeof s=="number")&&(a.type="number"),i.every(s=>typeof s=="string")&&(a.type="string"),a.enum=i},Zb=(e,t,a,r)=>{const o=e._zod.def;if(o.values.length===0){a.not={};return}const i=[];for(const s of o.values)if(s===void 0){if(Tn(e,t,a,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Tn(e,t,a,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];a.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?a.enum=[s]:a.const=s}else i.every(s=>typeof s=="number")&&(a.type="number"),i.every(s=>typeof s=="string")&&(a.type="string"),i.every(s=>typeof s=="boolean")&&(a.type="boolean"),i.every(s=>s===null)&&(a.type="null"),a.enum=i},aO=(e,t,a,r)=>{Tn(e,t,a,r,"NaN cannot be represented in JSON Schema")},rO=(e,t,a,r)=>{const o=a,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},oO=(e,t,a,r)=>{const o=a;o.type="string",o.format="binary",o.contentEncoding="binary";const{minimum:i,maximum:s,mime:l}=Ea(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),l&&(l.length===0?o.not={}:l.length===1?o.contentMediaType=l[0]:o.anyOf=l.map(c=>({contentMediaType:c})))},iO=(e,t,a,r)=>{a.type="boolean"},Jb=(e,t,a,r)=>{Tn(e,t,a,r,"Custom types cannot be represented in JSON Schema")},sO=(e,t,a,r)=>{Tn(e,t,a,r,"Function types cannot be represented in JSON Schema")},Kb=(e,t,a,r)=>{Tn(e,t,a,r,"Transforms cannot be represented in JSON Schema")},lO=(e,t,a,r)=>{Tn(e,t,a,r,"Map cannot be represented in JSON Schema")},cO=(e,t,a,r)=>{Tn(e,t,a,r,"Set cannot be represented in JSON Schema")},Yb=(e,t,a,r)=>{const o=a,i=e._zod.def,{minimum:s,maximum:l}=Ea(e);typeof s=="number"&&(o.minItems=s),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Ht(i.element,t,{...r,path:[...r.path,"items"]})};function xo(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?xo(t.out):t.type==="catch"?xo(t.innerType):e._zod.optin}const Gb=(e,t,a,r)=>{var d;const o=a,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Tn(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const p in s)Ua(o.properties,p,Ht(s[p],t,{...r,path:[...r.path,"properties",p]}));const c=new Set(Object.keys(s)),u=new Set([...c].filter(p=>{const m=i.shape[p];return t.io==="input"?xo(m)===void 0:m._zod.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((d=i.catchall)==null?void 0:d._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ht(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},uO=(e,t,a,r)=>{const o=a,i=e._zod.def;if(Object.getOwnPropertySymbols(i.shape).length&&Tn(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;if(t.io==="output"){for(const l in i.shape)if(Vn(i.shape[l])&&Tn(e,t,o,r,`z.properties() returns its input, so the output of a transforming schema at key "${l}" cannot be represented in JSON Schema`))return}o.type="object",o.properties={};for(const l in i.shape)Ua(o.properties,l,Ht(i.shape[l],t,{...r,path:[...r.path,"properties",l]}));const s=Object.keys(i.shape).filter(l=>xo(i.shape[l])===void 0);s.length>0&&(o.required=s)},Qb=(e,t,a,r)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((l,c)=>Ht(l,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?a.oneOf=s:a.anyOf=s},Xb=(e,t,a,r)=>{const o=e._zod.def,i=Ht(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=Ht(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(i)?i.allOf:[i],...l(s)?s.allOf:[s]];a.allOf=c,t.intersections.push(c)},dO=(e,t,a,r)=>{const o=a,i=e._zod.def;o.type="array";const s=t.target==="draft-2020-12"?"prefixItems":"items",l=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((g,E)=>Ht(g,t,{...r,path:[...r.path,s,E]})),u=i.rest?Ht(i.rest,t,{...r,path:[...r.path,l,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;let d=i.items.length;for(;d>0;){const g=i.items[d-1];if(!(t.io==="input"?xo(g)!==void 0:g._zod.optout==="optional"))break;d--}const p=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,m?o.items=!1:u&&(o.items=u),d>0&&(o.minItems=d),m&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),d>0&&(o.minItems=d),m&&(o.maxItems=p)):(o.items=c,m?o.additionalItems=!1:u&&(o.additionalItems=u),d>0&&(o.minItems=d),m&&(o.maxItems=p));const{minimum:h,maximum:f}=Ea(e);typeof h=="number"&&(o.minItems=h),typeof f=="number"&&(o.maxItems=f)};function fu(e,t,a){var f;if(t.$ref){if(a.has(t))return t;a.add(t);const g=(f=e.get(t))==null?void 0:f.def;if(!g)return t;const E=fu(e,g,a);return E===g?t:E}for(const g of["anyOf","oneOf"]){const E=t[g];if(!Array.isArray(E))continue;const y=E.map(b=>fu(e,b,a));y.some((b,S)=>b!==E[S])&&(t={...t,[g]:y})}const r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!(i!=null&&i.some(g=>typeof g=="number")))return t;const{minimum:s,maximum:l,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:d,format:p,id:m,...h}=t;return h.enum?h.enum=h.enum.map(g=>typeof g=="number"?String(g):g):typeof h.const=="number"&&(h.const=String(h.const)),o&&(h.type="string",i||(h.pattern=(r.includes("number")?Rd:yA).source)),h}const gu=new WeakMap;function pO(e){var r;const t=new Map;for(const o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);const a=new Map;for(const o of gu.get(e)??[]){const i=e.seen.get(o),s=(r=(i==null?void 0:i.def)??(i==null?void 0:i.schema))==null?void 0:r.propertyNames;if(!s||s===!0||a.has(s))continue;const l=fu(t,s,new Set);l!==s&&a.set(s,l)}if(a.size)for(const o of e.seen.values())for(const i of[o.schema,o.def]){const s=i&&a.get(i.propertyNames);s&&(i.propertyNames=s)}}const ey=(e,t,a,r)=>{const o=a,i=e._zod.def;o.type="object";const s=i.keyType,l=Ea(s).patterns;if(i.mode==="loose"&&l&&l.size>0){const d=Ht(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const p of l)Ua(o.patternProperties,Db(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=Ht(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let d=gu.get(t);d||(d=[],gu.set(t,d),t.deferred.push(()=>pO(t))),d.push(e)}o.additionalProperties=Ht(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const c=s._zod.values,u=t.io==="input"&&xo(i.valueType)!==void 0;if(c&&!i.partial&&!u){const d=[...c].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(o.required=d.map(String))}},ty=(e,t,a,r)=>{const o=e._zod.def,i=Ht(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,a.nullable=!0):a.anyOf=[i,{type:"null"}]},ny=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},_d=Symbol();function ay(e,t,a,r,o){let i=!1;const s=JSON.stringify(e,(l,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(Tn(t,a,r,o,"BigInt defaults cannot be represented in JSON Schema"),_d):JSON.parse(s)}const ry=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;const s=ay(o.defaultValue,e,t,a,r);s!==_d&&(a.default=s)},oy=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;const s=ay(o.defaultValue,e,t,a,r);s!==_d&&(a._prefault=s)},iy=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Tn(e,t,a,r,"Dynamic catch values are not supported in JSON Schema");return}a.default=s},sy=(e,t,a,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;Ht(s,t,r);const l=t.seen.get(e);l.ref=s},ly=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,a.readOnly=!0},mO=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Pd=(e,t,a,r)=>{const o=e._zod.def;Ht(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},cy=(e,t,a,r)=>{const o=e._zod.innerType;Ht(o,t,r);const i=t.seen.get(e);i.ref=o},lf={string:Fb,number:qb,boolean:Ub,bigint:XP,symbol:eO,null:jb,undefined:$b,void:tO,never:Bb,any:Hb,unknown:Vb,date:nO,enum:Wb,literal:Zb,nan:aO,template_literal:rO,file:oO,success:iO,custom:Jb,properties:uO,function:sO,transform:Kb,map:lO,set:cO,array:Yb,object:Gb,union:Qb,intersection:Xb,tuple:dO,record:ey,nullable:ty,nonoptional:ny,default:ry,prefault:oy,catch:iy,pipe:sy,readonly:ly,promise:mO,optional:Pd,lazy:cy};function uy(e,t){if("_idmap"in e){const r=e,o=Ws({...t,processors:lf}),i={};for(const c of r._idmap.entries()){const[u,d]=c;Ht(d,o)}const s={},l={registry:r,uri:t==null?void 0:t.uri,defs:i};o.external=l;for(const c of r._idmap.entries()){const[u,d]=c;Zs(o,d),Ua(s,u,Js(o,d))}if(Object.keys(i).length>0){const c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}const a=Ws({...t,processors:lf});return Ht(e,a),Zs(a,e),Js(a,e)}const cf=new WeakSet([Object.prototype,Error.prototype]);function os(e,t,a){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=a(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const hO=(e,t)=>{_2.init(e,t),e.name="ZodError";const a=Object.getPrototypeOf(e);cf.has(a)||(cf.add(a),os(a,"format",r=>o=>M2(r,o)),os(a,"flatten",r=>o=>O2(r,o)),os(a,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,uu,2)}),os(a,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,uu,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},za=ce("ZodError",hO,void 0,{Parent:Error}),fO=xd(za),gO=Sd(za),dy=Cd(za),vO=Nd(za),bO=U2(za),yO=j2(za),EO=$2(za),wO=B2(za),kO=H2(za),xO=V2(za),SO=W2(za),CO=Z2(za);function NO(){qa.localeError||Ka(X_())}function bl(){qa.memoizer||Ka({memoizer:Y_()})}const Wt=ce("ZodType",(e,t)=>(NO(),Vt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(ya(t,{checks:[...t.checks??[],...e.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return xr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(yM(e,t))},superRefine(e,t){return this.check(EM(e,t))},overwrite(e){return this.check(_o(e))},optional(){return We(this)},exactOptional(){return oM(this)},nullable(){return pf(this)},nullish(){return We(pf(this))},nonoptional(e){return dM(this,e)},array(){return re(this)},or(e){return Te([this,e])},and(e){return Br(this,e)},transform(e){return mf(this,Ey(e))},default(e){return lM(this,e)},prefault(e){return uM(this,e)},catch(e){return mM(this,e)},pipe(e){return mf(this,e)},readonly(){return gM(this)},describe(e){const t=this.clone();return ci.add(t,{description:e}),t},meta(...e){if(e.length===0)return ci.get(this);const t=this.clone();return ci.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ab(this,"~standard",{...db(this),jsonSchema:{input:Ks(this,"input"),output:Ks(this,"output")}})},set"~standard"(e){wr(this,"~standard",e)},parse:function e(t,a){return fO(this,t,a,{callee:e})},parseAsync:async function e(t,a){return await gO(this,t,a,{callee:e})},safeParse(e,t){return dy(this,e,t)},async safeParseAsync(e,t){return vO(this,e,t)},get spa(){return this==null?void 0:this.safeParseAsync},set spa(e){wr(this,"spa",e)},validate(e,t){return D2(this,e,t)},validateAsync(e,t){return q2(this,e,t)},encode:function e(t,a){return bO(this,t,a,{callee:e})},decode:function e(t,a){return yO(this,t,a,{callee:e})},encodeAsync:async function e(t,a){return await EO(this,t,a,{callee:e})},decodeAsync:async function e(t,a){return await wO(this,t,a,{callee:e})},safeEncode(e,t){return kO(this,e,t)},safeDecode(e,t){return xO(this,e,t)},async safeEncodeAsync(e,t){return SO(this,e,t)},async safeDecodeAsync(e,t){return CO(this,e,t)},toJSONSchema(e){return YP(this,{})(e)},get description(){var e;return(e=ci.get(this))==null?void 0:e.description},get _def(){return this._zod.def}}),py=ce("_ZodString",(e,t)=>{Id.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Fb(e,a,r)},rb({format:e=>Ea(e).format??null,minLength:e=>Ea(e).minimum??null,maxLength:e=>Ea(e).maximum??null},{regex(...e){return this.check(MP(...e))},includes(...e){return this.check(DP(...e))},startsWith(...e){return this.check(FP(...e))},endsWith(...e){return this.check(qP(...e))},min(...e){return this.check(Vs(...e))},max(...e){return this.check(Ib(...e))},length(...e){return this.check(Ab(...e))},nonempty(...e){return this.check(Vs(1,...e))},lowercase(e){return this.check(zP(e))},uppercase(e){return this.check(LP(e))},trim(){return this.check(jP())},normalize(...e){return this.check(UP(...e))},toLowerCase(){return this.check($P())},toUpperCase(){return this.check(BP())},slugify(){return this.check(HP())}})),RO=ce("ZodString",(e,t)=>{Id.init(e,t),py.init(e,t)},{email(e){return this.check(Cb(fy,e))},url(e){return this.check(Nb(gy,e))},jwt(e){return this.check(kP(WO,e))},emoji(e){return this.check(lP(PO,e))},guid(e){return this.check(aP(_O,e))},uuid(e){return this.check(rP(is,e))},uuidv4(e){return this.check(oP(is,e))},uuidv6(e){return this.check(iP(is,e))},uuidv7(e){return this.check(sP(is,e))},nanoid(e){return this.check(cP(OO,e))},cuid(e){return this.check(uP(MO,e))},cuid2(e){return this.check(dP(zO,e))},ulid(e){return this.check(pP(LO,e))},base64(e){return this.check(yP(BO,e))},base64url(e){return this.check(EP(HO,e))},xid(e){return this.check(mP(DO,e))},ksuid(e){return this.check(hP(FO,e))},ipv4(e){return this.check(fP(qO,e))},ipv6(e){return this.check(gP(UO,e))},cidrv4(e){return this.check(vP(jO,e))},cidrv6(e){return this.check(bP($O,e))},e164(e){return this.check(wP(VO,e))},datetime(e){return this.check(Rb(my,e))},date(e){return this.check(Tb(hy,e))},time(e){return this.check(xP(TO,e))},duration(e){return this.check(SP(IO,e))}});function R(e){return nP(RO,e)}const an=ce("ZodStringFormat",(e,t)=>{tn.init(e,t),py.init(e,t)}),my=ce("ZodISODateTime",(e,t)=>{n_.init(e,t),an.init(e,t)}),hy=ce("ZodISODate",(e,t)=>{a_.init(e,t),an.init(e,t)}),TO=ce("ZodISOTime",(e,t)=>{r_.init(e,t),an.init(e,t)}),IO=ce("ZodISODuration",(e,t)=>{o_.init(e,t),an.init(e,t)}),fy=ce("ZodEmail",(e,t)=>{$A.init(e,t),an.init(e,t)});function AO(e){return Cb(fy,e)}const _O=ce("ZodGUID",(e,t)=>{UA.init(e,t),an.init(e,t)}),is=ce("ZodUUID",(e,t)=>{jA.init(e,t),an.init(e,t)}),gy=ce("ZodURL",(e,t)=>{JA.init(e,t),an.init(e,t)});function vy(e){return Nb(gy,e)}const PO=ce("ZodEmoji",(e,t)=>{KA.init(e,t),an.init(e,t)}),OO=ce("ZodNanoID",(e,t)=>{YA.init(e,t),an.init(e,t)}),MO=ce("ZodCUID",(e,t)=>{GA.init(e,t),an.init(e,t)}),zO=ce("ZodCUID2",(e,t)=>{QA.init(e,t),an.init(e,t)}),LO=ce("ZodULID",(e,t)=>{XA.init(e,t),an.init(e,t)}),DO=ce("ZodXID",(e,t)=>{e_.init(e,t),an.init(e,t)}),FO=ce("ZodKSUID",(e,t)=>{t_.init(e,t),an.init(e,t)}),qO=ce("ZodIPv4",(e,t)=>{i_.init(e,t),an.init(e,t)}),UO=ce("ZodIPv6",(e,t)=>{l_.init(e,t),an.init(e,t)}),jO=ce("ZodCIDRv4",(e,t)=>{c_.init(e,t),an.init(e,t)}),$O=ce("ZodCIDRv6",(e,t)=>{d_.init(e,t),an.init(e,t)}),BO=ce("ZodBase64",(e,t)=>{p_.init(e,t),an.init(e,t)}),HO=ce("ZodBase64URL",(e,t)=>{h_.init(e,t),an.init(e,t)}),VO=ce("ZodE164",(e,t)=>{f_.init(e,t),an.init(e,t)}),WO=ce("ZodJWT",(e,t)=>{v_.init(e,t),an.init(e,t)}),Od=ce("ZodNumber",(e,t)=>{vb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>qb(e,a,r,o),e.isFinite=!0},rb({minValue:e=>{const{minimum:t,exclusiveMinimum:a}=Ea(e);return Math.max(t??Number.NEGATIVE_INFINITY,a??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:a}=Ea(e);return Math.min(t??Number.POSITIVE_INFINITY,a??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:a}=Ea(e);return!!t||!!(a!=null&&a.some(Number.isSafeInteger))},format:e=>Ea(e).format??null},{gt(e,t){return this.check(Qh(e,t))},gte(e,t){return this.check(Ec(e,t))},min(e,t){return this.check(Ec(e,t))},lt(e,t){return this.check(Gh(e,t))},lte(e,t){return this.check(yc(e,t))},max(e,t){return this.check(yc(e,t))},int(e){return this.check(uf(e))},safe(e){return this.check(uf(e))},positive(e){return this.check(Qh(0,e))},nonnegative(e){return this.check(Ec(0,e))},negative(e){return this.check(Gh(0,e))},nonpositive(e){return this.check(yc(0,e))},multipleOf(e,t){return this.check(Xh(e,t))},step(e,t){return this.check(Xh(e,t))},finite(){return this}}));function be(e){return CP(Od,e)}const ZO=ce("ZodNumberFormat",(e,t)=>{b_.init(e,t),Od.init(e,t)});function uf(e){return RP(ZO,e)}const JO=ce("ZodBoolean",(e,t)=>{y_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Ub(e,a,r)});function Ae(e){return TP(JO,e)}const KO=ce("ZodUndefined",(e,t)=>{E_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>$b(e,a,r,o)});function vu(e){return IP(KO,e)}const YO=ce("ZodNull",(e,t)=>{w_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>jb(e,a,r)});function Ni(e){return AP(YO,e)}const GO=ce("ZodAny",(e,t)=>{k_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Hb()});function Md(){return _P(GO)}const QO=ce("ZodUnknown",(e,t)=>{x_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Vb()});function He(){return PP(QO)}const XO=ce("ZodNever",(e,t)=>{S_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Bb(e,a,r)});function bu(e){return OP(XO,e)}const eM=ce("ZodArray",(e,t)=>{bl(),C_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Yb(e,a,r,o),e.element=t.element},{min(e,t){return this.check(Vs(e,t))},nonempty(e){return this.check(Vs(1,e))},max(e,t){return this.check(Ib(e,t))},length(e,t){return this.check(Ab(e,t))},unwrap(){return this.element}});function re(e,t){return VP(eM,e,t)}const by=ce("ZodObject",(e,t)=>{bl(),T_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Gb(e,a,r,o),k2(e,"shape",a=>a._zod.def.shape,!1)},{keyof(){return lt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ya(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ya(this._zod.def,{catchall:He()}))},loose(){return this.clone(ya(this._zod.def,{catchall:He()}))},strict(){return this.clone(ya(this._zod.def,{catchall:bu()}))},strip(){return this.clone(ya(this._zod.def,{catchall:void 0}))},extend(e){return p2(this,e)},safeExtend(e){return m2(this,e)},merge(e){return h2(this,e)},pick(e){return u2(this,e)},omit(e){return d2(this,e)},partial(...e){return Oh(wy,this,e[0])},exactPartial(...e){return Oh(ky,this,e[0],"exactPartial")},required(...e){return f2(xy,this,e[0])}});function B(e,t){const a={type:"object",shape:e??{},...Ve(t)};return new by(a)}function Qe(e,t){return new by({type:"object",shape:e,catchall:He(),...Ve(t)})}const yy=ce("ZodUnion",(e,t)=>{Eb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Qb(e,a,r,o),e.options=t.options});function Te(e,t){return new yy({type:"union",options:e,...Ve(t)})}const tM=ce("ZodDiscriminatedUnion",(e,t)=>{yy.init(e,t),A_.init(e,t)});function Ys(e,t,a){return new tM({type:"union",options:t,discriminator:e,...Ve(a)})}const nM=ce("ZodIntersection",(e,t)=>{__.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Xb(e,a,r,o)});function Br(e,t){return new nM({type:"intersection",left:e,right:t})}const df=ce("ZodRecord",(e,t)=>{bl(),P_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ey(e,a,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ne(e,t,a){return!t||!t._zod?new df({type:"record",keyType:R(),valueType:e,...Ve(t)}):new df({type:"record",keyType:e,valueType:t,...Ve(a)})}const yu=ce("ZodEnum",(e,t)=>{O_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Wb(e,r,o),e.enum=t.entries,e.options=[...e._zod.values];const a=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(a.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new yu({...t,checks:[],...Ve(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(a.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new yu({...t,checks:[],...Ve(o),entries:i})}});function lt(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new yu({type:"enum",entries:a,...Ve(t)})}const aM=ce("ZodLiteral",(e,t)=>{M_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Zb(e,a,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new aM({type:"literal",values:Array.isArray(e)?e:[e],...Ve(t)})}const rM=ce("ZodTransform",(e,t)=>{bl(),z_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Kb(e,a,r,o),e._zod.parse=(a,r)=>{if(r.direction==="backward")throw new ob(e.constructor.name);a.addIssue=i=>{if(typeof i=="string")a.issues.push(Ci(i,a.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=a.value),s.inst??(s.inst=e),a.issues.push(Ci(s))}};const o=t.transform(a.value,a);return o instanceof Promise?o.then(i=>(a.value=i,a)):(a.value=o,a)}});function Ey(e){return new rM({type:"transform",transform:e})}const wy=ce("ZodOptional",(e,t)=>{wb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Pd(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function We(e){return new wy({type:"optional",innerType:e})}const ky=ce("ZodExactOptional",(e,t)=>{L_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Pd(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function oM(e){return new ky({type:"optional",innerType:e})}const iM=ce("ZodNullable",(e,t)=>{D_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ty(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function pf(e){return new iM({type:"nullable",innerType:e})}const sM=ce("ZodDefault",(e,t)=>{F_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ry(e,a,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lM(e,t){return new sM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Xv(t)}})}const cM=ce("ZodPrefault",(e,t)=>{q_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>oy(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function uM(e,t){return new cM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Xv(t)}})}const xy=ce("ZodNonOptional",(e,t)=>{U_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ny(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function dM(e,t){return new xy({type:"nonoptional",innerType:e,...Ve(t)})}const pM=ce("ZodCatch",(e,t)=>{j_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>iy(e,a,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mM(e,t){return new pM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:S2(t)})}const Sy=ce("ZodPipe",(e,t)=>{kb.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>sy(e,a,r,o),e.in=t.in,e.out=t.out});function mf(e,t){return new Sy({type:"pipe",in:e,out:t})}const hM=ce("ZodPreprocess",(e,t)=>{Sy.init(e,t),$_.init(e,t)}),fM=ce("ZodReadonly",(e,t)=>{B_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>ly(e,a,r,o),e.unwrap=()=>e._zod.def.innerType});function gM(e){return new fM({type:"readonly",innerType:e})}const vM=ce("ZodLazy",(e,t)=>{H_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>cy(e,a,r,o),e.unwrap=()=>e._zod.def.getter()});function zd(e){return new vM({type:"lazy",getter:e})}const bM=ce("ZodCustom",(e,t)=>{V_.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,r,o)=>Jb(e,a,r,o)});function yM(e,t={}){return WP(bM,e,t)}function EM(e,t){return ZP(e,t)}function Ri(e,t){return new hM({type:"pipe",in:Ey(e),out:t})}const wM={custom:"custom"};function yl(e){return Rb(my,e)}function kM(e){return Tb(hy,e)}function xM(e){return NP(Od,e)}const SM="2025-11-25",CM=[SM,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],NM="io.modelcontextprotocol/related-task",El="io.modelcontextprotocol/protocolVersion",Ld="io.modelcontextprotocol/clientInfo",bi="io.modelcontextprotocol/serverInfo",wl="io.modelcontextprotocol/clientCapabilities",RM="io.modelcontextprotocol/subscriptionId",Dd="io.modelcontextprotocol/logLevel",kl="2.0",So=zd(()=>Te([R(),be(),Ae(),Ni(),Ne(R(),So),re(So)])),fn=Ne(R(),So),TM=re(So),Fd=Te([R(),be().int()]),qd=R(),Cy=B({ttl:be().optional()}),Ny=B({taskId:R()}),Ud=Qe({progressToken:Fd.optional(),[NM]:Ny.optional()}),Yn=B({_meta:Ud.optional()}),Wi=Yn.extend({task:Cy.optional()}),vn=B({method:R(),params:Yn.loose().optional()}),ua=B({_meta:Ud.optional()}),da=B({method:R(),params:ua.loose().optional()}),jd=Qe({get[bi](){return Oo.optional().catch(void 0)}}),bn=Qe({_meta:jd.optional()}),Zr=Te([R(),be().int()]),$d=B({jsonrpc:J(kl),id:Zr,...vn.shape}).strict(),Bd=B({jsonrpc:J(kl),...da.shape}).strict(),xl=B({jsonrpc:J(kl),id:Zr,result:bn}).strict(),Sl=B({jsonrpc:J(kl),id:Zr.optional(),error:B({code:be().int(),message:R(),data:He().optional()})}).strict(),Ry=Te([$d,Bd,xl,Sl]),IM=Te([xl,Sl]),Cl=bn.strict(),Ty=ua.extend({requestId:Zr.optional(),reason:R().optional()}),Hd=da.extend({method:J("notifications/cancelled"),params:Ty}),Iy=B({src:R(),mimeType:R().optional(),sizes:re(R()).optional(),theme:lt(["light","dark"]).optional()}),Po=B({icons:re(Iy).optional()}),Hr=B({name:R(),title:R().optional()}),Oo=Hr.extend({...Hr.shape,...Po.shape,version:R(),websiteUrl:R().optional(),description:R().optional()}),AM=Br(B({applyDefaults:Ae().optional()}),fn),_M=Ri(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Br(B({form:AM.optional(),url:fn.optional()}),fn.optional())),Ay=Qe({list:fn.optional(),cancel:fn.optional(),requests:Qe({sampling:Qe({createMessage:fn.optional()}).optional(),elicitation:Qe({create:fn.optional()}).optional()}).optional()}),_y=Qe({list:fn.optional(),cancel:fn.optional(),requests:Qe({tools:Qe({call:fn.optional()}).optional()}).optional()}),Py=B({experimental:Ne(R(),fn).optional(),sampling:B({context:fn.optional(),tools:fn.optional()}).optional(),elicitation:_M.optional(),roots:B({listChanged:Ae().optional()}).optional(),tasks:Ay.optional(),extensions:Ne(R(),fn).optional()}),Oy=Yn.extend({protocolVersion:R(),capabilities:Py,clientInfo:Oo}),My=vn.extend({method:J("initialize"),params:Oy}),Vd=B({experimental:Ne(R(),fn).optional(),logging:fn.optional(),completions:fn.optional(),prompts:B({listChanged:Ae().optional()}).optional(),resources:B({subscribe:Ae().optional(),listChanged:Ae().optional()}).optional(),tools:B({listChanged:Ae().optional()}).optional(),tasks:_y.optional(),extensions:Ne(R(),fn).optional()}),zy=bn.extend({protocolVersion:R(),capabilities:Vd,serverInfo:Oo,instructions:R().optional()}),Ly=da.extend({method:J("notifications/initialized"),params:ua.optional()}),Dy=vn.extend({method:J("server/discover"),params:Yn.optional()}),Fy=bn.extend({supportedVersions:re(R()),capabilities:Vd,instructions:R().optional()}),Wd=vn.extend({method:J("ping"),params:Yn.optional()}),qy=B({progress:be(),total:We(be()),message:We(R())}),Uy=B({...ua.shape,...qy.shape,progressToken:Fd}),Zd=da.extend({method:J("notifications/progress"),params:Uy}),jy=Yn.extend({cursor:qd.optional()}),Mo=vn.extend({params:jy.optional()}),zo=bn.extend({nextCursor:qd.optional()}),Jd=B({uri:R(),mimeType:We(R()),_meta:Ne(R(),He()).optional()}),Kd=Jd.extend({text:R()}),Yd=R().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Gd=Jd.extend({blob:Yd}),Lo=lt(["user","assistant"]),Jr=B({audience:re(Lo).optional(),priority:be().min(0).max(1).optional(),lastModified:yl({offset:!0}).optional()}),Qd=B({...Hr.shape,...Po.shape,uri:R(),description:We(R()),mimeType:We(R()),size:We(be()),annotations:Jr.optional(),_meta:We(Qe({}))}),$y=B({...Hr.shape,...Po.shape,uriTemplate:R(),description:We(R()),mimeType:We(R()),annotations:Jr.optional(),_meta:We(Qe({}))}),By=Mo.extend({method:J("resources/list")}),Hy=zo.extend({resources:re(Qd)}),Vy=Mo.extend({method:J("resources/templates/list")}),Wy=zo.extend({resourceTemplates:re($y)}),Nl=Yn.extend({uri:R()}),Zy=Nl,Jy=vn.extend({method:J("resources/read"),params:Zy}),Ky=bn.extend({contents:re(Te([Kd,Gd]))}),Yy=da.extend({method:J("notifications/resources/list_changed"),params:ua.optional()}),Gy=Nl,Qy=vn.extend({method:J("resources/subscribe"),params:Gy}),Xy=Nl,eE=vn.extend({method:J("resources/unsubscribe"),params:Xy}),Xd=B({toolsListChanged:Ae().optional(),promptsListChanged:Ae().optional(),resourcesListChanged:Ae().optional(),resourceSubscriptions:re(R()).optional()}),tE=Yn.extend({notifications:Xd}),nE=vn.extend({method:J("subscriptions/listen"),params:tE}),aE=ua.extend({notifications:Xd}),rE=da.extend({method:J("notifications/subscriptions/acknowledged"),params:aE}),oE=jd.extend({[RM]:Zr}),iE=bn.extend({_meta:oE}),sE=ua.extend({uri:R()}),lE=da.extend({method:J("notifications/resources/updated"),params:sE}),cE=B({name:R(),description:We(R()),required:We(Ae())}),uE=B({...Hr.shape,...Po.shape,description:We(R()),arguments:We(re(cE)),_meta:We(Qe({}))}),dE=Mo.extend({method:J("prompts/list")}),pE=zo.extend({prompts:re(uE)}),mE=Yn.extend({name:R(),arguments:Ne(R(),R()).optional()}),hE=vn.extend({method:J("prompts/get"),params:mE}),Rl=B({type:J("text"),text:R(),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),Tl=B({type:J("image"),data:Yd,mimeType:R(),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),Il=B({type:J("audio"),data:Yd,mimeType:R(),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),fE=B({type:J("tool_use"),name:R(),id:R(),input:Ne(R(),He()),_meta:Ne(R(),He()).optional()}),ep=B({type:J("resource"),resource:Te([Kd,Gd]),annotations:Jr.optional(),_meta:Ne(R(),He()).optional()}),tp=Qd.extend({type:J("resource_link")}),Do=Te([Rl,Tl,Il,tp,ep]),gE=B({role:Lo,content:Do}),vE=bn.extend({description:R().optional(),messages:re(gE)}),bE=da.extend({method:J("notifications/prompts/list_changed"),params:ua.optional()}),yE=B({title:R().optional(),readOnlyHint:Ae().optional(),destructiveHint:Ae().optional(),idempotentHint:Ae().optional(),openWorldHint:Ae().optional()}),EE=B({taskSupport:lt(["required","optional","forbidden"]).optional()}),Al=B({...Hr.shape,...Po.shape,description:R().optional(),inputSchema:B({type:J("object"),properties:Ne(R(),So).optional(),required:re(R()).optional()}).catchall(He()),outputSchema:Qe({$schema:R().optional()}).optional(),annotations:yE.optional(),execution:EE.optional(),_meta:Ne(R(),He()).optional()}),wE=Mo.extend({method:J("tools/list")}),kE=zo.extend({tools:re(Al)}),_l=bn.extend({content:re(Do).default([]),structuredContent:He().optional(),isError:Ae().optional()}),PM=_l.or(bn.extend({toolResult:He()})),xE=Wi.extend({name:R(),arguments:Ne(R(),He()).optional()}),SE=vn.extend({method:J("tools/call"),params:xE}),CE=da.extend({method:J("notifications/tools/list_changed"),params:ua.optional()}),OM=B({autoRefresh:Ae().default(!0),debounceMs:be().int().nonnegative().default(300)}),np=lt(["debug","info","notice","warning","error","critical","alert","emergency"]),NE=Yn.extend({level:np}),RE=vn.extend({method:J("logging/setLevel"),params:NE}),TE=ua.extend({level:np,logger:R().optional(),data:He()}),ap=da.extend({method:J("notifications/message"),params:TE}),IE=B({name:R().optional()}),AE=B({hints:re(IE).optional(),costPriority:be().min(0).max(1).optional(),speedPriority:be().min(0).max(1).optional(),intelligencePriority:be().min(0).max(1).optional()}),_E=B({mode:lt(["auto","required","none"]).optional()}),PE=B({type:J("tool_result"),toolUseId:R().describe("The unique identifier for the corresponding tool call."),content:re(Do),structuredContent:He().optional(),isError:Ae().optional(),_meta:Ne(R(),He()).optional()}),OE=Ys("type",[Rl,Tl,Il]),Ti=Ys("type",[Rl,Tl,Il,fE,PE]),ME=B({role:Lo,content:Te([Ti,re(Ti)]),_meta:Ne(R(),He()).optional()}),zE=Wi.extend({messages:re(ME),modelPreferences:AE.optional(),systemPrompt:R().optional(),includeContext:lt(["none","thisServer","allServers"]).optional(),temperature:be().optional(),maxTokens:be().int(),stopSequences:re(R()).optional(),metadata:fn.optional(),tools:re(Al).optional(),toolChoice:_E.optional()}),LE=vn.extend({method:J("sampling/createMessage"),params:zE}),DE=bn.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens"]).or(R())),role:Lo,content:OE}),FE=bn.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens","toolUse"]).or(R())),role:Lo,content:Te([Ti,re(Ti)])}),rp=B({type:J("boolean"),title:R().optional(),description:R().optional(),default:Ae().optional()}),Pl=B({type:J("string"),title:R().optional(),description:R().optional(),minLength:be().optional(),maxLength:be().optional(),format:lt(["email","uri","date","date-time"]).optional(),default:R().optional()}),Gs=B({type:lt(["number","integer"]),title:R().optional(),description:R().optional(),minimum:be().optional(),maximum:be().optional(),default:be().optional()}),op=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),default:R().optional()}),ip=B({type:J("string"),title:R().optional(),description:R().optional(),oneOf:re(B({const:R(),title:R()})),default:R().optional()}),sp=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),enumNames:re(R()).optional(),default:R().optional()}),qE=Te([op,ip]),lp=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({type:J("string"),enum:re(R())}),default:re(R()).optional()}),cp=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({anyOf:re(B({const:R(),title:R()}))}),default:re(R()).optional()}),UE=Te([lp,cp]),jE=Te([sp,qE,UE]),up=Te([jE,rp,Pl,Gs]),Ol=Wi.extend({mode:J("form").optional(),message:R(),requestedSchema:B({type:J("object"),properties:Ne(R(),up),required:re(R()).optional()}).catchall(He())}),$E=Wi.extend({mode:J("url"),message:R(),elicitationId:R(),url:R().url()}),BE=Te([Ol,$E]),HE=vn.extend({method:J("elicitation/create"),params:BE}),VE=ua.extend({elicitationId:R()}),WE=da.extend({method:J("notifications/elicitation/complete"),params:VE}),ZE=bn.extend({action:lt(["accept","decline","cancel"]),content:Ri(e=>e===null?void 0:e,Ne(R(),Te([R(),be(),Ae(),re(R())])).optional())}),JE=B({type:J("ref/resource"),uri:R()}),KE=B({type:J("ref/prompt"),name:R()}),YE=Yn.extend({ref:Te([KE,JE]),argument:B({name:R(),value:R()}),context:B({arguments:Ne(R(),R()).optional()}).optional()}),GE=vn.extend({method:J("completion/complete"),params:YE}),QE=bn.extend({completion:Qe({values:re(R()).max(100),total:We(be().int()),hasMore:We(Ae())})}),XE=B({uri:R().startsWith("file://"),name:R().optional(),_meta:Ne(R(),He()).optional()}),ew=vn.extend({method:J("roots/list"),params:Yn.optional()}),tw=bn.extend({roots:re(XE)}),nw=da.extend({method:J("notifications/roots/list_changed"),params:ua.optional()}),MM=Qe({ttl:be().optional(),pollInterval:be().optional()}),aw=lt(["working","input_required","completed","failed","cancelled"]),Fo=B({taskId:R(),status:aw,ttl:Te([be(),Ni()]),createdAt:R(),lastUpdatedAt:R(),pollInterval:We(be()),statusMessage:We(R())}),zM=bn.extend({task:Fo}),rw=ua.merge(Fo),LM=da.extend({method:J("notifications/tasks/status"),params:rw}),DM=vn.extend({method:J("tasks/get"),params:Yn.extend({taskId:R()})}),FM=bn.merge(Fo),qM=vn.extend({method:J("tasks/result"),params:Yn.extend({taskId:R()})}),UM=bn.loose(),jM=Mo.extend({method:J("tasks/list")}),$M=zo.extend({tasks:re(Fo)}),BM=vn.extend({method:J("tasks/cancel"),params:Yn.extend({taskId:R()})}),HM=bn.merge(Fo),VM=Te([Wd,My,Dy,GE,RE,hE,dE,By,Vy,Jy,Qy,eE,nE,SE,wE]),WM=Te([Hd,Zd,Ly,nw]),ZM=Te([Cl,DE,FE,ZE,tw]),JM=Te([Wd,LE,HE,ew]),KM=Te([Hd,Zd,ap,lE,Yy,CE,bE,rE,WE]),YM=Te([Cl,zy,Fy,QE,vE,pE,Hy,Wy,Ky,_l,kE,iE]),$n=vy().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wM.custom,message:"URL must be parseable",fatal:!0}),C2}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),GM=Qe({resource:R().url(),authorization_servers:re($n).optional(),jwks_uri:R().url().optional(),scopes_supported:re(R()).optional(),bearer_methods_supported:re(R()).optional(),resource_signing_alg_values_supported:re(R()).optional(),resource_name:R().optional(),resource_documentation:R().optional(),resource_policy_uri:R().url().optional(),resource_tos_uri:R().url().optional(),tls_client_certificate_bound_access_tokens:Ae().optional(),authorization_details_types_supported:re(R()).optional(),dpop_signing_alg_values_supported:re(R()).optional(),dpop_bound_access_tokens_required:Ae().optional()}),ow=Qe({issuer:R(),authorization_endpoint:$n,token_endpoint:$n,registration_endpoint:$n.optional(),scopes_supported:re(R()).optional(),response_types_supported:re(R()),response_modes_supported:re(R()).optional(),grant_types_supported:re(R()).optional(),token_endpoint_auth_methods_supported:re(R()).optional(),token_endpoint_auth_signing_alg_values_supported:re(R()).optional(),service_documentation:$n.optional(),revocation_endpoint:$n.optional(),revocation_endpoint_auth_methods_supported:re(R()).optional(),revocation_endpoint_auth_signing_alg_values_supported:re(R()).optional(),introspection_endpoint:R().optional(),introspection_endpoint_auth_methods_supported:re(R()).optional(),introspection_endpoint_auth_signing_alg_values_supported:re(R()).optional(),code_challenge_methods_supported:re(R()).optional(),client_id_metadata_document_supported:Ae().optional(),authorization_response_iss_parameter_supported:Ae().optional().catch(void 0)}),iw=Qe({issuer:R(),authorization_endpoint:$n,token_endpoint:$n,userinfo_endpoint:$n.optional(),jwks_uri:$n,registration_endpoint:$n.optional(),scopes_supported:re(R()).optional(),response_types_supported:re(R()),response_modes_supported:re(R()).optional(),grant_types_supported:re(R()).optional(),acr_values_supported:re(R()).optional(),subject_types_supported:re(R()),id_token_signing_alg_values_supported:re(R()),id_token_encryption_alg_values_supported:re(R()).optional(),id_token_encryption_enc_values_supported:re(R()).optional(),userinfo_signing_alg_values_supported:re(R()).optional(),userinfo_encryption_alg_values_supported:re(R()).optional(),userinfo_encryption_enc_values_supported:re(R()).optional(),request_object_signing_alg_values_supported:re(R()).optional(),request_object_encryption_alg_values_supported:re(R()).optional(),request_object_encryption_enc_values_supported:re(R()).optional(),token_endpoint_auth_methods_supported:re(R()).optional(),token_endpoint_auth_signing_alg_values_supported:re(R()).optional(),display_values_supported:re(R()).optional(),claim_types_supported:re(R()).optional(),claims_supported:re(R()).optional(),service_documentation:R().optional(),claims_locales_supported:re(R()).optional(),ui_locales_supported:re(R()).optional(),claims_parameter_supported:Ae().optional(),request_parameter_supported:Ae().optional(),request_uri_parameter_supported:Ae().optional(),require_request_uri_registration:Ae().optional(),op_policy_uri:$n.optional(),op_tos_uri:$n.optional(),client_id_metadata_document_supported:Ae().optional(),authorization_response_iss_parameter_supported:Ae().optional().catch(void 0)}),QM=B({...iw.shape,...ow.pick({code_challenge_methods_supported:!0}).shape}),XM=B({access_token:R(),id_token:R().optional(),token_type:R(),expires_in:xM().optional(),scope:R().optional(),refresh_token:R().optional()}).strip(),e4=B({issued_token_type:J("urn:ietf:params:oauth:token-type:id-jag"),access_token:R(),token_type:R().optional(),expires_in:be().optional(),scope:R().optional()}).strip(),t4=B({error:R(),error_description:R().optional(),error_uri:R().optional()}),hf=$n.optional().or(J("").transform(()=>{})),sw=B({redirect_uris:re($n),token_endpoint_auth_method:R().optional(),grant_types:re(R()).optional(),response_types:re(R()).optional(),application_type:R().optional(),client_name:R().optional(),client_uri:$n.optional(),logo_uri:hf,scope:R().optional(),contacts:re(R()).optional(),tos_uri:hf,policy_uri:R().optional(),jwks_uri:$n.optional(),jwks:Md().optional(),software_id:R().optional(),software_version:R().optional(),software_statement:R().optional()}).strip(),lw=B({client_id:R(),client_secret:R().optional(),client_id_issued_at:be().optional(),client_secret_expires_at:be().optional()}).strip(),n4=sw.merge(lw),a4=B({error:R(),error_description:R().optional()}).strip(),r4=B({token:R(),token_type_hint:R().optional()}).strip(),Eu=Symbol.for("mcp.sdk.errorBrands");function cw(e,t){const a=new Set;let r=t;for(;typeof r=="function";){const o=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,"mcpBrand")&&typeof o=="string"&&a.add(o),r=Object.getPrototypeOf(r)}a.size!==0&&Object.defineProperty(e,Eu,{value:a,enumerable:!1,configurable:!0})}function Qs(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,Eu)){const a=t[Eu];if(a&&typeof a.has=="function"&&a.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let Wn=(function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e})({});var so,Mn=(so=class extends Error{static[Symbol.hasInstance](t){return Qs(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qs(this,t)}constructor(t,a,r){super(a),this.code=t,this.data=r,this.name="SdkError",cw(this,new.target)}},Object.defineProperty(so,"mcpBrand",{value:"mcp.SdkError"}),so);const o4="2026-07-28";function i4(e){return e>=o4}function uw(e){var a;const t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(((a=e.content)==null?void 0:a.some(r=>r.type==="text"))??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}const dw=["task","inputRequests","requestState"];function s4(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||dw.some(t=>t in e)?e:{...e,content:[]}}function l4(){const e=zd(()=>Te([R(),be(),Ae(),Ni(),Ne(R(),e),re(e)])),t=Ne(R(),e),a=Te([R(),be().int()]),r=R(),o=B({ttl:be().optional()}),i=B({taskId:R()}),s=Qe({progressToken:a.optional(),"io.modelcontextprotocol/related-task":i.optional()}),l=B({_meta:s.optional()}),c=l.extend({task:o.optional()}),u=B({method:R(),params:l.loose().optional()}),d=B({_meta:s.optional()}),p=B({method:R(),params:d.loose().optional()}),m=Qe({_meta:s.optional()}),h=Te([R(),be().int()]),f=m.strict(),g=d.extend({requestId:h.optional(),reason:R().optional()}),E=p.extend({method:J("notifications/cancelled"),params:g}),y=B({src:R(),mimeType:R().optional(),sizes:re(R()).optional(),theme:lt(["light","dark"]).optional()}),b=B({icons:re(y).optional()}),S=B({name:R(),title:R().optional()}),w=S.extend({...S.shape,...b.shape,version:R(),websiteUrl:R().optional(),description:R().optional()}),N=Br(B({applyDefaults:Ae().optional()}),t),x=Ri(te=>te&&typeof te=="object"&&!Array.isArray(te)&&Object.keys(te).length===0?{form:{}}:te,Br(B({form:N.optional(),url:t.optional()}),t.optional())),A=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({sampling:Qe({createMessage:t.optional()}).optional(),elicitation:Qe({create:t.optional()}).optional()}).optional()}),C=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({tools:Qe({call:t.optional()}).optional()}).optional()}),O=B({experimental:Ne(R(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:x.optional(),roots:B({listChanged:Ae().optional()}).optional(),tasks:A.optional(),extensions:Ne(R(),t).optional()}),k=l.extend({protocolVersion:R(),capabilities:O,clientInfo:w}),T=u.extend({method:J("initialize"),params:k}),I=B({experimental:Ne(R(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:Ae().optional()}).optional(),resources:B({subscribe:Ae().optional(),listChanged:Ae().optional()}).optional(),tools:B({listChanged:Ae().optional()}).optional(),tasks:C.optional(),extensions:Ne(R(),t).optional()}),F=m.extend({protocolVersion:R(),capabilities:I,serverInfo:w,instructions:R().optional()}),z=p.extend({method:J("notifications/initialized"),params:d.optional()}),q=u.extend({method:J("ping"),params:l.optional()}),W=B({progress:be(),total:We(be()),message:We(R())}),X=B({...d.shape,...W.shape,progressToken:a}),U=p.extend({method:J("notifications/progress"),params:X}),_=l.extend({cursor:r.optional()}),P=u.extend({params:_.optional()}),G=m.extend({nextCursor:r.optional()}),Z=B({uri:R(),mimeType:We(R()),_meta:Ne(R(),He()).optional()}),D=Z.extend({text:R()}),ne=R().refine(te=>{try{return atob(te),!0}catch{return!1}},{message:"Invalid Base64 string"}),H=Z.extend({blob:ne}),j=lt(["user","assistant"]),ie=B({audience:re(j).optional(),priority:be().min(0).max(1).optional(),lastModified:yl({offset:!0}).optional()}),Ee=B({...S.shape,...b.shape,uri:R(),description:We(R()),mimeType:We(R()),size:We(be()),annotations:ie.optional(),_meta:We(Qe({}))}),me=B({...S.shape,...b.shape,uriTemplate:R(),description:We(R()),mimeType:We(R()),annotations:ie.optional(),_meta:We(Qe({}))}),_e=P.extend({method:J("resources/list")}),Je=G.extend({resources:re(Ee)}),De=P.extend({method:J("resources/templates/list")}),ue=G.extend({resourceTemplates:re(me)}),ye=l.extend({uri:R()}),M=ye,Y=u.extend({method:J("resources/read"),params:M}),se=m.extend({contents:re(Te([D,H]))}),Fe=p.extend({method:J("notifications/resources/list_changed"),params:d.optional()}),je=ye,oe=u.extend({method:J("resources/subscribe"),params:je}),Ze=ye,it=u.extend({method:J("resources/unsubscribe"),params:Ze}),zt=d.extend({uri:R()}),ct=p.extend({method:J("notifications/resources/updated"),params:zt}),qt=B({name:R(),description:We(R()),required:We(Ae())}),le=B({...S.shape,...b.shape,description:We(R()),arguments:We(re(qt)),_meta:We(Qe({}))}),fe=P.extend({method:J("prompts/list")}),xe=G.extend({prompts:re(le)}),ze=l.extend({name:R(),arguments:Ne(R(),R()).optional()}),Ye=u.extend({method:J("prompts/get"),params:ze}),ht=B({type:J("text"),text:R(),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),bt=B({type:J("image"),data:ne,mimeType:R(),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),ft=B({type:J("audio"),data:ne,mimeType:R(),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),Ce=B({type:J("tool_use"),name:R(),id:R(),input:Ne(R(),He()),_meta:Ne(R(),He()).optional()}),gt=B({type:J("resource"),resource:Te([D,H]),annotations:ie.optional(),_meta:Ne(R(),He()).optional()}),Et=Ee.extend({type:J("resource_link")}),vt=Te([ht,bt,ft,Et,gt]),at=B({role:j,content:vt}),ee=m.extend({description:R().optional(),messages:re(at)}),Re=p.extend({method:J("notifications/prompts/list_changed"),params:d.optional()}),ae=B({title:R().optional(),readOnlyHint:Ae().optional(),destructiveHint:Ae().optional(),idempotentHint:Ae().optional(),openWorldHint:Ae().optional()}),Le=B({taskSupport:lt(["required","optional","forbidden"]).optional()}),Oe=B({...S.shape,...b.shape,description:R().optional(),inputSchema:B({type:J("object"),properties:Ne(R(),e).optional(),required:re(R()).optional()}).catchall(He()),outputSchema:B({type:J("object"),properties:Ne(R(),e).optional(),required:re(R()).optional()}).catchall(He()).optional(),annotations:ae.optional(),execution:Le.optional(),_meta:Ne(R(),He()).optional()}),et=P.extend({method:J("tools/list")}),st=G.extend({tools:re(Oe)}),It=m.extend({content:re(vt),structuredContent:Ne(R(),He()).optional(),isError:Ae().optional()}),xt=c.extend({name:R(),arguments:Ne(R(),He()).optional()}),Ut=u.extend({method:J("tools/call"),params:xt}),rt=p.extend({method:J("notifications/tools/list_changed"),params:d.optional()}),Xe=lt(["debug","info","notice","warning","error","critical","alert","emergency"]),$e=l.extend({level:Xe}),Nt=u.extend({method:J("logging/setLevel"),params:$e}),Zt=d.extend({level:Xe,logger:R().optional(),data:He()}),rn=p.extend({method:J("notifications/message"),params:Zt}),In=B({name:R().optional()}),yn=B({hints:re(In).optional(),costPriority:be().min(0).max(1).optional(),speedPriority:be().min(0).max(1).optional(),intelligencePriority:be().min(0).max(1).optional()}),Fn=B({mode:lt(["auto","required","none"]).optional()}),Gn=B({type:J("tool_result"),toolUseId:R().describe("The unique identifier for the corresponding tool call."),content:re(vt),structuredContent:B({}).loose().optional(),isError:Ae().optional(),_meta:Ne(R(),He()).optional()}),An=Ys("type",[ht,bt,ft]),Jt=Ys("type",[ht,bt,ft,Ce,Gn]),dn=B({role:j,content:Te([Jt,re(Jt)]),_meta:Ne(R(),He()).optional()}),ut=c.extend({messages:re(dn),modelPreferences:yn.optional(),systemPrompt:R().optional(),includeContext:lt(["none","thisServer","allServers"]).optional(),temperature:be().optional(),maxTokens:be().int(),stopSequences:re(R()).optional(),metadata:t.optional(),tools:re(Oe).optional(),toolChoice:Fn.optional()}),ve=u.extend({method:J("sampling/createMessage"),params:ut}),ge=m.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens"]).or(R())),role:j,content:An}),At=m.extend({model:R(),stopReason:We(lt(["endTurn","stopSequence","maxTokens","toolUse"]).or(R())),role:j,content:Te([Jt,re(Jt)])}),Ot=B({type:J("boolean"),title:R().optional(),description:R().optional(),default:Ae().optional()}),Kt=B({type:J("string"),title:R().optional(),description:R().optional(),minLength:be().optional(),maxLength:be().optional(),format:lt(["email","uri","date","date-time"]).optional(),default:R().optional()}),Q=B({type:lt(["number","integer"]),title:R().optional(),description:R().optional(),minimum:be().optional(),maximum:be().optional(),default:be().optional()}),Yt=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),default:R().optional()}),En=B({type:J("string"),title:R().optional(),description:R().optional(),oneOf:re(B({const:R(),title:R()})),default:R().optional()}),qn=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),enumNames:re(R()).optional(),default:R().optional()}),pn=Te([Yt,En]),wn=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({type:J("string"),enum:re(R())}),default:re(R()).optional()}),mn=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({anyOf:re(B({const:R(),title:R()}))}),default:re(R()).optional()}),_n=Te([wn,mn]),on=Te([qn,pn,_n]),pt=Te([on,Ot,Kt,Q]),mt=c.extend({mode:J("form").optional(),message:R(),requestedSchema:B({type:J("object"),properties:Ne(R(),pt),required:re(R()).optional()}).catchall(He())}),V=c.extend({mode:J("url"),message:R(),elicitationId:R(),url:R().url()}),ke=Te([mt,V]),Ge=u.extend({method:J("elicitation/create"),params:ke}),Dt=d.extend({elicitationId:R()}),kn=p.extend({method:J("notifications/elicitation/complete"),params:Dt}),sn=m.extend({action:lt(["accept","decline","cancel"]),content:Ri(te=>te===null?void 0:te,Ne(R(),Te([R(),be(),Ae(),re(R())])).optional())}),Ca=B({type:J("ref/resource"),uri:R()}),Na=B({type:J("ref/prompt"),name:R()}),pa=l.extend({ref:Te([Na,Ca]),argument:B({name:R(),value:R()}),context:B({arguments:Ne(R(),R()).optional()}).optional()}),xn=u.extend({method:J("completion/complete"),params:pa}),ta=m.extend({completion:Qe({values:re(R()).max(100),total:We(be().int()),hasMore:We(Ae())})}),Sn=B({uri:R().startsWith("file://"),name:R().optional(),_meta:Ne(R(),He()).optional()}),ma=u.extend({method:J("roots/list"),params:l.optional()}),na=m.extend({roots:re(Sn)}),Ga=p.extend({method:J("notifications/roots/list_changed"),params:d.optional()}),Qa=Qe({ttl:be().optional(),pollInterval:be().optional()}),Xa=lt(["working","input_required","completed","failed","cancelled"]),aa=B({taskId:R(),status:Xa,ttl:Te([be(),Ni()]),createdAt:R(),lastUpdatedAt:R(),pollInterval:We(be()),statusMessage:We(R())}),Cn=m.extend({task:aa}),ir=d.merge(aa),ha=p.extend({method:J("notifications/tasks/status"),params:ir}),Ra=u.extend({method:J("tasks/get"),params:l.extend({taskId:R()})}),ln=m.merge(aa),Qn=u.extend({method:J("tasks/result"),params:l.extend({taskId:R()})}),ja=m.loose(),cn=P.extend({method:J("tasks/list")}),he=G.extend({tasks:re(aa)}),$=u.extend({method:J("tasks/cancel"),params:l.extend({taskId:R()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:a,CursorSchema:r,TaskMetadataSchema:o,RelatedTaskMetadataSchema:i,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:m,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:E,IconSchema:y,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:w,ClientTasksCapabilitySchema:A,ServerTasksCapabilitySchema:C,ClientCapabilitiesSchema:O,InitializeRequestParamsSchema:k,InitializeRequestSchema:T,ServerCapabilitiesSchema:I,InitializeResultSchema:F,InitializedNotificationSchema:z,PingRequestSchema:q,ProgressSchema:W,ProgressNotificationParamsSchema:X,ProgressNotificationSchema:U,PaginatedRequestParamsSchema:_,PaginatedRequestSchema:P,PaginatedResultSchema:G,ResourceContentsSchema:Z,TextResourceContentsSchema:D,BlobResourceContentsSchema:H,RoleSchema:j,AnnotationsSchema:ie,ResourceSchema:Ee,ResourceTemplateSchema:me,ListResourcesRequestSchema:_e,ListResourcesResultSchema:Je,ListResourceTemplatesRequestSchema:De,ListResourceTemplatesResultSchema:ue,ResourceRequestParamsSchema:ye,ReadResourceRequestParamsSchema:M,ReadResourceRequestSchema:Y,ReadResourceResultSchema:se,ResourceListChangedNotificationSchema:Fe,SubscribeRequestParamsSchema:je,SubscribeRequestSchema:oe,UnsubscribeRequestParamsSchema:Ze,UnsubscribeRequestSchema:it,ResourceUpdatedNotificationParamsSchema:zt,ResourceUpdatedNotificationSchema:ct,PromptArgumentSchema:qt,PromptSchema:le,ListPromptsRequestSchema:fe,ListPromptsResultSchema:xe,GetPromptRequestParamsSchema:ze,GetPromptRequestSchema:Ye,TextContentSchema:ht,ImageContentSchema:bt,AudioContentSchema:ft,ToolUseContentSchema:Ce,EmbeddedResourceSchema:gt,ResourceLinkSchema:Et,ContentBlockSchema:vt,PromptMessageSchema:at,GetPromptResultSchema:ee,PromptListChangedNotificationSchema:Re,ToolAnnotationsSchema:ae,ToolExecutionSchema:Le,ToolSchema:Oe,ListToolsRequestSchema:et,ListToolsResultSchema:st,CallToolResultSchema:It,CallToolRequestParamsSchema:xt,CallToolRequestSchema:Ut,ToolListChangedNotificationSchema:rt,LoggingLevelSchema:Xe,SetLevelRequestParamsSchema:$e,SetLevelRequestSchema:Nt,LoggingMessageNotificationParamsSchema:Zt,LoggingMessageNotificationSchema:rn,ModelHintSchema:In,ModelPreferencesSchema:yn,ToolChoiceSchema:Fn,ToolResultContentSchema:Gn,SamplingContentSchema:An,SamplingMessageContentBlockSchema:Jt,SamplingMessageSchema:dn,CreateMessageRequestParamsSchema:ut,CreateMessageRequestSchema:ve,CreateMessageResultSchema:ge,CreateMessageResultWithToolsSchema:At,BooleanSchemaSchema:Ot,StringSchemaSchema:Kt,NumberSchemaSchema:Q,UntitledSingleSelectEnumSchemaSchema:Yt,TitledSingleSelectEnumSchemaSchema:En,LegacyTitledEnumSchemaSchema:qn,SingleSelectEnumSchemaSchema:pn,UntitledMultiSelectEnumSchemaSchema:wn,TitledMultiSelectEnumSchemaSchema:mn,MultiSelectEnumSchemaSchema:_n,EnumSchemaSchema:on,PrimitiveSchemaDefinitionSchema:pt,ElicitRequestFormParamsSchema:mt,ElicitRequestURLParamsSchema:V,ElicitRequestParamsSchema:ke,ElicitRequestSchema:Ge,ElicitationCompleteNotificationParamsSchema:Dt,ElicitationCompleteNotificationSchema:kn,ElicitResultSchema:sn,ResourceTemplateReferenceSchema:Ca,PromptReferenceSchema:Na,CompleteRequestParamsSchema:pa,CompleteRequestSchema:xn,CompleteResultSchema:ta,RootSchema:Sn,ListRootsRequestSchema:ma,ListRootsResultSchema:na,RootsListChangedNotificationSchema:Ga,TaskCreationParamsSchema:Qa,TaskStatusSchema:Xa,TaskSchema:aa,CreateTaskResultSchema:Cn,TaskStatusNotificationParamsSchema:ir,TaskStatusNotificationSchema:ha,GetTaskRequestSchema:Ra,GetTaskResultSchema:ln,GetTaskPayloadRequestSchema:Qn,GetTaskPayloadResultSchema:ja,ListTasksRequestSchema:cn,ListTasksResultSchema:he,CancelTaskRequestSchema:$,CancelTaskResultSchema:m.merge(aa),ClientRequestSchema:Te([q,T,xn,Nt,Ye,fe,_e,De,Y,oe,it,Ut,et,Ra,Qn,cn,$]),ClientNotificationSchema:Te([E,U,z,Ga,ha]),ClientResultSchema:Te([f,ge,At,sn,na,ln,he,Cn]),ServerRequestSchema:Te([q,ve,Ge,ma,Ra,Qn,cn,$]),ServerNotificationSchema:Te([E,U,rn,ct,Fe,rt,Re,ha,kn]),ServerResultSchema:Te([f,F,ta,ee,xe,Je,ue,se,It,st,ln,he,Cn]),CallToolResultWireSchema:He().superRefine((te,pe)=>{if(!(typeof te!="object"||te===null||Array.isArray(te)||te.content!==void 0)){for(const Me of dw)if(Me in te){pe.addIssue({code:"custom",message:`content is required when the body carries '${Me}' — another result family cannot default into an empty tools/call success`});return}}}).transform(s4).pipe(It)}}let c4;function pw(){return c4??(c4=l4())}function mw(e){return e.type!=="object"}const u4=new Set(["const","enum","default","examples"]),d4=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function ff(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function p4(e){const t=typeof e.$schema=="string"?e.$schema:void 0;if(ff(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};const a=QI(e.$schema)&&e.$recursiveAnchor!==!0,r=(o,i)=>{if(Array.isArray(o))return o.map(c=>r(c,!1));if(o===null||typeof o!="object"||!i&&ff(o.$id))return o;const s={};let l=!1;for(const[c,u]of Object.entries(o))i?s[c]=r(u,!1):(c==="$ref"||c==="$dynamicRef")&&typeof u=="string"?s[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:c==="$recursiveRef"&&u==="#"&&a?l=!0:u4.has(c)?s[c]=u:d4.has(c)?s[c]=r(u,!0):s[c]=r(u,!1);return l&&("$ref"in s?s.allOf=[...Array.isArray(s.allOf)?s.allOf:[],{$ref:"#/properties/result"}]:s.$ref="#/properties/result"),s};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}const m4={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},h4={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},f4={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};let ss;function dp(){if(ss)return ss;const e=pw();return ss={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},ss}function hw(e){return Object.prototype.hasOwnProperty.call(m4,e)}function fw(e){return Object.prototype.hasOwnProperty.call(h4,e)}function g4(e){return Object.prototype.hasOwnProperty.call(f4,e)}function v4(e){return g4(e)?dp().resultSchemas[e]:void 0}function b4(e){return hw(e)?dp().requestSchemas[e]:void 0}function y4(e){return fw(e)?dp().notificationSchemas[e]:void 0}function wu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ls(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};const a=e.safeParse(t);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}const gf={ok:!1,reason:"not-in-era"};function vf(e){return wu(e)&&wu(e.outputSchema)&&mw(e.outputSchema)}const pp={era:"2025-11-25",hasRequestMethod:hw,hasNotificationMethod:fw,validateRequest:(e,t)=>ls(b4(e),t),validateResult:(e,t)=>ls(v4(e),t),validateNotification:(e,t)=>ls(y4(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>gf,validateInputResponse:()=>gf,samplingResultVariant:((e,t)=>{const a=pw();return ls(e?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){const a=uw(e),r=a.structuredContent;if(r===void 0)return a;const o=typeof r!="object"||r===null||Array.isArray(r),i=t!==void 0&&mw(t);return!o&&!i?a:{...a,structuredContent:{result:r}}},decodeResult(e,t){if(wu(t)&&"resultType"in t){const a={...t};return delete a.resultType,{kind:"complete",result:a}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;const a=t.tools;return!Array.isArray(a)||!a.some(r=>vf(r))?t:{...t,tools:a.map(r=>vf(r)?{...r,outputSchema:p4(r.outputSchema)}:r)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function E4(){const e=zd(()=>Te([R(),be(),Ae(),Ni(),Ne(R(),e),re(e)])),t=Ne(R(),e),a=Te([R(),be().int()]),r=R(),o=Te([R(),be().int()]),i=lt(["user","assistant"]),s=lt(["debug","info","notice","warning","error","critical","alert","emergency"]),l=R().refine(he=>{try{return atob(he),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=B({ttl:be().optional()}),u=B({taskId:R()}),d=Qe({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=B({_meta:d.optional()}),m=p.extend({task:c.optional()}),h=B({_meta:d.optional()}),f=B({method:R(),params:h.loose().optional()}),g=B({src:R(),mimeType:R().optional(),sizes:re(R()).optional(),theme:lt(["light","dark"]).optional()}),E=B({icons:re(g).optional()}),y=B({name:R(),title:R().optional()}),b=y.extend({...y.shape,...E.shape,version:R(),websiteUrl:R().optional(),description:R().optional()}),S=Br(B({applyDefaults:Ae().optional()}),t),w=Ri(he=>he&&typeof he=="object"&&!Array.isArray(he)&&Object.keys(he).length===0?{form:{}}:he,Br(B({form:S.optional(),url:t.optional()}),t.optional())),N=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({sampling:Qe({createMessage:t.optional()}).optional(),elicitation:Qe({create:t.optional()}).optional()}).optional()}),x=Qe({list:t.optional(),cancel:t.optional(),requests:Qe({tools:Qe({call:t.optional()}).optional()}).optional()}),A=B({experimental:Ne(R(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:B({listChanged:Ae().optional()}).optional(),tasks:N.optional(),extensions:Ne(R(),t).optional()}),C=B({experimental:Ne(R(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:Ae().optional()}).optional(),resources:B({subscribe:Ae().optional(),listChanged:Ae().optional()}).optional(),tools:B({listChanged:Ae().optional()}).optional(),tasks:x.optional(),extensions:Ne(R(),t).optional()}),O=B({progress:be(),total:We(be()),message:We(R())}),k=B({...h.shape,...O.shape,progressToken:a}),T=f.extend({method:J("notifications/progress"),params:k}),I=h.extend({level:s,logger:R().optional(),data:He()}),F=f.extend({method:J("notifications/message"),params:I}),z=B({uri:R(),mimeType:We(R()),_meta:Ne(R(),He()).optional()}),q=z.extend({text:R()}),W=z.extend({blob:l}),X=B({audience:re(i).optional(),priority:be().min(0).max(1).optional(),lastModified:yl({offset:!0}).optional()}),U=B({...y.shape,...E.shape,uri:R(),description:We(R()),mimeType:We(R()),size:We(be()),annotations:X.optional(),_meta:We(Qe({}))}),_=B({...y.shape,...E.shape,uriTemplate:R(),description:We(R()),mimeType:We(R()),annotations:X.optional(),_meta:We(Qe({}))}),P=f.extend({method:J("notifications/resources/list_changed"),params:h.optional()}),G=h.extend({uri:R()}),Z=f.extend({method:J("notifications/resources/updated"),params:G}),D=B({name:R(),description:We(R()),required:We(Ae())}),ne=B({...y.shape,...E.shape,description:We(R()),arguments:We(re(D)),_meta:We(Qe({}))}),H=f.extend({method:J("notifications/prompts/list_changed"),params:h.optional()}),j=B({type:J("text"),text:R(),annotations:X.optional(),_meta:Ne(R(),He()).optional()}),ie=B({type:J("image"),data:l,mimeType:R(),annotations:X.optional(),_meta:Ne(R(),He()).optional()}),Ee=B({type:J("audio"),data:l,mimeType:R(),annotations:X.optional(),_meta:Ne(R(),He()).optional()}),me=B({type:J("tool_use"),name:R(),id:R(),input:Ne(R(),He()),_meta:Ne(R(),He()).optional()}),_e=B({type:J("resource"),resource:Te([q,W]),annotations:X.optional(),_meta:Ne(R(),He()).optional()}),Je=U.extend({type:J("resource_link")}),De=Te([j,ie,Ee,Je,_e]),ue=B({role:i,content:De}),ye=B({title:R().optional(),readOnlyHint:Ae().optional(),destructiveHint:Ae().optional(),idempotentHint:Ae().optional(),openWorldHint:Ae().optional()}),M=f.extend({method:J("notifications/tools/list_changed"),params:h.optional()}),Y=B({name:R().optional()}),se=B({hints:re(Y).optional(),costPriority:be().min(0).max(1).optional(),speedPriority:be().min(0).max(1).optional(),intelligencePriority:be().min(0).max(1).optional()}),Fe=B({mode:lt(["auto","required","none"]).optional()}),je=B({type:J("boolean"),title:R().optional(),description:R().optional(),default:Ae().optional()}),oe=B({type:J("string"),title:R().optional(),description:R().optional(),minLength:be().optional(),maxLength:be().optional(),format:lt(["email","uri","date","date-time"]).optional(),default:R().optional()}),Ze=B({type:lt(["number","integer"]),title:R().optional(),description:R().optional(),minimum:be().optional(),maximum:be().optional(),default:be().optional()}),it=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),default:R().optional()}),zt=B({type:J("string"),title:R().optional(),description:R().optional(),oneOf:re(B({const:R(),title:R()})),default:R().optional()}),ct=B({type:J("string"),title:R().optional(),description:R().optional(),enum:re(R()),enumNames:re(R()).optional(),default:R().optional()}),qt=Te([it,zt]),le=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({type:J("string"),enum:re(R())}),default:re(R()).optional()}),fe=B({type:J("array"),title:R().optional(),description:R().optional(),minItems:be().optional(),maxItems:be().optional(),items:B({anyOf:re(B({const:R(),title:R()}))}),default:re(R()).optional()}),xe=Te([le,fe]),ze=Te([ct,qt,xe]),Ye=Te([ze,je,oe,Ze]),ht=m.extend({mode:J("form").optional(),message:R(),requestedSchema:B({type:J("object"),properties:Ne(R(),Ye),required:re(R()).optional()}).catchall(He())}),bt=B({type:J("ref/resource"),uri:R()}),ft=B({type:J("ref/prompt"),name:R()}),Ce=B({uri:R().startsWith("file://"),name:R().optional(),_meta:Ne(R(),He()).optional()}),gt=A.shape,Et=B({experimental:gt.experimental,sampling:gt.sampling,elicitation:gt.elicitation,roots:gt.roots,extensions:gt.extensions}),vt=C.shape,at=B({experimental:vt.experimental,logging:vt.logging,completions:vt.completions,prompts:vt.prompts,resources:vt.resources,tools:vt.tools,extensions:vt.extensions}),ee=Qe({progressToken:a.optional(),[El]:R(),[Ld]:b.optional(),[wl]:Et,[Dd]:s.optional()}),Re=B({...y.shape,...E.shape,description:R().optional(),inputSchema:Qe({$schema:R().optional(),type:J("object")}),outputSchema:Qe({$schema:R().optional()}).optional(),annotations:ye.optional(),_meta:Ne(R(),He()).optional()}),ae=B({type:J("tool_result"),toolUseId:R(),content:re(De),structuredContent:He().optional(),isError:Ae().optional(),_meta:Ne(R(),He()).optional()}),Le=Te([j,ie,Ee,me,ae]),Oe=B({role:i,content:Te([Le,re(Le)]),_meta:Ne(R(),He()).optional()}),et=R(),st=Qe({[bi]:b.optional().catch(void 0)}),It=st.optional();function xt(he){return Qe({_meta:It,resultType:et.default("complete"),...he})}const Ut=xt({}),rt=xt({nextCursor:r.optional()}),Xe=xt({content:re(De),structuredContent:He().optional(),isError:Ae().optional()}),$e=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),tools:re(Re),nextCursor:r.optional()}),Nt=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),prompts:re(ne),nextCursor:r.optional()}),Zt=xt({description:R().optional(),messages:re(ue)}),rn=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resources:re(U),nextCursor:r.optional()}),In=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resourceTemplates:re(_),nextCursor:r.optional()}),yn=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),contents:re(Te([q,W]))}),Fn=xt({completion:B({values:re(R()).max(100),total:be().int().optional(),hasMore:Ae().optional()}).loose()}),Gn=xt({ttlMs:be().int().min(0),cacheScope:lt(["public","private"])}),An=xt({ttlMs:be().int().min(0).catch(0),cacheScope:lt(["public","private"]).catch("private"),supportedVersions:re(R()),capabilities:at,instructions:R().optional()}),Jt=B({messages:re(Oe),modelPreferences:se.optional(),systemPrompt:R().optional(),includeContext:lt(["none","thisServer","allServers"]).optional(),temperature:be().optional(),maxTokens:be().int(),stopSequences:re(R()).optional(),metadata:t.optional(),tools:re(Re).optional(),toolChoice:Fe.optional()}),dn=B({method:J("sampling/createMessage"),params:Jt}),ut=B({method:J("roots/list"),params:B({_meta:Ne(R(),He()).optional()}).optional()}),ve=B({...Oe.shape,model:R(),stopReason:R().optional()}),ge=B({roots:re(Ce)}),At=B({action:lt(["accept","decline","cancel"]),content:Ne(R(),Te([R(),be(),Ae(),re(R())])).optional()}),Ot=B({mode:J("url"),message:R(),url:R().url()}),Kt=Te([ht,Ot]),Q=B({method:J("elicitation/create"),params:Kt}),Yt=Te([dn,ut,Q]),En=Te([ve,ge,At]),qn=Ne(R(),Yt),pn=Ne(R(),En),wn=xt({inputRequests:qn.optional(),requestState:R().optional()}),mn={inputResponses:pn.optional(),requestState:R().optional()},_n=B({_meta:ee,...mn}),on=Qe({progressToken:a.optional()});function pt(he,$){return B({method:J(he),params:B({_meta:ee,...$})})}function mt(he,$){return B({method:J(he),params:B({_meta:on.optional(),...$}).optional()})}const V={name:R(),arguments:Ne(R(),He()).optional(),...mn},ke={cursor:r.optional()},Ge=pt("tools/call",V),Dt=pt("tools/list",ke),kn=pt("prompts/list",ke),sn=pt("prompts/get",{name:R(),arguments:Ne(R(),R()).optional(),...mn}),Ca=pt("resources/list",ke),Na=pt("resources/templates/list",ke),pa=pt("resources/read",{uri:R(),...mn}),xn={ref:Te([ft,bt]),argument:B({name:R(),value:R()}),context:B({arguments:Ne(R(),R()).optional()}).optional()},ta=pt("completion/complete",xn),Sn=pt("server/discover",{}),ma=B({toolsListChanged:Ae().optional(),promptsListChanged:Ae().optional(),resourcesListChanged:Ae().optional(),resourceSubscriptions:re(R()).optional()}),na={notifications:ma},Ga=pt("subscriptions/listen",na),Qa=st.extend({"io.modelcontextprotocol/subscriptionId":o}),Xa=Qe({_meta:Qa,resultType:et.default("complete")}),aa={"tools/call":mt("tools/call",V),"tools/list":mt("tools/list",ke),"prompts/get":mt("prompts/get",{name:R(),arguments:Ne(R(),R()).optional()}),"prompts/list":mt("prompts/list",ke),"resources/list":mt("resources/list",ke),"resources/templates/list":mt("resources/templates/list",ke),"resources/read":mt("resources/read",{uri:R()}),"completion/complete":mt("completion/complete",xn),"server/discover":mt("server/discover",{}),"subscriptions/listen":mt("subscriptions/listen",na)};function Cn(he){return Qe({_meta:It,...he})}const ir={"tools/call":Cn({content:re(De),structuredContent:He().optional(),isError:Ae().optional()}),"tools/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),tools:re(Re),nextCursor:r.optional()}),"prompts/get":Cn({description:R().optional(),messages:re(ue)}),"prompts/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),prompts:re(ne),nextCursor:r.optional()}),"resources/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resources:re(U),nextCursor:r.optional()}),"resources/templates/list":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),resourceTemplates:re(_),nextCursor:r.optional()}),"resources/read":Cn({ttlMs:be().int().min(0),cacheScope:lt(["public","private"]),contents:re(Te([q,W]))}),"completion/complete":Cn({completion:B({values:re(R()).max(100),total:be().int().optional(),hasMore:Ae().optional()}).loose()}),"server/discover":Cn({ttlMs:be().int().min(0).catch(0),cacheScope:lt(["public","private"]).catch("private"),supportedVersions:re(R()),capabilities:at,instructions:R().optional()}),"subscriptions/listen":Cn({})},ha=Qe({"io.modelcontextprotocol/subscriptionId":o.optional()}),Ra=B({method:J("notifications/subscriptions/acknowledged"),params:B({_meta:ha.optional(),notifications:ma})}),ln=B({_meta:ha.optional(),requestId:o,reason:R().optional()}),Qn=B({method:J("notifications/cancelled"),params:ln}),ja={"notifications/cancelled":Qn,"notifications/progress":T,"notifications/message":F,"notifications/resources/updated":Z,"notifications/resources/list_changed":P,"notifications/tools/list_changed":M,"notifications/prompts/list_changed":H,"notifications/subscriptions/acknowledged":Ra},cn=he=>B({jsonrpc:J("2.0"),id:Te([R(),be().int()]),result:he}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:a,CursorSchema:r,RequestIdSchema:o,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:m,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:g,IconsSchema:E,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:N,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:A,ServerCapabilitiesSchema:C,ProgressSchema:O,ProgressNotificationParamsSchema:k,ProgressNotificationSchema:T,LoggingMessageNotificationParamsSchema:I,LoggingMessageNotificationSchema:F,ResourceContentsSchema:z,TextResourceContentsSchema:q,BlobResourceContentsSchema:W,AnnotationsSchema:X,ResourceSchema:U,ResourceTemplateSchema:_,ResourceListChangedNotificationSchema:P,ResourceUpdatedNotificationParamsSchema:G,ResourceUpdatedNotificationSchema:Z,PromptArgumentSchema:D,PromptSchema:ne,PromptListChangedNotificationSchema:H,TextContentSchema:j,ImageContentSchema:ie,AudioContentSchema:Ee,ToolUseContentSchema:me,EmbeddedResourceSchema:_e,ResourceLinkSchema:Je,ContentBlockSchema:De,PromptMessageSchema:ue,ToolAnnotationsSchema:ye,ToolListChangedNotificationSchema:M,ModelHintSchema:Y,ModelPreferencesSchema:se,ToolChoiceSchema:Fe,BooleanSchemaSchema:je,StringSchemaSchema:oe,NumberSchemaSchema:Ze,UntitledSingleSelectEnumSchemaSchema:it,TitledSingleSelectEnumSchemaSchema:zt,LegacyTitledEnumSchemaSchema:ct,SingleSelectEnumSchemaSchema:qt,UntitledMultiSelectEnumSchemaSchema:le,TitledMultiSelectEnumSchemaSchema:fe,MultiSelectEnumSchemaSchema:xe,EnumSchemaSchema:ze,PrimitiveSchemaDefinitionSchema:Ye,ElicitRequestFormParamsSchema:ht,ResourceTemplateReferenceSchema:bt,PromptReferenceSchema:ft,RootSchema:Ce,ClientCapabilities2026Schema:Et,ServerCapabilities2026Schema:at,RequestMetaEnvelopeSchema:ee,ToolSchema:Re,ToolResultContentSchema:ae,SamplingMessageContentBlockSchema:Le,SamplingMessageSchema:Oe,ResultTypeSchema:et,ResultMetaSchema:st,ResultSchema:Ut,PaginatedResultSchema:rt,CallToolResultSchema:Xe,ListToolsResultSchema:$e,ListPromptsResultSchema:Nt,GetPromptResultSchema:Zt,ListResourcesResultSchema:rn,ListResourceTemplatesResultSchema:In,ReadResourceResultSchema:yn,CompleteResultSchema:Fn,CacheableResultSchema:Gn,DiscoverResultSchema:An,CreateMessageRequestParamsSchema:Jt,CreateMessageRequestSchema:dn,ListRootsRequestSchema:ut,CreateMessageResultSchema:ve,ListRootsResultSchema:ge,ElicitResultSchema:At,ElicitRequestURLParamsSchema:Ot,ElicitRequestParamsSchema:Kt,ElicitRequestSchema:Q,InputRequestSchema:Yt,InputResponseSchema:En,InputRequestsSchema:qn,InputResponsesSchema:pn,InputRequiredResultSchema:wn,InputResponseRequestParamsSchema:_n,CallToolRequestSchema:Ge,ListToolsRequestSchema:Dt,ListPromptsRequestSchema:kn,GetPromptRequestSchema:sn,ListResourcesRequestSchema:Ca,ListResourceTemplatesRequestSchema:Na,ReadResourceRequestSchema:pa,CompleteRequestSchema:ta,DiscoverRequestSchema:Sn,SubscriptionFilterSchema:ma,SubscriptionsListenRequestSchema:Ga,SubscriptionsListenResultMetaSchema:Qa,SubscriptionsListenResultSchema:Xa,dispatchRequestSchemas:aa,dispatchResultSchemas:ir,NotificationMetaSchema:ha,SubscriptionsAcknowledgedNotificationSchema:Ra,CancelledNotificationParamsSchema:ln,CancelledNotificationSchema:Qn,notificationSchemas2026:ja,JSONRPCResultResponseSchema:cn(Ut),CallToolResultResponseSchema:cn(Te([Xe,wn])),ListToolsResultResponseSchema:cn($e),ListPromptsResultResponseSchema:cn(Nt),GetPromptResultResponseSchema:cn(Te([Zt,wn])),ListResourcesResultResponseSchema:cn(rn),ListResourceTemplatesResultResponseSchema:cn(In),ReadResourceResultResponseSchema:cn(Te([yn,wn])),CompleteResultResponseSchema:cn(Fn),DiscoverResultResponseSchema:cn(An)}}let w4;function Vr(){return w4??(w4=E4())}const k4=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function x4(e){return k4.includes(e)}const mp=Symbol("modelcontextprotocol.resultCacheHintFallback");function S4(e){return e[mp]}function gw(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function vw(e){return e==="public"||e==="private"}let wt=(function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({});var Lr,Zn=(Lr=class extends Error{static[Symbol.hasInstance](t){return Qs(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Qs(this,t)}constructor(t,a,r){super(a),this.code=t,this.data=r,this.name="ProtocolError",cw(this,new.target)}static fromError(t,a,r){if(t===wt.UrlElicitationRequired&&r){const o=r;if(o.elicitations)return new N4(o.elicitations,a)}if(t===wt.UnsupportedProtocolVersion&&r){const o=r;if(Array.isArray(o.supported)&&typeof o.requested=="string")return new R4({supported:o.supported,requested:o.requested},a)}if(t===wt.InvalidParams||t===wt.ResourceNotFound){const o=r;if(typeof(o==null?void 0:o.uri)=="string"&&(t===wt.ResourceNotFound||Object.keys(o).length===1))return new C4(o.uri,a)}if(t===wt.MissingRequiredClientCapability&&r){const o=r;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities=="object"&&!Array.isArray(o.requiredCapabilities))return new T4({requiredCapabilities:o.requiredCapabilities},a)}return new Lr(t,a,r)}},Object.defineProperty(Lr,"mcpBrand",{value:"mcp.ProtocolError"}),Lr),lo,C4=(lo=class extends Zn{constructor(t,a=`Resource not found: ${t}`){super(wt.InvalidParams,a,{uri:t})}get uri(){return this.data.uri}},Object.defineProperty(lo,"mcpBrand",{value:"mcp.ResourceNotFoundError"}),lo),co,N4=(co=class extends Zn{constructor(t,a=`URL elicitation${t.length>1?"s":""} required`){super(wt.UrlElicitationRequired,a,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}},Object.defineProperty(co,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"}),co),uo,R4=(uo=class extends Zn{constructor(t,a=`Unsupported protocol version: ${t.requested}`){super(wt.UnsupportedProtocolVersion,a,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Object.defineProperty(uo,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"}),uo),po,T4=(po=class extends Zn{constructor(t,a=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(wt.MissingRequiredClientCapability,a,t)}get requiredCapabilities(){return this.data.requiredCapabilities}},Object.defineProperty(po,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"}),po);const I4=0,A4="private",_4=["tools/call","prompts/get","resources/read"];function P4(e,t){const a=t.resultType;if(a===void 0)return{...t,resultType:"complete"};if(a==="complete"||_4.includes(e))return t;throw new Zn(wt.InternalError,`Handler for ${e} returned resultType '${String(a)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function O4(e,t){const a=S4(t);if(t.resultType!=="complete"||!x4(e))return a===void 0?t:F4(t);const r=t,o=gw(r.ttlMs)?r.ttlMs:L4(a),i=vw(r.cacheScope)?r.cacheScope:D4(a),s={...r,ttlMs:o,cacheScope:i};return delete s[mp],s}function M4(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function z4(e,t){if(t===void 0)return e;const a=e._meta;return a===void 0?{...e,_meta:{[bi]:t}}:!M4(a)||a[bi]!==void 0?e:{...e,_meta:{...a,[bi]:t}}}function L4(e){return e!==void 0&&gw(e.ttlMs)?e.ttlMs:I4}function D4(e){return e!==void 0&&vw(e.cacheScope)?e.cacheScope:A4}function F4(e){const t={...e};return delete t[mp],t}const q4=["elicitation/create","sampling/createMessage","roots/list"];let cs;function bw(){if(cs)return cs;const e=Vr();return cs={request:{"elicitation/create":B({method:J("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":B({method:J("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":B({method:J("roots/list"),params:Qe({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},cs}function yw(e){return q4.includes(e)}function kc(e){return yw(e)?bw().request[e]:void 0}function U4(e){return yw(e)?bw().response[e]:void 0}const Ew={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},j4={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ww(e){return Object.prototype.hasOwnProperty.call(Ew,e)}function kw(e){return Object.prototype.hasOwnProperty.call(j4,e)}function $4(e){return Object.prototype.hasOwnProperty.call(Ew,e)}function B4(e){return ww(e)?Vr().dispatchRequestSchemas[e]:void 0}function H4(e){return $4(e)?Vr().dispatchResultSchemas[e]:void 0}function V4(e){return kw(e)?Vr().notificationSchemas2026[e]:void 0}function yi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xo(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};const a=e.safeParse(t);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}const W4={ok:!1,reason:"not-in-era"},Z4=[El,wl];function J4(e,t){let a=t,r=!1;const o=()=>(r||(a={...a},r=!0),a),i=t.tools;e==="tools/list"&&Array.isArray(i)&&i.some(l=>yi(l)&&"execution"in l)&&(o().tools=i.map(l=>{if(!yi(l)||!("execution"in l))return l;const c={...l};return delete c.execution,c}));const s=t.capabilities;if(yi(s)&&"tasks"in s){const l={...s};delete l.tasks,o().capabilities=l}return a}const hp={era:"2026-07-28",hasRequestMethod:ww,hasNotificationMethod:kw,hasInputRequestMethod:e=>kc(e)!==void 0,validateRequest:(e,t)=>Xo(B4(e),t),validateResult:(e,t)=>Xo(H4(e),t),validateNotification:(e,t)=>Xo(V4(e),t),validateInputRequest:(e,t)=>Xo(kc(e),t),validateInputResponse:(e,t)=>Xo(U4(e),t),samplingResultVariant:()=>W4,outboundEnvelope(e){return{[El]:e.protocolVersion,[Ld]:e.clientInfo,[wl]:e.clientCapabilities,...e.logLevel!==void 0&&{[Dd]:e.logLevel}}},validateEnvelopeMeta(e){const t=[];for(const r of Z4)r in e||t.push({key:r,problem:"missing"});const a=Vr().RequestMetaEnvelopeSchema.safeParse(e);if(!a.success)for(const r of a.error.issues){const o=r.path.map(String),i=o.length>0?o.join("."):"_meta";o.length===1&&t.some(s=>s.key===i&&s.problem==="missing")||t.push({key:i,problem:r.message})}return t},projectCallToolResult:e=>uw(e),inputRequestSchema:kc,decodeResult(e,t){if(!yi(t))return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};const a=t.resultType;if(a===void 0)return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof a!="string")return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:a})};if(a==="input_required"){const s=t.inputRequests,l=yi(s)?s:{},c=t.requestState;return Object.keys(l).length===0&&typeof c!="string"?{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:l,...typeof c=="string"&&{requestState:c}}}if(a!=="complete")return{kind:"invalid",error:new Mn(Wn.UnsupportedResultType,`Unsupported result type '${a}' for ${e}`,{resultType:a,method:e})};const r=K4(),o=Object.hasOwn(r,e)?r[e]:void 0;if(o!==void 0){const s=o.safeParse(t);if(!s.success)return{kind:"invalid",error:new Mn(Wn.InvalidResult,`Invalid result for ${e}: ${s.error}`,{method:e})}}const i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,a){return z4(O4(e,P4(e,J4(e,t))),a)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";const t=Vr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(a=>a.message).join("; ")}`}};let us;function K4(){if(us)return us;const e=Vr();return us={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},us}const xw="2026-07-28";function Xs(e){return e!==void 0&&i4(e)?hp:pp}function bf(e){return e.revision!==void 0?Xs(e.revision).era:e.era==="modern"?hp.era:pp.era}function xc(e){return Sw.some(t=>t.hasRequestMethod(e))}function Sc(e){return Sw.some(t=>t.hasNotificationMethod(e))}const Sw=[pp,hp];var Y4=JI({AnnotationsSchema:()=>Jr,AudioContentSchema:()=>Il,BaseMetadataSchema:()=>Hr,BaseRequestParamsSchema:()=>Yn,BlobResourceContentsSchema:()=>Gd,BooleanSchemaSchema:()=>rp,CallToolRequestParamsSchema:()=>xE,CallToolRequestSchema:()=>SE,CallToolResultSchema:()=>_l,CancelTaskRequestSchema:()=>BM,CancelTaskResultSchema:()=>HM,CancelledNotificationParamsSchema:()=>Ty,CancelledNotificationSchema:()=>Hd,ClientCapabilitiesSchema:()=>Py,ClientNotificationSchema:()=>WM,ClientRequestSchema:()=>VM,ClientResultSchema:()=>ZM,ClientTasksCapabilitySchema:()=>Ay,CompatibilityCallToolResultSchema:()=>PM,CompleteRequestParamsSchema:()=>YE,CompleteRequestSchema:()=>GE,CompleteResultSchema:()=>QE,ContentBlockSchema:()=>Do,CreateMessageRequestParamsSchema:()=>zE,CreateMessageRequestSchema:()=>LE,CreateMessageResultSchema:()=>DE,CreateMessageResultWithToolsSchema:()=>FE,CreateTaskResultSchema:()=>zM,CursorSchema:()=>qd,DiscoverRequestSchema:()=>Dy,DiscoverResultSchema:()=>Fy,ElicitRequestFormParamsSchema:()=>Ol,ElicitRequestParamsSchema:()=>BE,ElicitRequestSchema:()=>HE,ElicitRequestURLParamsSchema:()=>$E,ElicitResultSchema:()=>ZE,ElicitationCompleteNotificationParamsSchema:()=>VE,ElicitationCompleteNotificationSchema:()=>WE,EmbeddedResourceSchema:()=>ep,EmptyResultSchema:()=>Cl,EnumSchemaSchema:()=>jE,GetPromptRequestParamsSchema:()=>mE,GetPromptRequestSchema:()=>hE,GetPromptResultSchema:()=>vE,GetTaskPayloadRequestSchema:()=>qM,GetTaskPayloadResultSchema:()=>UM,GetTaskRequestSchema:()=>DM,GetTaskResultSchema:()=>FM,IconSchema:()=>Iy,IconsSchema:()=>Po,ImageContentSchema:()=>Tl,ImplementationSchema:()=>Oo,InitializeRequestParamsSchema:()=>Oy,InitializeRequestSchema:()=>My,InitializeResultSchema:()=>zy,InitializedNotificationSchema:()=>Ly,JSONArraySchema:()=>TM,JSONObjectSchema:()=>fn,JSONRPCErrorResponseSchema:()=>Sl,JSONRPCMessageSchema:()=>Ry,JSONRPCNotificationSchema:()=>Bd,JSONRPCRequestSchema:()=>$d,JSONRPCResponseSchema:()=>IM,JSONRPCResultResponseSchema:()=>xl,JSONValueSchema:()=>So,LegacyTitledEnumSchemaSchema:()=>sp,ListChangedOptionsBaseSchema:()=>OM,ListPromptsRequestSchema:()=>dE,ListPromptsResultSchema:()=>pE,ListResourceTemplatesRequestSchema:()=>Vy,ListResourceTemplatesResultSchema:()=>Wy,ListResourcesRequestSchema:()=>By,ListResourcesResultSchema:()=>Hy,ListRootsRequestSchema:()=>ew,ListRootsResultSchema:()=>tw,ListTasksRequestSchema:()=>jM,ListTasksResultSchema:()=>$M,ListToolsRequestSchema:()=>wE,ListToolsResultSchema:()=>kE,LoggingLevelSchema:()=>np,LoggingMessageNotificationParamsSchema:()=>TE,LoggingMessageNotificationSchema:()=>ap,ModelHintSchema:()=>IE,ModelPreferencesSchema:()=>AE,MultiSelectEnumSchemaSchema:()=>UE,NotificationSchema:()=>da,NotificationsParamsSchema:()=>ua,NumberSchemaSchema:()=>Gs,PaginatedRequestParamsSchema:()=>jy,PaginatedRequestSchema:()=>Mo,PaginatedResultSchema:()=>zo,PingRequestSchema:()=>Wd,PrimitiveSchemaDefinitionSchema:()=>up,ProgressNotificationParamsSchema:()=>Uy,ProgressNotificationSchema:()=>Zd,ProgressSchema:()=>qy,ProgressTokenSchema:()=>Fd,PromptArgumentSchema:()=>cE,PromptListChangedNotificationSchema:()=>bE,PromptMessageSchema:()=>gE,PromptReferenceSchema:()=>KE,PromptSchema:()=>uE,ReadResourceRequestParamsSchema:()=>Zy,ReadResourceRequestSchema:()=>Jy,ReadResourceResultSchema:()=>Ky,RelatedTaskMetadataSchema:()=>Ny,RequestIdSchema:()=>Zr,RequestMetaSchema:()=>Ud,RequestSchema:()=>vn,ResourceContentsSchema:()=>Jd,ResourceLinkSchema:()=>tp,ResourceListChangedNotificationSchema:()=>Yy,ResourceRequestParamsSchema:()=>Nl,ResourceSchema:()=>Qd,ResourceTemplateReferenceSchema:()=>JE,ResourceTemplateSchema:()=>$y,ResourceUpdatedNotificationParamsSchema:()=>sE,ResourceUpdatedNotificationSchema:()=>lE,ResultMetaObjectSchema:()=>jd,ResultSchema:()=>bn,RoleSchema:()=>Lo,RootSchema:()=>XE,RootsListChangedNotificationSchema:()=>nw,SamplingContentSchema:()=>OE,SamplingMessageContentBlockSchema:()=>Ti,SamplingMessageSchema:()=>ME,ServerCapabilitiesSchema:()=>Vd,ServerNotificationSchema:()=>KM,ServerRequestSchema:()=>JM,ServerResultSchema:()=>YM,ServerTasksCapabilitySchema:()=>_y,SetLevelRequestParamsSchema:()=>NE,SetLevelRequestSchema:()=>RE,SingleSelectEnumSchemaSchema:()=>qE,StringSchemaSchema:()=>Pl,SubscribeRequestParamsSchema:()=>Gy,SubscribeRequestSchema:()=>Qy,SubscriptionFilterSchema:()=>Xd,SubscriptionsAcknowledgedNotificationParamsSchema:()=>aE,SubscriptionsAcknowledgedNotificationSchema:()=>rE,SubscriptionsListenRequestParamsSchema:()=>tE,SubscriptionsListenRequestSchema:()=>nE,SubscriptionsListenResultMetaSchema:()=>oE,SubscriptionsListenResultSchema:()=>iE,TaskAugmentedRequestParamsSchema:()=>Wi,TaskCreationParamsSchema:()=>MM,TaskMetadataSchema:()=>Cy,TaskSchema:()=>Fo,TaskStatusNotificationParamsSchema:()=>rw,TaskStatusNotificationSchema:()=>LM,TaskStatusSchema:()=>aw,TextContentSchema:()=>Rl,TextResourceContentsSchema:()=>Kd,TitledMultiSelectEnumSchemaSchema:()=>cp,TitledSingleSelectEnumSchemaSchema:()=>ip,ToolAnnotationsSchema:()=>yE,ToolChoiceSchema:()=>_E,ToolExecutionSchema:()=>EE,ToolListChangedNotificationSchema:()=>CE,ToolResultContentSchema:()=>PE,ToolSchema:()=>Al,ToolUseContentSchema:()=>fE,UnsubscribeRequestParamsSchema:()=>Xy,UnsubscribeRequestSchema:()=>eE,UntitledMultiSelectEnumSchemaSchema:()=>lp,UntitledSingleSelectEnumSchemaSchema:()=>op});const G4=e=>$d.safeParse(e).success,Q4=e=>Bd.safeParse(e).success,yf=e=>xl.safeParse(e).success,X4=e=>Sl.safeParse(e).success,Cc=-32020;wt.InvalidRequest,wt.UnsupportedProtocolVersion,wt.InvalidParams,wt.MethodNotFound,wt.InvalidParams,wt.MissingRequiredClientCapability;wt.ParseError+"",wt.InvalidRequest+"",wt.MethodNotFound+"",wt.UnsupportedProtocolVersion+"",wt.MissingRequiredClientCapability+"";function Cw(e,t){return dy(e,t)}function ei(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function ku(e){var a;if(e==null)return!1;const t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof((a=e["~standard"])==null?void 0:a.validate)=="function"}let Ef=!1;const xu="draft-2020-12";function ez(e,t="input"){const a=e["~standard"];let r;if(a.jsonSchema)r=a.jsonSchema[t]({target:xu});else if(a.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");Ef||(Ef=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=uy(e,{target:xu,io:t})}else throw new Error(`Schema library "${a.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return r.type!==void 0?r:Nw(r)?{type:"object",...r}:r;if(r.type!==void 0&&r.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}function Nw(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(const t of["oneOf","anyOf","allOf"]){const a=e[t];if(Array.isArray(a)&&a.length>0)return a.every(r=>r!==null&&typeof r=="object"&&(r.type==="object"||Nw(r)))}return!1}function tz(e){var t;return(t=e.path)!=null&&t.length?`${e.path.map(a=>String(typeof a=="object"?a.key:a)).join(".")}: ${e.message}`:e.message}async function Nc(e,t){const a=await e["~standard"].validate(t);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(r=>tz(r)).join(", ")}:{success:!0,data:a.value}}function nz(e){const t=uy(e,{target:xu,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}const az=/\\\.\\d\{(\d+)\}/;function rz(e){const t=az.exec(e),a=[void 0,-1,0];return t&&a.push(Number(t[1])),[!1,!0].flatMap(r=>[!1,!0].flatMap(o=>a.map(i=>yl({local:r,offset:o,precision:i}))))}function oz(e,t){let a;switch(e){case"email":a=[AO()];break;case"uri":a=[vy()];break;case"date":a=[kM()];break;case"date-time":a=rz(t);break}return new Set(a.map(r=>nz(r)).filter(r=>r!==void 0))}function iz(e,t,a){return a!=="zod"?!0:oz(e,t).has(t)}function Ii(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sz(e){try{return ez(e,"input")}catch(t){const a=t instanceof Error?t.message:String(t);throw new Zn(wt.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${a}`)}}const lz=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function fp(e){return lz.has(e)||e.startsWith("x-")}const cz=new Set(["$schema",...Object.keys(Ol.shape.requestedSchema.shape)]),wf={string:ei([Pl,op,ip,sp]),number:ei([Gs]),integer:ei([Gs]),boolean:ei([rp]),array:ei([lp,cp])},uz=new Set(Pl.shape.format.unwrap().options);function dz(e,t,a,r){if(!Ii(e))return e;const o=typeof e.type=="string"&&Object.hasOwn(wf,e.type)?wf[e.type]:void 0;if(o===void 0)return e;const i={};for(const[s,l]of Object.entries(e))o.has(s)||fp(s)?i[s]=l:s==="pattern"&&e.type==="string"&&typeof e.format=="string"?uz.has(e.format)?(typeof l!="string"||!iz(e.format,l,a))&&r.push(`${t}.${s}`):i[s]=l:r.push(`${t}.${s}`);return i}function pz(e,t){const a={},r=[];for(const[o,i]of Object.entries(e))o==="properties"&&Ii(i)?a[o]=Object.fromEntries(Object.entries(i).map(([s,l])=>[s,dz(l,`properties.${s}`,t,r)])):cz.has(o)?a[o]=i:fp(o)||r.push(o);if(r.length>0)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return a}function mz(e,t){if(!Ii(e.properties))return t;const a=Object.entries(e.properties).filter(([,r])=>!Cw(up,r).success).map(([r])=>`properties.${r}`);return a.length>0?a.join(", "):t}function Su(e,t,a=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((r,o)=>Su(r,t[o],`${a}[${o}]`)):!Ii(e)||!Ii(t)?[]:Object.entries(e).flatMap(([r,o])=>{const i=a?`${a}.${r}`:r;return Object.prototype.hasOwnProperty.call(t,r)?Su(o,t[r],i):fp(r)?[]:[i]})}function hz(e){if(!ku(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};const t=e.requestedSchema["~standard"].vendor,a=pz(sz(e.requestedSchema),t),r=Cw(Ol.shape.requestedSchema,a);if(!r.success)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${mz(a,r.error.message)}`);const o=Su(a,r.data);if(o.length>0)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);const i=(r.data.required??[]).filter(s=>!Object.prototype.hasOwnProperty.call(r.data.properties,s));if(i.length>0)throw new Zn(wt.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function fz(e){const t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,a=typeof e.requestState=="string";if(!t&&!a)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(fz,{elicit(e){try{return{method:"elicitation/create",params:hz(e)}}catch(t){throw t instanceof Zn?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});const gz=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],vz={IdJagTokenExchangeResponseSchema:e4,OAuthClientInformationFullSchema:n4,OAuthClientInformationSchema:lw,OAuthClientMetadataSchema:sw,OAuthClientRegistrationErrorSchema:a4,OAuthErrorResponseSchema:t4,OAuthMetadataSchema:ow,OAuthProtectedResourceMetadataSchema:GM,OAuthTokenRevocationRequestSchema:r4,OAuthTokensSchema:XM,OpenIdProviderDiscoveryMetadataSchema:QM,OpenIdProviderMetadataSchema:iw},Rw={},Tw={};function Iw(e,t){const a=e.slice(0,-6);Rw[a]=t,Tw[a]=r=>t.safeParse(r).success}for(const e of gz)Iw(e,Y4[e]);for(const[e,t]of Object.entries(vz))Iw(e,t);Object.freeze(Rw);Object.freeze(Tw);function bz(e){switch(e){case"initialize":case"notifications/initialized":return Xs(void 0);case"server/discover":return Xs(xw);default:return}}const yz=6e4,Ez=[El,Ld,wl,Dd],wz=["inputResponses","requestState"];function kf(e,t){const a=e.params;if(!Rc(a))return{message:e,lifted:{}};const r=a._meta,o=Rc(r)?Ez.filter(c=>c in r):[],i=t==="request"?wz.filter(c=>c in a):[];if(o.length===0&&i.length===0)return{message:e,lifted:{}};const s={},l={...a};if(o.length>0&&Rc(r)){const c={},u={...r};for(const d of o)c[d]=r[d],delete u[d];s.envelope=c,Object.keys(u).length>0?l._meta=u:delete l._meta}for(const c of i)c==="inputResponses"&&(s.inputResponses=l[c]),c==="requestState"&&(s.requestState=l[c]),delete l[c];return{message:{...e,params:l},lifted:s}}function xf(e,t){const a=e.validateResult(t,void 0);if(!(!a.ok&&a.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){const o=e.validateResult(t,r);return o.ok?{value:o.value}:{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function Aw(e){return()=>e}const kz=Aw(void 0);var xz=class{constructor(e){Ke(this,"_transport");Ke(this,"_requestMessageId",0);Ke(this,"_requestHandlers",new Map);Ke(this,"_requestHandlerAbortControllers",new Map);Ke(this,"_notificationHandlers",new Map);Ke(this,"_responseHandlers",new Map);Ke(this,"_progressHandlers",new Map);Ke(this,"_timeoutInfo",new Map);Ke(this,"_pendingDebouncedNotifications",new Set);Ke(this,"_negotiatedProtocolVersion");Ke(this,"_supportedProtocolVersions");Ke(this,"onclose");Ke(this,"onerror");Ke(this,"fallbackRequestHandler");Ke(this,"fallbackNotificationHandler");this._options=e,this._supportedProtocolVersions=(e==null?void 0:e.supportedProtocolVersions)??CM,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){const t=this._outboundMetaEnvelope();if(t===void 0)return e;const a=e.params??{};return{...e,params:{...a,_meta:{...t,...a._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Mn(Wn.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){var t;e.params.requestId&&((t=this._requestHandlerAbortControllers.get(e.params.requestId))==null||t.abort(e.params.reason))}_setupTimeout(e,t,a,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Mn(Wn.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var o,i,s,l;this._transport=e;const t=(o=this.transport)==null?void 0:o.onclose;this._transport.onclose=()=>{try{t==null||t()}finally{this._onclose()}};const a=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=c=>{a==null||a(c),this._onerror(c)};const r=(s=this._transport)==null?void 0:s.onmessage;this._transport.onmessage=(c,u)=>{r==null||r(c,u),yf(c)||X4(c)?this._onresponse(c):G4(c)?this._onrequest(c,u):Q4(c)?this._onnotification(c,u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},(l=e.setSupportedProtocolVersions)==null||l.call(e,this._supportedProtocolVersions),await this._transport.start()}_onclose(){var r;const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(const o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();const t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;const a=new Mn(Wn.ConnectionClosed,"Connection closed");this._transport=void 0;try{(r=this.onclose)==null||r.call(this)}finally{for(const o of e.values())o(a);for(const o of t.values())o.abort(a)}}_onerror(e){var t;(t=this.onerror)==null||t.call(this,e)}_onnotification(e,t){const{message:a}=kf(e,"notification"),r=this._negotiatedWireCodec();if((t==null?void 0:t.classification)===void 0&&this._shouldDropInbound(e)==="drop")return;if((t==null?void 0:t.classification)!==void 0){const s=bf(t.classification);if(s!==r.era){this._onerror(new Error(`Era mismatch on inbound notification '${a.method}': classified as ${s} but this instance serves ${r.era}`));return}}if(Sc(a.method)&&!r.hasNotificationMethod(a.method))return;const o=this._notificationHandlers.get(a.method),i=this.fallbackNotificationHandler;o===void 0&&i===void 0||Promise.resolve().then(()=>o===void 0?i(a):o(a,r)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){var g;const{message:a,lifted:r}=kf(e,"request"),o=this._negotiatedWireCodec();if((t==null?void 0:t.classification)===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}const i=this._transport,s=(E,y,b)=>{const S={jsonrpc:"2.0",id:a.id,error:{code:E,message:y,...b!==void 0&&{data:b}}};i==null||i.send(S).catch(w=>this._onerror(new Error(`Failed to send an error response: ${w}`)))};if((t==null?void 0:t.classification)!==void 0){const E=bf(t.classification);if(E!==o.era){this._onerror(new Error(`Era mismatch on inbound request '${a.method}': classified as ${E} but this instance serves ${o.era}`));const y=t.classification.revision??E;s(wt.UnsupportedProtocolVersion,`Unsupported protocol version: ${y}`,{supported:this._supportedProtocolVersions,requested:y});return}}if(xc(a.method)&&!o.hasRequestMethod(a.method)){s(wt.MethodNotFound,"Method not found");return}const l=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(l===void 0){s(wt.MethodNotFound,"Method not found");return}const c=o.checkInboundEnvelope(r);if(c!==void 0){s(wt.InvalidParams,c);return}const u=(E,y)=>this._notificationViaCodec(this._resolveOutboundCodec(E.method),E,{...y,relatedRequestId:a.id}),d=(E,y,b)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(E.method),E,y,{...b,relatedRequestId:a.id}),p=new AbortController;this._requestHandlerAbortControllers.set(a.id,p);const m=r.inputResponses===void 0?void 0:Sz(r.inputResponses),h={sessionId:i==null?void 0:i.sessionId,mcpReq:{id:a.id,method:a.method,_meta:(g=a.params)==null?void 0:g._meta,...r.envelope!==void 0&&{envelope:r.envelope},...m!==void 0&&{inputResponses:m.accepted},...m!==void 0&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:r.requestState===void 0?kz:Aw(r.requestState),signal:p.signal,send:((E,y,b)=>{const S=this._resolveOutboundCodec(E.method);if(this._assertOutboundRequestInEra(S,E.method),ku(y))return d(E,y,b);const w=xf(S,E.method);if(w===void 0)throw new TypeError(`'${E.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(E,w,y)}),notify:u},http:t!=null&&t.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(h,t);Promise.resolve().then(()=>l(a,f)).then(async E=>{if(p.signal.aborted)return;let y;try{y=o.encodeResult(a.method,E,this._outboundServerInfo())}catch(S){this._onerror(new Error(`Failed to encode result for ${a.method}: ${S}`)),s(wt.InternalError,"Internal error");return}const b={result:y,jsonrpc:"2.0",id:a.id};await(i==null?void 0:i.send(b))},async E=>{if(p.signal.aborted)return;const y=Number.isSafeInteger(E.code)?E.code:wt.InternalError,b={jsonrpc:"2.0",id:a.id,error:{code:o.encodeErrorCode(y),message:E.message??"Internal error",...E.data!==void 0&&{data:E.data}}};await(i==null?void 0:i.send(b))}).catch(E=>this._onerror(new Error(`Failed to send response: ${E}`))).finally(()=>{this._requestHandlerAbortControllers.get(a.id)===p&&this._requestHandlerAbortControllers.delete(a.id)})}_onprogress(e){const{progressToken:t,...a}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const i=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(l);return}o(a)}_onresponse(e){const t=Number(e.id),a=this._responseHandlers.get(t);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),yf(e)?a(e):a(Zn.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){var e;await((e=this._transport)==null?void 0:e.close())}request(e,t,a){const r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),ku(t))return this._requestWithSchemaViaCodec(r,e,t,a);const o=xf(r,e.method);if(o===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,o,t)}_negotiatedWireCodec(){return Xs(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){const t=bz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(xc(t)&&!e.hasRequestMethod(t))throw new Mn(Wn.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,a){const r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,a)}_requestWithSchemaViaCodec(e,t,a,r){const{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,headers:l}=r??{},c=Date.now();let u,d;return new Promise((p,m)=>{var x,A,C,O;const h=k=>{m(k)};if(!this._transport){h(new Error("Not connected"));return}if(((x=this._options)==null?void 0:x.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method)}catch(k){h(k);return}if((A=r==null?void 0:r.signal)!=null&&A.aborted){const k=r.signal.reason;throw k instanceof Mn?k:new Mn(Wn.RequestTimeout,String(k))}const f=e.era===xw&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,g=this._requestMessageId++;d=g;const E={...t,jsonrpc:"2.0",id:g};r!=null&&r.onprogress&&(this._progressHandlers.set(g,r.onprogress),E.params={...t.params,_meta:{...(C=t.params)==null?void 0:C._meta,progressToken:g}});const y=this._envelopeOutbound(E);let b=!1;const S=k=>{var T;b||(this._progressHandlers.delete(g),f===void 0?(T=this._transport)==null||T.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(k)}}),{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))):f.abort(),m(k instanceof Mn?k:new Mn(Wn.RequestTimeout,String(k))))};this._responseHandlers.set(g,k=>{var F;if((F=r==null?void 0:r.signal)!=null&&F.aborted)return;if(b=!0,k instanceof Error)return m(k);let T;try{T=e.decodeResult(t.method,k.result)}catch(z){return m(z instanceof Error?z:new Error(String(z)))}if(T.kind==="invalid")return m(T.error);if(T.kind==="input_required"){if((r==null?void 0:r.allowInputRequired)===!0)return p(Cz(T));const z={codec:e,request:t,resultSchema:a,options:r,flowStartedAt:c,retry:(q,W)=>this._requestWithSchemaViaCodec(e,q===void 0?{method:t.method}:{method:t.method,params:q},a,W)};return p(this._resolveNonCompleteResult(T,z))}const I=T.result;Nc(a,I).then(z=>{z.success?p(z.data):m(new Mn(Wn.InvalidResult,`Invalid result for ${t.method}: ${z.error}`))},m)}),u=()=>{var k;return S((k=r==null?void 0:r.signal)==null?void 0:k.reason)},(O=r==null?void 0:r.signal)==null||O.addEventListener("abort",u,{once:!0});const w=(r==null?void 0:r.timeout)??yz,N=()=>S(new Mn(Wn.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(g,w,r==null?void 0:r.maxTotalTimeout,N,(r==null?void 0:r.resetTimeoutOnProgress)??!1),this._transport.send(y,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,headers:l,requestSignal:f==null?void 0:f.signal}).catch(k=>{this._progressHandlers.delete(g),m(k)})}).finally(()=>{var p;u&&((p=r==null?void 0:r.signal)==null||p.removeEventListener("abort",u)),d!==void 0&&(this._responseHandlers.delete(d),this._cleanupTimeout(d))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,a){var o;if(!this._transport)throw new Mn(Wn.NotConnected,"Not connected");if(Sc(t.method)&&!e.hasNotificationMethod(t.method))throw new Mn(Wn.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);const r=this._envelopeOutbound({jsonrpc:"2.0",...t});if((((o=this._options)==null?void 0:o.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(a!=null&&a.relatedRequestId)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var i;this._pendingDebouncedNotifications.delete(t.method),this._transport&&((i=this._transport)==null||i.send(r,a).catch(s=>this._onerror(s)))});return}await this._transport.send(r,a)}setRequestHandler(e,t,a){this.assertRequestHandlerCapability(e);let r;if(typeof t=="function"){if(!xc(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(o,i)=>{const s=this._negotiatedWireCodec();let l=s.validateRequest(e,o);if(!l.ok&&l.reason==="not-in-era"&&(l=s.validateInputRequest(e,o)),!l.ok)throw l.reason==="not-in-era"?new Zn(wt.InternalError,`No wire schema for ${e} in the resolved era`):new Error(l.message);return Promise.resolve(t(l.value,i))}}else if(a)r=async(o,i)=>{const s=await Nc(t.params,{...o.params});if(!s.success)throw new Zn(wt.InvalidParams,`Invalid params for ${e}: ${s.error}`);return a(s.data,i)};else throw new TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,a){if(typeof t=="function"){if(!Sc(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,o)=>{const i=o.validateNotification(e,r);if(!i.ok)throw i.reason==="not-in-era"?new Zn(wt.InternalError,`No wire schema for ${e} in the resolved era`):new Error(i.message);return Promise.resolve(t(i.value))});return}if(!a)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async r=>{const o=await Nc(t.params,{...r.params});if(!o.success)throw new Zn(wt.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await a(o.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Rc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Sf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Sz(e){const t={},a=[];if(!Sf(e))return{accepted:t,droppedKeys:a};for(const[r,o]of Object.entries(e)){if(!Sf(o)||"method"in o||"result"in o){a.push(r);continue}t[r]=o}return{accepted:t,droppedKeys:a}}function Cz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}/*! * content-type * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed @@ -651,7 +651,7 @@ Boolean requesting whether a visible border and background is provided by the ho - omitted: host decides border`)});var Tf=B({method:J("ui/request-display-mode"),params:B({mode:Ai.describe("The display mode being requested.")})}),If=B({mode:Ai.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),oL=Te([J("model"),J("app")]).describe("Tool visibility scope - who can access the tool.");B({resourceUri:R().optional(),visibility:re(oL).optional().describe(`Who can access this tool. Default: ["model", "app"] - "model": Tool visible to and callable by the agent - "app": Tool callable by the app from this server only`),csp:bu().optional(),permissions:bu().optional()});B({mimeTypes:re(R()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var iL=B({method:J("ui/download-file"),params:B({contents:re(Te([ep,tp])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),sL=B({method:J("ui/message"),params:B({role:J("user").describe('Message role, currently only "user" is supported.'),content:re(Do).describe("Message content blocks (text, image, etc.).")})});B({method:J("ui/notifications/sandbox-resource-ready"),params:B({html:R().describe("HTML content to load into the inner iframe."),sandbox:R().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:gp.optional().describe("CSP configuration from resource metadata."),permissions:vp.optional().describe("Sandbox permissions from resource metadata.")})});B({method:J("ui/notifications/tool-result"),params:_l.describe("Standard MCP tool execution result.")});var Pw=B({toolInfo:B({id:Zr.optional().describe("JSON-RPC id of the tools/call request."),tool:Al.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Bz.optional().describe("Current color theme preference."),styles:Xz.optional().describe("Style configuration for theming the app."),displayMode:Ai.optional().describe("How the UI is currently displayed."),availableDisplayModes:re(Ai).optional().describe("Display modes the host supports."),containerDimensions:Te([B({height:be().describe("Fixed container height in pixels.")}),B({maxHeight:Te([be(),vu()]).optional().describe("Maximum container height in pixels.")})]).and(Te([B({width:be().describe("Fixed container width in pixels.")}),B({maxWidth:Te([be(),vu()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other -container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:R().optional().describe("User's language and region preference in BCP 47 format."),timeZone:R().optional().describe("User's timezone in IANA format."),userAgent:R().optional().describe("Host application identifier."),platform:Te([J("web"),J("desktop"),J("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:B({touch:Ae().optional().describe("Whether the device supports touch input."),hover:Ae().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:B({top:be().describe("Top safe area inset in pixels."),right:be().describe("Right safe area inset in pixels."),bottom:be().describe("Bottom safe area inset in pixels."),left:be().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough();B({method:J("ui/notifications/host-context-changed"),params:Pw.describe("Partial context update containing only changed fields.")});var lL=B({method:J("ui/update-model-context"),params:B({content:re(Do).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Ne(R(),He().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),cL=B({method:J("ui/initialize"),params:B({appInfo:Oo.describe("App identification (name and version)."),appCapabilities:aL.describe("Features and capabilities this app provides."),protocolVersion:R().describe("Protocol version this app supports.")})}),uL=B({protocolVersion:R().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Oo.describe("Host application identification and version."),hostCapabilities:nL.describe("Features and capabilities provided by the host."),hostContext:Pw.describe("Rich context about the host environment.")}).passthrough();class dL{constructor(t=window.parent,a){Ke(this,"eventTarget");Ke(this,"eventSource");Ke(this,"messageListener");Ke(this,"onclose");Ke(this,"onerror");Ke(this,"onmessage");Ke(this,"sessionId");Ke(this,"setProtocolVersion");this.eventTarget=t,this.eventSource=a,this.messageListener=r=>{var i,s,l;if(a&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=Ry.safeParse(r.data);o.success?(console.debug("Parsed message",o.data),(i=this.onmessage)==null||i.call(this,o.data)):((s=r.data)==null?void 0:s.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,r):(console.error("Failed to parse message",o.error.message,r),(l=this.onerror)==null||l.call(this,Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,a){t.method!==$z&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){var t;window.removeEventListener("message",this.messageListener),(t=this.onclose)==null||t.call(this)}}var pL=[_w];class mL extends xz{constructor(a,r,o,i){super(i);Ke(this,"_client");Ke(this,"_hostInfo");Ke(this,"_hostCapabilities");Ke(this,"_appCapabilities");Ke(this,"_hostContext",{});Ke(this,"_appInfo");Ke(this,"_initializedReceived",!1);Ke(this,"_registeredEvents",new Set);Ke(this,"_events",new qz);Ke(this,"_methods",new Uz);Ke(this,"setRequestHandler",(...a)=>{let[r,...o]=Nf("request",a)??a;this._methods.claim(r,"setRequestHandler"),super.setRequestHandler.call(this,r,...o)});Ke(this,"setNotificationHandler",(...a)=>{let[r,...o]=Nf("notification",a)??a;this._methods.claim(r,"setNotificationHandler"),super.setNotificationHandler.call(this,r,...o)});Ke(this,"removeRequestHandler",a=>{this._methods.release(a),super.removeRequestHandler(a)});Ke(this,"removeNotificationHandler",a=>{this._methods.release(a),super.removeNotificationHandler(a)});Ke(this,"replaceRequestHandler",(a,...r)=>{this._methods.replace(a),super.setRequestHandler.call(this,a,...r)});Ke(this,"eventSchemas",{sizechange:Gz,sandboxready:Yz,initialized:rL,requestteardown:tL,loggingmessage:ap});Ke(this,"onping");Ke(this,"_onmessage");Ke(this,"_onopenlink");Ke(this,"_ondownloadfile");Ke(this,"_onrequestdisplaymode");Ke(this,"_onupdatemodelcontext");Ke(this,"_oncalltool");Ke(this,"_oncreatesamplingmessage");Ke(this,"_onlistresources");Ke(this,"_onlistresourcetemplates");Ke(this,"_onreadresource");Ke(this,"_onlistprompts");Ke(this,"sendResourceTeardown",this.teardownResource);this._client=a,this._hostInfo=r,this._hostCapabilities=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=(i==null?void 0:i.hostContext)||{},this.replaceRequestHandler("ui/initialize",{params:cL.shape.params,result:uL},s=>this._onAppsInitialize(s)),this.replaceRequestHandler("ping",(s,l)=>{var c;return(c=this.onping)==null||c.call(this,s.params,l),{}}),this.replaceRequestHandler("ui/request-display-mode",{params:Tf.shape.params,result:If},()=>({mode:this._hostContext.displayMode??"inline"}))}_wrapHandler(a,r){let o=super._wrapHandler(a,r);return a==="ui/initialize"||a==="ping"?o:async(i,s)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${a}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),o(i,s))}setEventHandler(a,r){this._ensureEventSlot(a),this._events.setHandler(a,r)}getEventHandler(a){return this._events.getHandler(a)}addEventListener(a,r){this._ensureEventSlot(a),this._events.addEventListener(a,r)}removeEventListener(a,r){this._events.removeEventListener(a,r)}_ensureEventSlot(a){if(this._registeredEvents.has(a))return;let r=this.eventSchemas[a];if(!r)throw Error(`Unknown event: ${String(a)}`);let o=i=>{a==="initialized"&&(this._initializedReceived=!0),this._events.dispatch(a,i)};a==="loggingmessage"?this.setNotificationHandler("notifications/message",i=>{o(i.params)}):this.setNotificationHandler(r.shape.method.value,{params:r.shape.params},i=>o(i)),this._registeredEvents.add(a)}warnIfRequestHandlerReplaced(a,r,o){r&&o&&console.warn(`[MCP Apps] ${a} handler replaced. Previous handler will no longer be called.`)}buildContext(a){return a}assertCapabilityForMethod(a){}assertRequestHandlerCapability(a){}assertNotificationCapability(a){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(a){this.setEventHandler("sizechange",a)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(a){this.setEventHandler("sandboxready",a)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(a){this.setEventHandler("initialized",a)}get onmessage(){return this._onmessage}set onmessage(a){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,a),this._onmessage=a,this.replaceRequestHandler("ui/message",{params:sL.shape.params,result:Kz},async(r,o)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(r,o)})}get onopenlink(){return this._onopenlink}set onopenlink(a){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,a),this._onopenlink=a,this.replaceRequestHandler("ui/open-link",{params:Wz.shape.params,result:Zz},async(r,o)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(r,o)})}get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(a){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,a),this._ondownloadfile=a,this.replaceRequestHandler("ui/download-file",{params:iL.shape.params,result:Jz},async(r,o)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(r,o)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(a){this.setEventHandler("requestteardown",a)}get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(a){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,a),this._onrequestdisplaymode=a,this.replaceRequestHandler("ui/request-display-mode",{params:Tf.shape.params,result:If},async(r,o)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(r,o)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(a){this.setEventHandler("loggingmessage",a)}get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(a){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,a),this._onupdatemodelcontext=a,this.replaceRequestHandler("ui/update-model-context",{params:lL.shape.params,result:Cl},async(r,o)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(r,o)})}get oncalltool(){return this._oncalltool}set oncalltool(a){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,a),this._oncalltool=a,this.replaceRequestHandler("tools/call",async(r,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(r.params,o)})}get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(a){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,a),this._oncreatesamplingmessage=a,this.replaceRequestHandler("sampling/createMessage",async(r,o)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(r.params,o)})}sendToolListChanged(a={}){return this.notification({method:"notifications/tools/list_changed",params:a})}get onlistresources(){return this._onlistresources}set onlistresources(a){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,a),this._onlistresources=a,this.replaceRequestHandler("resources/list",async(r,o)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(r.params,o)})}get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(a){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,a),this._onlistresourcetemplates=a,this.replaceRequestHandler("resources/templates/list",async(r,o)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(r.params,o)})}get onreadresource(){return this._onreadresource}set onreadresource(a){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,a),this._onreadresource=a,this.replaceRequestHandler("resources/read",async(r,o)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(r.params,o)})}sendResourceListChanged(a={}){return this.notification({method:"notifications/resources/list_changed",params:a})}get onlistprompts(){return this._onlistprompts}set onlistprompts(a){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,a),this._onlistprompts=a,this.replaceRequestHandler("prompts/list",async(r,o)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(r.params,o)})}sendPromptListChanged(a={}){return this.notification({method:"notifications/prompts/list_changed",params:a})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(a){let r=a.protocolVersion;return this._appInfo!==void 0&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=a.appCapabilities,this._appInfo=a.appInfo,{protocolVersion:pL.includes(r)?r:_w,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(a){let r={},o=!1;for(let i of Object.keys(a)){let s=this._hostContext[i],l=a[i];hL(s,l)||(r[i]=l,o=!0)}o&&(this._hostContext=a,this.sendHostContextChange(r))}sendHostContextChange(a){return this.notification({method:"ui/notifications/host-context-changed",params:a})}sendToolInput(a){return this.notification({method:"ui/notifications/tool-input",params:a})}sendToolInputPartial(a){return this.notification({method:"ui/notifications/tool-input-partial",params:a})}sendToolResult(a){return this.notification({method:"ui/notifications/tool-result",params:a})}sendToolCancelled(a){return this.notification({method:"ui/notifications/tool-cancelled",params:a})}sendSandboxResourceReady(a){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:a})}teardownResource(a,r){return this.request({method:"ui/resource-teardown",params:a},eL,r)}callTool(a,r){return this.request({method:"tools/call",params:a},r)}listTools(a,r){return this.request({method:"tools/list",params:a},r)}async connect(a){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let r=this._client.getServerCapabilities();if(!r)throw Error("Client server capabilities not available");r.tools&&(this.oncalltool=async(o,i)=>this._client.request({method:"tools/call",params:o},{signal:i.mcpReq.signal}),r.tools.listChanged&&this._client.setNotificationHandler("notifications/tools/list_changed",o=>this.sendToolListChanged(o.params))),r.resources&&(this.onlistresources=async(o,i)=>this._client.request({method:"resources/list",params:o},{signal:i.mcpReq.signal}),this.onlistresourcetemplates=async(o,i)=>this._client.request({method:"resources/templates/list",params:o},{signal:i.mcpReq.signal}),this.onreadresource=async(o,i)=>this._client.request({method:"resources/read",params:o},{signal:i.mcpReq.signal}),r.resources.listChanged&&this._client.setNotificationHandler("notifications/resources/list_changed",o=>this.sendResourceListChanged(o.params))),r.prompts&&(this.onlistprompts=async(o,i)=>this._client.request({method:"prompts/list",params:o},{signal:i.mcpReq.signal}),r.prompts.listChanged&&this._client.setNotificationHandler("notifications/prompts/list_changed",o=>this.sendPromptListChanged(o.params)))}return super.connect(a)}}function hL(e,t){return JSON.stringify(e)===JSON.stringify(t)}const Ow=v.createContext("system");function fL({scheme:e,children:t}){return n.createElement(Ow.Provider,{value:e||"system"},t)}function gL(){return v.useContext(Ow)}const ds="com.microsoft.amplifier/visibility",Mw=v.createContext(!0);function vL({visible:e,children:t}){return n.createElement(Mw.Provider,{value:e},t)}function bL(e){const t=v.useContext(Mw),[a,r]=v.useState(()=>document.visibilityState!=="hidden");return v.useEffect(()=>{const o=()=>r(document.visibilityState!=="hidden");return document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)},[]),e!==!1&&t&&a}const Cu=e=>Array.isArray(e)?e.map(Cu):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,Cu(e[t])])):e;function yL({limit:e=2,maxQueued:t=4,isVisible:a=()=>!0}={}){const r=new Map,o=[];let i=0,s=!1;const l=d=>Object.assign(new Error(d),{backgroundReadPaused:!0}),c=()=>l(s?"This tool view closed.":"Background reads are paused. Refresh when the tool view is visible."),u=()=>{for(;o.length&&i{i--,u()})}};return{run(d,p){if(s||!a())return Promise.reject(c());const m=JSON.stringify(Cu({name:d.name,arguments:d.arguments||{}}));if(r.has(m))return r.get(m);if(i>=e&&o.length>=t)return Promise.reject(l("Too many background reads. Wait for the current refresh to finish."));const h=new Promise((f,g)=>{o.push({run:p,resolve:f,reject:g}),u()}).finally(()=>r.delete(m));return r.set(m,h),h},close(){for(s=!0;o.length;)o.shift().reject(c())}}}async function Af(e,t,a){var i;const r=await St("/api/actions",{method:"POST",body:{id:crypto.randomUUID(),action:e,args:t},signal:a});if(!r.operationId)return r;const o=Date.now()+31e4;for(;Date.now()setTimeout(l,350))}throw new Error("No completion received. Inspect Smart Tools activity before retrying.")}const EL=e=>Object.fromEntries(["viewId","resourceId","resourceRevision","generation"].filter(t=>e[t]!=null).map(t=>[t,e[t]])),pr=(e,t,a={})=>{const r=new URLSearchParams({...EL(e),...a}).toString();return`/api/canvas/${encodeURIComponent(e.id)}/${t}${r?"?"+r:""}`};async function wL(e,t,a){var s;const r=crypto.randomUUID(),o=Date.now()+31e4;let i=await St(pr(e,"tools/call"),{method:"POST",body:{id:r,expectedRevision:e.revision||1,name:t.name,arguments:t.arguments||{}},signal:a});for(;["pending","running","queued"].includes(i.status);){if(a!=null&&a.aborted||Date.now()>=o)throw new Error("No completion received. Inspect Smart Tools activity before retrying; input was not replayed.");await new Promise(l=>setTimeout(l,350)),i=await St(`/api/smart-tools/operations/${encodeURIComponent(r)}`,{signal:a})}if(i.status==="completed"||(s=i.result)!=null&&s.isError)return i.result;throw new Error(i.error||"Tool work was interrupted; it was not replayed.")}function kL(e){const t=()=>window.matchMedia("(prefers-color-scheme: dark)"),[a,r]=v.useState(()=>t().matches?"dark":"light");return v.useEffect(()=>{if(e!=="system")return;const o=t(),i=s=>r(s.matches?"dark":"light");return r(o.matches?"dark":"light"),o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]),e==="dark"||e==="light"?e:a}function xL({canvas:e,act:t,connectionKey:a}){var O,k;const r=v.useRef(null),o=v.useRef(e),i=v.useRef(null),s=v.useRef(null),l=v.useRef(),[c,u]=v.useState({phase:"loading",text:"Connecting tool view…"}),d=v.useRef(null),p=v.useRef(!1),[m,h]=v.useState(null),[f,g]=v.useState(!1),y=v.useRef(null),E=v.useRef(null),b=v.useRef(null),S=v.useRef(null),w=T=>{d.current=T,h(T)},N=kL(gL()),x=bL(e.open!==!1&&!e.visibilityPending),A=v.useRef(x);A.current=x,o.current=e,l.current=N,v.useEffect(()=>{const T=i.current,I=s.current;if(!T||!I||I.theme===N&&I[ds]===x)return;const F={...I,theme:N,[ds]:x};s.current=F,T.setHostContext(F)},[N,x]),v.useEffect(()=>{const T=new AbortController;let I,F=!0,z=!1,U="",H=0,te;const j=yL({isVisible:()=>A.current});let _;const P=()=>{_=void 0};E.current=P;const G=()=>e.readOnlyVersion?Promise.resolve({tools:[]}):_||(_=St(pr(e,"tools"),{signal:T.signal}).catch(Z=>{throw _=null,Z})),W=(Z,ie)=>{!F||U===Z+ie||(U=Z+ie,u({phase:Z,text:ie}),t("canvas.report",{id:e.id,part:"mcp-app",status:Z==="ready"?"ready":Z==="error"?"error":"pending",message:ie}))};y.current=W;const D=()=>{const Z=++H;return te=(async()=>{try{const ie=await St(pr(e,"status"),{signal:T.signal});return F&&Z===H&&(w(ie),z&&W(["ready","saved_version"].includes(ie.status)?"ready":"error",ie.message),P()),ie}catch(ie){throw F&&Z===H&&W("error",ie.message),ie}})(),te};b.current=D;const ne=async()=>{let Z=D(),ie;for(;F;){try{ie=await Z}catch(me){if(Z===te)throw me}if(Z===te)break;Z=te}if(!F)return;if(ie.source!=="available"){W("error",ie.message);return}s.current={theme:l.current,[ds]:A.current,displayMode:"inline",availableDisplayModes:["inline"],locale:navigator.language},I=new mL(null,{name:"Amplifier Unified",version:"0.6.0"},{serverTools:{},serverResources:{},updateModelContext:{text:{},structuredContent:{}},sandbox:{permissions:{},csp:{connectDomains:[],resourceDomains:[],frameDomains:["blob:"],baseUriDomains:[]}}},{hostContext:s.current}),I.oncalltool=async me=>{var Je,De,ue,ye;const _e=H;try{if(o.current.readOnlyVersion)throw Error("This saved version is read-only. Select Latest for live features.");const Y=(Je=(await G().catch(oe=>{if(T.signal.aborted)throw oe;return{tools:[]}})).tools)==null?void 0:Je.find(oe=>oe.name===me.name),se=()=>wL(e,me,T.signal),je=await(((De=Y==null?void 0:Y.annotations)==null?void 0:De.readOnlyHint)===!0&&((ue=Y==null?void 0:Y.annotations)==null?void 0:ue.destructiveHint)!==!0?j.run(me,se):se());return je!=null&&je.isError?W("error","The tool reported an error. See its result below."):_e===H&&((ye=d.current)==null?void 0:ye.status)==="ready"&&W("ready","Tool view connected"),je}catch(M){throw M.backgroundReadPaused||W("error",M.message),M}},I.onlisttools=G;const ke=(me,_e={})=>St(pr(e,"resources",{kind:me,..._e}),{signal:T.signal});if(I.onreadresource=me=>ke("read",{uri:me.uri}),I.onlistresources=me=>ke("list",me!=null&&me.cursor?{cursor:me.cursor}:{}),I.onlistresourcetemplates=me=>ke("templates",me!=null&&me.cursor?{cursor:me.cursor}:{}),I.onupdatemodelcontext=async me=>e.readOnlyVersion?{}:(await Af("smartTools.context",{canvasId:e.id,expectedRevision:e.revision||1,context:me},T.signal),{}),I.oninitialized=async()=>{var me,_e,Je,De;z=!0,p.current=!0;try{await I.sendToolInput({arguments:((me=o.current.mcp)==null?void 0:me.toolArguments)||{}});const ue=(_e=o.current.mcp)==null?void 0:_e.operationId,ye=(Je=o.current.mcp)!=null&&Je.savedResult?(await St(pr(e,"result"),{signal:T.signal})).result:ue?(await St(`/api/smart-tools/operations/${encodeURIComponent(ue)}`,{signal:T.signal})).result:(De=o.current.mcp)==null?void 0:De.result;ye&&await I.sendToolResult(ye);const M=d.current;W(["ready","saved_version"].includes(M==null?void 0:M.status)?"ready":"error",(M==null?void 0:M.message)||"Tool view connected")}catch(ue){W("error",ue.message)}},I.onerror=me=>W("error",me.message),await I.connect(new dL(r.current.contentWindow,r.current.contentWindow)),F){i.current=I;const me={...s.current,theme:l.current,[ds]:A.current};s.current=me,I.setHostContext(me),r.current.src=$i(pr(e,"document"))}};p.current=!1,w(null),W("loading","Checking saved tool view…"),ne().catch(Z=>W("error",Z.message));const q=setTimeout(()=>{var Z,ie;F&&!z&&W("error",((Z=d.current)==null?void 0:Z.source)==="available"?"The saved tool document did not initialize. Reload it to retry. Its scripts must work within the self-contained MCP App sandbox.":((ie=d.current)==null?void 0:ie.message)||"The saved tool document could not be checked. Retry when the host is available.")},15e3);return()=>{F=!1,clearTimeout(q),j.close(),T.abort(),y.current===W&&(y.current=null),b.current===D&&(b.current=null),E.current===P&&(E.current=null),i.current===I&&(i.current=null),s.current=null,I==null||I.close().catch(()=>{})}},[e.id,e.resourceRevision,e.generation,(O=e.view)==null?void 0:O.reload]),v.useEffect(()=>{var F,z;const T=JSON.stringify([e.id,e.resourceRevision,e.generation,(F=e.view)==null?void 0:F.reload]),I=S.current;S.current={identity:T,connectionKey:a,visible:x},x&&(I==null?void 0:I.identity)===T&&(I.connectionKey!==a||!I.visible)&&((z=b.current)==null||z.call(b).catch(()=>{}))},[a,x,e.id,e.resourceRevision,e.generation,(k=e.view)==null?void 0:k.reload]);const C=async T=>{var I,F,z;g(!0);try{const U=await St(pr(e,"status"));if(w(U),!U.canReconnect)throw new Error(U.message);const H=await Af("smartTools.reconnectView",{canvasId:e.id,expectedBindingRevision:U.bindingRevision,...T?{reviewedContract:T}:{}});w(H),H.status==="ready"&&((I=E.current)==null||I.call(E)),(F=y.current)==null||F.call(y,H.status==="ready"&&p.current?"ready":"error",H.status==="ready"&&!p.current?"Tool reconnected. Reload the saved view to retry initialization.":H.message)}catch(U){try{w(await St(pr(e,"status")))}catch{}(z=y.current)==null||z.call(y,"error",U.message)}finally{g(!1)}};return n.createElement("div",{className:"a-mcp-app-viewer",style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0}},n.createElement(yr,{inline:c.phase==="error"},n.createElement("div",{"data-phase":c.phase,className:`a-mcp-status a-canvas-result ${c.phase==="error"?"error":c.phase==="ready"?"success":""}`,role:"status"},c.phase==="error"?n.createElement(zn,null):c.phase==="ready"?n.createElement(Pt,null):n.createElement(dg,{className:"a-progress-spinner"}),n.createElement("span",null,c.text),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Reconnect tool view","data-action":"smartTools.reconnectView",disabled:f||(m==null?void 0:m.canReconnect)===!1,onClick:()=>C()},n.createElement(Mt,null)),c.phase==="error"&&(m==null?void 0:m.source)==="available"&&n.createElement("button",{type:"button",className:"a-link",style:{whiteSpace:"nowrap"},title:"Reloading resets unfinished inputs in this tool view","data-action":"canvas.view",onClick:()=>t("canvas.view",{id:e.id,patch:{reload:Date.now()}})},"Reload saved view"))),(m==null?void 0:m.review)&&n.createElement("div",{className:"a-canvas-result",role:"region","aria-label":"Review saved tool connection"},n.createElement("p",null,"This older view did not save its action schemas. Reconnecting keeps its saved document and existing action names. Review the current definitions before enabling them; no previous calls will run."),n.createElement("details",null,n.createElement("summary",null,"Existing tool actions (",m.review.tools.length,")"),n.createElement("pre",null,JSON.stringify(m.review.tools,null,2))),n.createElement("button",{type:"button",disabled:f,"data-action":"smartTools.reconnectView",onClick:()=>C(m.review.fingerprint)},"Use reviewed actions in this tab")),e.sharedToolView&&n.createElement("p",{className:"a-caption"},"This view shares tool work with the original conversation."),n.createElement("iframe",{ref:r,title:e.title||"Interactive tool",className:"a-canvas-html",style:{flex:1,minHeight:0},sandbox:"allow-scripts allow-downloads",referrerPolicy:"no-referrer"}))}function SL({surface:e,act:t}){const a=new Map(((e==null?void 0:e.components)||[]).map(o=>[o.id,o])),r=(o,i=[])=>{var d;if(i.length>20||i.includes(o))return null;const s=a.get(o);if(!s)return null;const[l,c]=Object.entries(s.component||{})[0]||[];if(!c)return null;const u=()=>{var p;return(((p=c.children)==null?void 0:p.explicitList)||[]).map(m=>n.createElement(n.Fragment,{key:m},r(m,[...i,o])))};if(l==="Text"){const p=["h1","h2","h3","h4","h5"].includes(c.usageHint)?c.usageHint:"p";return n.createElement(p,{className:"a-canvas-text"},((d=c.text)==null?void 0:d.literalString)||"")}return l==="Row"||l==="Column"?n.createElement("div",{className:`a-canvas-${l.toLowerCase()}`},u()):l==="Card"?n.createElement("div",{className:"a-canvas-card"},r(c.child,[...i,o])):l==="Divider"?n.createElement("hr",null):l==="Button"?n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.event",onClick:()=>t("canvas.event",{surfaceId:e.surfaceId,componentId:o,name:c.action.name})},r(c.child,[...i,o])):null};return n.createElement("div",{className:"a-canvas-surface","data-part":"agent-surface"},r(e==null?void 0:e.root))}const CL=({canvas:e,act:t})=>n.createElement(SL,{surface:e.surface,act:t}),Rs=Object.fromEntries(["markdown","text","code","json","jsonl","image","html","babylon","mermaid","dot"].map(e=>["builtin.canvas."+e,FI]));Object.assign(Rs,{"builtin.canvas.browser":cS,"builtin.canvas.mcp-app":xL,"builtin.canvas.a2ui":CL});const ui=e=>Object.fromEntries(["viewId","resourceId","resourceRevision","generation"].map(t=>[t,e[t]])),ps=new Map;async function NL(e){return ps.has(e)||ps.set(e,import(e).then(t=>{const a=t.default({React:n});if(typeof a!="function")throw Error("The renderer did not export a component.");return a}).catch(t=>{throw ps.delete(e),t})),ps.get(e)}class RL extends n.Component{constructor(){super(...arguments);Ke(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a){this.props.onError(a.message)}render(){return this.state.error?this.props.fallback:this.props.children}}function _f({report:e}){return v.useEffect(()=>{e("ready","Renderer mounted")},[e]),null}function TL({view:e,canvas:t,dispatch:a,recovery:r,connectionKey:o}){const i=JSON.stringify(ui(e)),s=v.useMemo(()=>JSON.parse(i),[i]),l=v.useRef(new Set),c=v.useMemo(()=>({visible:!!t.open,viewId:e.viewId,resource:{id:t.id,kind:t.kind,title:t.title,content:t.content,surface:t.surface,url:t.url,path:t.path,revision:e.resourceRevision},view:t.view||{}}),[t,e.viewId,e.resourceRevision]),u=v.useRef(c);u.current=c,v.useEffect(()=>{l.current.forEach(T=>T())},[c]);const d=v.useMemo(()=>Object.freeze({apiVersion:"1.0",instanceId:s.viewId,viewId:s.viewId,getSnapshot:()=>u.current,subscribe:T=>(l.current.add(T),()=>l.current.delete(T)),readSource:()=>St(`/api/canvas/views/${s.viewId}/source?`+new URLSearchParams(s)).then(T=>T.content),dispatch:(T,I={})=>{const F={"view.update":"canvas.view","view.report":"canvas.report"}[T];return F?a("canvas.views.command",{...s,action:F,args:I}):Promise.reject(Error("Unsupported renderer capability."))},setDirty:T=>a("canvas.views.dirty",{...s,dirty:!!T})}),[s,a]),p=v.useMemo(()=>(T,I)=>{a("canvas.views.status",{...s,status:T,message:String(I).slice(0,2e3)}).catch(()=>{})},[s,a]),m=r&&!e.renderer.startsWith("builtin."),h=v.useMemo(()=>(T,I)=>p(m||!e.available?"error":T,m?"Recovery mode is displaying the standard viewer.":e.available?I:"The saved renderer is unavailable; displaying the standard viewer."),[p,m,e.available]),f=v.useMemo(()=>(T,I)=>{const F=a("canvas.views.command",{...s,action:T,args:I});return T==="canvas.reference"?F:F.catch(()=>{})},[s,a]),g="builtin.canvas."+t.kind,y=Rs[g],E=e.choices.find(T=>T.id===e.renderer),b=r||!E?g:e.renderer,[S,w]=v.useState(null),[N,x]=v.useState("");v.useEffect(()=>{let T=!0;if(w(null),x(""),!Rs[b])return p("loading","Loading renderer"),NL(E.url).then(I=>{T&&w(()=>I)}).catch(I=>{T&&(x(I.message),p("error",I.message))}),()=>{T=!1}},[b,E==null?void 0:E.url,p]);const A=T=>{x(T),p("error",T)},C=y?n.createElement(y,{canvas:t,act:f,connectionKey:o}):n.createElement("p",{role:"alert"},"No standard viewer supports this artifact."),O=Rs[b],k=S;return n.createElement(n.Fragment,null,(N||!E||r)&&n.createElement("div",{role:"status",className:"a-renderer-notice"},r?"Recovery mode uses standard viewers.":N?`This renderer needs attention: ${N}`:"The saved renderer is unavailable. Showing the standard viewer; your artifact is retained.",n.createElement("button",{type:"button",className:"a-link",onClick:()=>a("canvas.views.recover",s)},"Use standard viewer")),O?n.createElement(n.Fragment,null,n.createElement(O,{canvas:t,act:f,connectionKey:o}),n.createElement(_f,{report:h})):k?n.createElement(RL,{onError:A,fallback:C},n.createElement(k,{host:d}),n.createElement(_f,{report:h})):N?C:n.createElement("p",{role:"status"},"Loading viewer…"))}function IL({view:e,state:t,dispatch:a,recovery:r}){var d,p,m,h,f;const[o,i]=v.useState(""),s=v.useMemo(()=>t.canvas?{...t.canvas,...e.app?{app:e.app}:{},...ui(e),view:e.view||t.canvas.view,renderReports:e.renderReports}:null,[t.canvas,e]),l=(p=(d=t.smartTools)==null?void 0:d.servers)==null?void 0:p.find(g=>{var y;return g.id===((y=s==null?void 0:s.mcp)==null?void 0:y.serverId)}),c=JSON.stringify([l==null?void 0:l.status,l==null?void 0:l.catalogState,l==null?void 0:l.catalogRevision,l==null?void 0:l.account,l==null?void 0:l.accountBinding,(m=s==null?void 0:s.mcp)==null?void 0:m.catalogRevision]),u=async(g,y)=>{var E;try{const b=await a(g,y);i(((E=b==null?void 0:b.result)==null?void 0:E.status)==="deferred"?b.result.reason:"")}catch(b){i(b.message)}};return n.createElement(aS,{label:"Artifact controls"},n.createElement("section",{className:"a-resource-view","data-canvas-view":e.viewId,"aria-label":"Artifact view"},n.createElement(yr,null,n.createElement("div",{className:"a-resource-view-controls a-canvas-toolbar"},!!((h=e.versions)!=null&&h.length)&&n.createElement(n.Fragment,null,n.createElement("label",null,"Version",n.createElement("select",{"aria-label":"Artifact version",value:e.selectedVersion??"latest",onChange:g=>u("canvas.select",{id:e.resourceId,...g.target.value==="latest"?{}:{version:Number(g.target.value)}})},n.createElement("option",{value:"latest"},"Latest · Version ",e.latestVersion),e.versions.slice().reverse().map(g=>n.createElement("option",{key:g.version,value:g.version},"Version ",g.version,g.createdAt?" · "+new Date(g.createdAt*1e3).toLocaleString():"")))),e.selectedVersion!=null&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-link",onClick:()=>u("canvas.select",{id:e.resourceId})},"Go to Latest"),(s==null?void 0:s.app)&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>u("canvas.apps.restore",{id:e.resourceId,sessionId:s.sessionId,version:e.selectedVersion,expectedRevision:e.latestVersion,expectedStateRevision:e.latestStateRevision})},"Restore as new version"),!(s!=null&&s.app)&&!["mcp-app","browser"].includes(s==null?void 0:s.kind)&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>u("canvas.versions.restore",{id:e.resourceId,sessionId:s.sessionId,version:e.selectedVersion,expectedRevision:e.latestVersion})},"Restore as new version"))),n.createElement("label",null,"Open with",n.createElement("select",{"aria-label":"Open with",value:e.renderer,onFocus:()=>a("canvas.views.inspect",{}).catch(()=>{}),onChange:g=>u("canvas.views.renderer",{...ui(e),renderer:g.target.value})},!e.available&&n.createElement("option",{value:e.renderer},"Unavailable renderer"),e.choices.map(g=>n.createElement("option",{key:g.id,value:g.id},g.label)))),((f=e.filePaths)==null?void 0:f.absolute)&&n.createElement("details",{className:"a-canvas-file-path"},n.createElement("summary",null,"File path"),n.createElement("div",null,n.createElement("p",null,"On the app server"),n.createElement("code",null,e.filePaths.absolute),n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.copyPath",onClick:()=>u("canvas.views.command",{...ui(e),action:"canvas.copyPath",args:{format:"absolute"}})},"Copy absolute path"),e.filePaths.relative&&n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.copyPath",onClick:()=>u("canvas.views.command",{...ui(e),action:"canvas.copyPath",args:{format:"relative"}})},"Copy relative path"))))),e.selectedVersion!=null&&n.createElement("p",{role:"status",className:"a-renderer-notice"},(s==null?void 0:s.kind)==="browser"?"Saved address · Website is live":"Saved version · Read only"),o&&n.createElement("p",{role:"alert",className:"a-renderer-notice"},o),n.createElement("div",{className:"a-resource-renderer"},s!=null&&s.app?n.createElement(hS,{key:e.resourceId+":"+(e.selectedVersion??"latest"),canvas:s,dispatch:a}):s?n.createElement(TL,{key:e.resourceId+":"+e.resourceRevision+":"+e.generation,view:e,canvas:s,dispatch:a,recovery:r,connectionKey:c}):n.createElement("p",{role:"status"},"Loading saved artifact…"))))}function AL({state:e,dispatch:t,hidden:a=!1}){var l;const r=v.useRef(new Map),o=(((l=e.canvasWorkspace)==null?void 0:l.views)||[]).filter(c=>c.viewId==="primary");for(const c of r.current.keys())o.some(u=>u.viewId===c)||r.current.delete(c);const i=o.filter(c=>{var u;return(u=e.canvas)!=null&&u.open&&r.current.set(c.viewId,c.resourceId),r.current.get(c.viewId)===c.resourceId}),s=typeof location<"u"&&new URLSearchParams(location.search).get("shell")==="recovery";return n.createElement("div",{className:"a-canvas-workspace",hidden:a,inert:a},i.map(c=>n.createElement(IL,{key:c.viewId,view:c,state:e,dispatch:t,recovery:s})))}const Ts=360,_r=300,mr=216;function Nu({available:e=1200,gap:t=12,rail:a=0,navPinned:r=!1,canvasOpen:o=!1,navWidth:i=320,canvasWidth:s=440,priority:l="canvas"}={}){const c=o&&e=Ts+mr+(u?_r+t*2:t),p=e-t*((d||a?1:0)+(u?1:0))-Ts,m=Math.min(16384,Math.max(mr,p-(u?_r:0))),h=Math.min(16384,Math.max(_r,p-(d?mr:a)));let f=d?Math.min(Math.max(mr,i),m):a,g=Math.min(Math.max(_r,s),h);return u&&(l==="nav"?g=Math.max(_r,Math.min(g,p-f)):d&&(f=Math.max(mr,Math.min(f,p-g)))),{overlay:c,docked:d,nav:f,canvas:g,navMax:m,canvasMax:h,expandedNav:d?f:Math.min(Math.max(mr,i),Math.max(mr,e-a))}}const zw=v.createContext(null);function _L({state:e,act:t,children:a,presentation:r={}}){var g,y;const o=Bu(),i=v.useRef(null),[s,l]=v.useState({available:1200,gap:12,rail:0}),[c,u]=v.useState(null);v.useEffect(()=>{const E=i.current;if(!E)return;const b=()=>l({available:E.clientWidth,gap:parseFloat(getComputedStyle(E).columnGap)||0,rail:0}),S=new ResizeObserver(b);return S.observe(E),b(),()=>S.disconnect()},[]);const d=e.view||{},p=(r.layout||d.layout)==="work",m=d.canvasWidth??((r.layout||d.layout)==="conversation"?300:440),h=Nu({...s,navPinned:!o&&!!d.navPinned,canvasOpen:!!e.selectedSessionId&&!!((g=e.canvas)!=null&&g.open),navWidth:d.navWidth,canvasWidth:m,...c}),f=(E,b)=>{var N,x;const S=Nu({...s,navPinned:!o&&!!d.navPinned,canvasOpen:!!e.selectedSessionId&&!!((N=e.canvas)!=null&&N.open),navWidth:d.navWidth,canvasWidth:m,[E]:b,priority:E==="navWidth"?"nav":"canvas"}),w={[E]:Math.round(b)};S.docked&&((x=e.canvas)!=null&&x.open)&&!S.overlay&&(w.navWidth=Math.round(S.nav),w.canvasWidth=Math.round(S.canvas)),u(null),t("view.update",{patch:w})};return n.createElement(zw.Provider,{value:{...h,narrow:o,canvasOnLeft:p,preview:(E,b)=>u({[E]:b,priority:E==="navWidth"?"nav":"canvas"}),cancel:()=>u(null),persist:f}},n.createElement("main",{ref:i,className:"a-layout","data-part":"workspace","data-narrow":o,"data-canvas-open":!!e.selectedSessionId&&!!((y=e.canvas)!=null&&y.open),"data-pane-layout":"","data-canvas-overlay":h.overlay,style:{"--nav-width":h.expandedNav+"px","--canvas-width":h.canvas+"px","--chat-min":Ts+"px"}},a))}function Lw(e,t){var r,o,i,s;return v.useContext(zw)||{...Nu({navPinned:(r=e.view)==null?void 0:r.navPinned,canvasOpen:!!e.selectedSessionId&&((o=e.canvas)==null?void 0:o.open),navWidth:(i=e.view)==null?void 0:i.navWidth,canvasWidth:(s=e.view)==null?void 0:s.canvasWidth}),preview:()=>{},cancel:()=>{},persist:(l,c)=>t("view.update",{patch:{[l]:c}})}}function Dw({layout:e,pane:t}){const a=v.useRef(null),r=t==="nav",o=r?"navWidth":"canvasWidth",i=r?e.nav:e.canvas,s=r?mr:_r,l=r?e.navMax:e.canvasMax,c=p=>Math.round(Math.max(s,Math.min(l,p))),u=r||e.canvasOnLeft?1:-1,d=p=>c(a.current.width+(p.clientX-a.current.x)*u);return n.createElement("div",{className:r?"a-nav-resize":"a-canvas-resize",role:"separator","aria-label":r?"Resize navigation":"Resize canvas","aria-orientation":"vertical","aria-valuemin":s,"aria-valuemax":Math.floor(l),"aria-valuenow":Math.round(i),tabIndex:0,"data-action":"view.update",onPointerDown:p=>{p.preventDefault(),a.current={x:p.clientX,width:i},p.currentTarget.setPointerCapture(p.pointerId)},onPointerMove:p=>{a.current&&e.preview(o,d(p))},onPointerUp:p=>{if(a.current){const m=d(p);a.current=null,e.persist(o,m)}},onPointerCancel:()=>{a.current=null,e.cancel()},onKeyDown:p=>{["ArrowLeft","ArrowRight","Home","End"].includes(p.key)&&(p.preventDefault(),e.persist(o,p.key==="Home"?s:p.key==="End"?Math.floor(l):c(i+(p.key==="ArrowLeft"?-20:20)*u)))}})}const hr=(e,t)=>e("view.update",{patch:t});function PL({state:e,act:t,layout:a}){var i,s;const r=(a||((i=e.view)==null?void 0:i.layout))==="work"?Du:rx,o=!!e.selectedSessionId&&!!((s=e.canvas)!=null&&s.open);return n.createElement("button",{type:"button",className:"a-icon a-canvas-toggle",disabled:!e.selectedSessionId,title:e.selectedSessionId?void 0:"Send a message to start a chat before opening Canvas","aria-label":o?"Close canvas":"Open canvas","aria-pressed":o,"aria-controls":"workspace-canvas","data-action":"canvas.visibility",onClick:()=>{var l;return t("canvas.visibility",{open:!((l=e.canvas)!=null&&l.open)})}},n.createElement(r,null))}function OL({state:e,session:t,act:a,selectSession:r,newSession:o,shell:i,footer:s}){const l=Lw(e,a),c=e.view||{},u=!l.narrow&&!!c.navPinned,d=(u||!!c.navExpanded)&&(!l.narrow||!c.canvasFocused&&!c.panel&&!c.toolbarMenuOpen);c.workspaceDraft;const p=v.useRef(null),m=v.useRef(l.narrow),h=()=>hr(a,{navExpanded:!1});v.useEffect(()=>{l.narrow&&!m.current&&c.navExpanded&&h(),m.current=l.narrow},[l.narrow]),rl(p,l.narrow&&d,h),al(e).find(y=>y.id===e.selectedWorkspaceId);const g=()=>{(o||(()=>a("session.draft",{})))(),u||hr(a,{navExpanded:!1})};return n.createElement(Eg.Provider,{value:d},l.narrow&&d&&n.createElement("div",{className:"a-navigation-scrim",onClick:h}),n.createElement("aside",{ref:p,id:"workspace-navigation",role:l.narrow?"dialog":void 0,"aria-modal":l.narrow&&d||void 0,hidden:!d,inert:!d,className:`a-nav-slot ${u?"is-pinned":""} ${d?"is-expanded":""}`,"data-docked":l.docked,"data-part":"navigation","aria-label":"Workspaces and conversations",onClick:y=>{l.narrow&&y.target.closest('[data-navigation-select],[data-action="session.select"]')&&h()}},n.createElement("div",{className:"a-nav-rail"},n.createElement("div",{className:"a-nav-head"},n.createElement("button",{className:"a-icon",type:"button","aria-label":"Close navigation",title:"Close sidebar","aria-pressed":u,"aria-expanded":d,"data-action":"view.update",onClick:()=>l.narrow?h():hr(a,{navPinned:!1,navExpanded:!1}).then(()=>{var y;typeof document<"u"&&((y=document.querySelector('[aria-label="Open navigation"]'))==null||y.focus())})},l.narrow?n.createElement(nn,null):n.createElement(Du,null),!l.narrow&&n.createElement(Da,{state:e,section:"chats"})),n.createElement("strong",{className:"a-nav-reveal"},"Your work")),n.createElement("button",{className:"a-nav-main",type:"button",onClick:g,"data-action":"session.draft","aria-label":"New chat",title:"New chat"},n.createElement(Ln,null),n.createElement("span",{className:"a-nav-reveal"},"New chat")),n.createElement("div",{className:"a-nav-content a-nav-reveal"},n.createElement(tS,{shell:i})),s),l.docked&&n.createElement(Dw,{layout:l,pane:"nav"})))}function ML({session:e,act:t,onLoadEarlier:a}){var m,h;if(!e)return null;const r=e.workspaceAvailable===!1,o=e.historyReadOnlyReason,i=!!e.historyLoading||e.historyLoaded===!1&&!e.historyError,s=Number(e.sharedHistoryOffset)>0,l=((m=e.historyActivity)==null?void 0:m.diagnostics)||[],c=l.some(f=>["activity_scan_limit","scan_limit","invalid_event","incomplete_event","unreadable_file"].includes(f.code)),u=l.some(f=>f.code==="recovered_backup"),d=()=>t("session.select",{id:e.id}),p=()=>(a==null||a(),t("session.history",{id:e.id,before:e.sharedHistoryOffset,limit:100}));return!i&&!e.historyError&&!s&&!r&&!o&&!c&&!u?null:n.createElement("div",{className:"a-session-history","data-part":"session-history"},(r||o)&&n.createElement("p",{role:"status"},n.createElement(nr,null),o||"This workspace folder is unavailable. You can read its saved chats here."),u&&n.createElement("p",{role:"status"},n.createElement(zn,null),"Showing a recovered history backup. Original files are unchanged."),c&&n.createElement("p",{role:"status"},n.createElement(zn,null),"Some saved activity is unavailable or outside the loaded window. Conversation text comes from the saved transcript."),i&&!((h=e.messages)!=null&&h.length)&&n.createElement("p",{role:"status"},n.createElement(Ro,{className:"a-progress-spinner"}),"Loading conversation…"),e.historyError&&n.createElement("div",{className:"a-session-history-error",role:"alert"},n.createElement(zn,null),n.createElement("span",null,e.historyError),n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",disabled:i,onClick:d},"Try again")),s&&n.createElement("button",{type:"button",className:"a-soft","data-action":"session.history",disabled:i,onClick:p},i?"Loading earlier messages…":"Load earlier messages"))}function zL({state:e,act:t,dispatch:a=t,suppressed:r=!1}){var N,x,A,C,O,k,T,I,F;const o=e.canvas||{},i=e.view||{},s=i.canvasDraft||{},l=Lw(e,t),c=v.useRef(null),u=v.useRef(t);u.current=t;const[d,p]=v.useState(null),m=vo(e),h=!!((x=(N=e.canvasWorkspace)==null?void 0:N.views)!=null&&x.length)&&!o.placeholder,f=m.length>0;v.useEffect(()=>{var z,U;!o.open&&((z=c.current)!=null&&z.contains(document.activeElement))&&((U=document.querySelector(".a-canvas-toggle"))==null||U.focus({preventScroll:!0}))},[o.open]);const g=v.useRef(!1);o.open&&(g.current=!0);const y=!r&&!!e.selectedSessionId&&!!o.open&&!!i.canvasFocused,E=!!i.canvasControlsExpanded,b=(C=(A=e.canvasWorkspace)==null?void 0:A.views)==null?void 0:C.find(z=>z.viewId==="primary"),S=z=>hr(t,{canvasDraft:{...s,...z},...z.open||z.browser?{canvasControlsExpanded:!0}:{}});if(rl(c,y,()=>hr(u.current,{canvasFocused:!1})),v.useEffect(()=>{var z,U;y&&((U=(z=c.current)==null?void 0:z.querySelector('[aria-label="Exit canvas focus"]'))==null||U.focus({preventScroll:!0}))},[y]),!g.current)return null;const w=(O=o.events)==null?void 0:O.at(-1);return n.createElement(Ls.Provider,{value:d},n.createElement("aside",{ref:c,id:"workspace-canvas",className:"a-canvas-panel",hidden:r||!o.open||!e.selectedSessionId,inert:r||!o.open||!e.selectedSessionId,"aria-hidden":r||!o.open||!e.selectedSessionId||void 0,"data-part":"canvas","data-focused":y,"data-controls":E,"data-pinned":!!i.canvasControlsPinned,"aria-label":"Agent canvas",role:y?"dialog":void 0,"aria-modal":y||void 0},!y&&!l.overlay&&n.createElement(Dw,{layout:l,pane:"canvas"}),n.createElement("div",{className:"a-canvas-chrome"},n.createElement("header",{className:"a-canvas-head"},l.narrow&&n.createElement("button",{type:"button",className:"a-canvas-back a-soft","data-action":"canvas.visibility",onClick:()=>t("canvas.visibility",{open:!1})},n.createElement(Sa,null),"Back to chat"),n.createElement("button",{type:"button",className:"a-link a-chat-overview-trigger","aria-pressed":!!s.library||!h,onClick:()=>S({library:!s.library,open:!1,browser:!1})},n.createElement(dm,null),"Chat overview"),n.createElement(oS,{state:e,act:t}),((k=b==null?void 0:b.versions)==null?void 0:k.length)>1&&n.createElement("button",{type:"button",className:"a-link a-canvas-version-shortcut","aria-label":"Choose artifact version",onClick:async()=>{await hr(t,{canvasControlsExpanded:!0}),requestAnimationFrame(()=>{var z,U;return(U=(z=c.current)==null?void 0:z.querySelector('[aria-label="Artifact version"]'))==null?void 0:U.focus()})}},"v",b.selectedVersion??b.latestVersion),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Canvas options","aria-expanded":E,"aria-controls":"canvas-options","data-action":"view.update",onClick:()=>hr(t,{canvasControlsExpanded:!E})},n.createElement(Di,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":y?"Exit canvas focus":"Focus canvas","aria-pressed":y,"data-action":"view.update",onClick:()=>hr(t,{canvasFocused:!y})},y?n.createElement(tx,null):n.createElement(Yk,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close canvas panel","data-action":"canvas.visibility",onClick:()=>t("canvas.visibility",{open:!1})},n.createElement(nn,null))),n.createElement("div",{id:"canvas-options",className:"a-canvas-controls",hidden:!E,inert:!E},n.createElement("div",{className:"a-canvas-location"},(h||f)&&n.createElement("details",{className:"a-file-actions-menu"},n.createElement("summary",null,"Open…"),n.createElement("div",{className:"a-canvas-actions"},n.createElement(Ur,{name:"canvas.toolbar"},n.createElement("button",{type:"button",className:"a-soft","aria-label":`Saved artifacts (${vo(e).length})`,"aria-pressed":!!s.library,"data-action":"view.update",onClick:()=>S({library:!s.library,open:!1,browser:!1})},n.createElement(dm,null),"Saved outputs"),n.createElement("button",{type:"button",className:"a-soft","aria-label":"Open a website in canvas","aria-expanded":!!s.browser,"data-action":"view.update",onClick:()=>S({browser:!s.browser,open:!1,library:!1})},n.createElement(vr,null),"Website"),n.createElement("button",{type:"button",className:"a-soft","aria-label":"Open a file in canvas","aria-expanded":!!s.open,"data-action":"view.update",onClick:()=>S({open:!s.open,browser:!1,library:!1})},n.createElement(nr,null),"File")))),o.path&&!s.library&&n.createElement("div",{className:"a-canvas-file-path",title:o.path},o.path)),s.browser&&n.createElement(sS,{state:e,act:t}),s.open&&n.createElement("form",{className:"a-canvas-file-form",onSubmit:z=>{z.preventDefault(),t("canvas.show",{kind:s.kind||"auto",path:s.path||""})}},n.createElement("label",{htmlFor:"canvas-file-path"},"File in this workspace"),n.createElement(Ma,{id:"canvas-file-path",value:s.path||"",onChange:z=>S({path:z}),state:e,act:t,placeholder:"README.md or a full path"}),n.createElement("div",{className:"a-canvas-file-actions"},n.createElement("select",{"aria-label":"Canvas file format",value:s.kind||"auto","data-action":"view.update",onChange:z=>S({kind:z.target.value})},n.createElement("option",{value:"auto"},"Detect automatically"),n.createElement("option",{value:"html"},"HTML"),n.createElement("option",{value:"babylon"},"3D · Babylon.js"),n.createElement("option",{value:"mermaid"},"Mermaid"),n.createElement("option",{value:"dot"},"Graphviz DOT"),n.createElement("option",{value:"json"},"JSON"),n.createElement("option",{value:"jsonl"},"JSONL"),n.createElement("option",{value:"text"},"Text"),n.createElement("option",{value:"markdown"},"Markdown"),n.createElement("option",{value:"code"},"Code"),n.createElement("option",{value:"image"},"Image")),n.createElement("button",{type:"submit",className:"a-primary","data-action":"canvas.show",disabled:!((T=s.path)!=null&&T.trim())},"Open file",n.createElement(en,null)))),n.createElement("div",{ref:p,hidden:!!s.library||!h}))),n.createElement("div",{className:"a-canvas-body"},!!((F=(I=e.canvasWorkspace)==null?void 0:I.views)!=null&&F.length)&&n.createElement(vL,{visible:!r&&!!o.open&&!s.library},n.createElement(AL,{state:e,dispatch:a,hidden:!!s.library})),(s.library||!h)&&n.createElement(dS,{state:e,act:t,changeDraft:S})),w&&n.createElement("div",{className:"a-canvas-event",role:"status"},n.createElement(Pt,null),n.createElement("span",null,"Response recorded · ",w.name),n.createElement("small",null,"The agent can see this response in app state."))))}function Ml(e){var r;const t=e==null?void 0:e.ownership,a=(t==null?void 0:t.source)||((r=e==null?void 0:e.lockOwner)==null?void 0:r.app)||"another application";switch(t==null?void 0:t.status){case"blocked":return t.reason==="takeover-failed"?{blocked:!0,canTakeover:!0,retry:!0,label:"Could not continue here",detail:t.detail||"The takeover did not complete. Your draft is kept. Try again to unlock the message box."}:{blocked:!0,canTakeover:!0,label:`In use by ${a}`,detail:t.detail||(t.supportsTakeover===!1?"This running interface does not support takeover requests. Close it, then choose Continue here.":"Continue here to take over and unlock the message box. Your draft is kept.")};case"yielded":return{blocked:!0,canTakeover:!0,label:`Continued in ${a}`,detail:"This view stays connected. Choose Continue here when you want to resume."};case"yielding":return{blocked:!0,canTakeover:!1,label:`Moving to ${a}`,detail:"Finishing current work and saving the session…"};case"taking-over":return{blocked:!0,canTakeover:!1,label:"Taking over…",detail:"Waiting for the current owner to finish, then loading your session."};case"yield-failed":return{blocked:!0,canTakeover:!1,label:"The session could not be released",detail:t.detail||"Saving or cleanup needs attention. Ownership is retained."};default:return{blocked:!1,canTakeover:!1}}}function _a(e){return e.code==="session_busy"?"":e.message}function Fw(e){if(!e)return{label:"Call it. Text it. Chat with it.",detail:"",busy:!1};const t=Ml(e);if(t.blocked)return{label:t.label,detail:t.detail,busy:!1};const a=e.progress,r=typeof a=="string"?a:(a==null?void 0:a.message)||(a==null?void 0:a.detail)||(a==null?void 0:a.description)||"";switch(e.status){case"starting":return{label:"Preparing your Amplifier session…",detail:r,explanation:"First launch loads your configured bundle and tools. Your message stays in this conversation while Amplifier gets ready.",busy:!0};case"stopping":return{label:"Stopping the current work…",detail:r,busy:!0};case"working":case"running":case"busy":return{label:"Amplifier is working…",detail:r,busy:!0};case"error":case"failed":return{label:"Amplifier needs your attention",detail:"",busy:!1};case"stopped":return{label:"Work stopped. Ready for your next message.",detail:"",busy:!1};default:return{label:"Ready when you are",detail:"",busy:!1}}}function qw({label:e,onClose:t,children:a,initialFocus:r}){const o=v.useRef(null);return rl(o,!0,t),v.useEffect(()=>{var i,s;r&&((s=(i=o.current)==null?void 0:i.querySelector(r))==null||s.focus())},[r]),Mi.createPortal(n.createElement("div",{className:"a-work-dialog-backdrop",onSubmit:i=>i.stopPropagation(),onPaste:i=>i.stopPropagation(),onDrop:i=>i.stopPropagation(),onClick:i=>{i.target===i.currentTarget&&t()}},n.createElement("section",{ref:o,role:"dialog","aria-modal":"true","aria-label":e,className:"a-work-dialog"},n.createElement("div",{className:"a-work-dialog-head"},n.createElement("strong",null,e),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close "+e,onClick:t},n.createElement(nn,null))),a)),document.getElementById("amp-one"))}function LL({state:e,act:t}){var c,u;const[a,r]=v.useState(!1),o=v.useRef(null),i=Ja(e),s=(c=e.workspaces)==null?void 0:c.find(d=>d.path===i.workspace),l=()=>{r(!1),requestAnimationFrame(()=>{var d;return(d=o.current)==null?void 0:d.focus()})};return n.createElement(n.Fragment,null,n.createElement("button",{type:"button",ref:o,className:"a-composer-workspace","aria-label":"Choose workspace","aria-expanded":a,onClick:d=>{d.currentTarget.focus(),r(!0)}},n.createElement(Fr,null),n.createElement("span",null,((u=i.location)==null?void 0:u.kind)==="managed"||!i.workspace?"No workspace":(s==null?void 0:s.name)||i.workspace.split("/").at(-1)),n.createElement(en,null)),a&&n.createElement(qw,{initialFocus:'input[type="search"]',label:"Choose a workspace",onClose:l},n.createElement(Mx,{state:e,act:t,setup:i,onChange:async d=>{const p=await t("view.update",{patch:{newSessionDraft:{...i,...d}}});if(!(p!=null&&p.accepted))throw Error((p==null?void 0:p.error)||"Could not select this workspace.");l()}})))}function DL({state:e,act:t,onClose:a}){const r=v.useContext(zi);return n.createElement(qw,{label:"Workspace",onClose:a},n.createElement(sl,{state:e,act:t,fromDraft:!e.selectedSessionId,onCancel:a,onDone:o=>{a(),o!=null&&o.workspaceId?r.browse("workspace",o.workspaceId):r.browse("workspaces")}}))}function Uw({label:e,children:t,icon:a=n.createElement(Di,null),badge:r}){const o=v.useRef(null),[i,s]=v.useState(!1);return v.useEffect(()=>{var u,d;if(!i)return;(d=(u=o.current)==null?void 0:u.querySelector(".a-work-menu-items button"))==null||d.focus();const l=p=>{var m;(m=o.current)!=null&&m.contains(p.target)||s(!1)},c=p=>{var m,h;p.key==="Escape"&&(s(!1),(h=(m=o.current)==null?void 0:m.querySelector("button"))==null||h.focus())};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",c)}},[i]),n.createElement("div",{className:"a-work-menu",ref:o,onBlur:l=>{l.relatedTarget&&!l.currentTarget.contains(l.relatedTarget)&&s(!1)}},n.createElement("button",{type:"button",className:"a-icon","aria-label":e,"aria-expanded":i,onClick:()=>s(!i)},a,r),i&&n.createElement("div",{className:"a-work-menu-items",role:"group","aria-label":e,onClickCapture:()=>{var l,c;return(c=(l=o.current)==null?void 0:l.querySelector("button"))==null?void 0:c.focus()},onClick:l=>{l.target.closest("button")&&s(!1)}},t))}function FL({state:e,connected:t,open:a,act:r}){return n.createElement("div",{className:"a-work-footer"},n.createElement(Ur,{name:"app.status"},n.createElement("span",{className:`a-dot ${t?"":"pending"}`,title:t?"Connected":"Reconnecting"})),n.createElement("span",{className:"a-nav-reveal"},t?"Connected":"Reconnecting…"),n.createElement(Ur,{name:"app.actions"},n.createElement(Uw,{label:"App options",icon:n.createElement(Hc,null),badge:n.createElement(Da,{state:e})},n.createElement("button",{onClick:()=>a("activity")},n.createElement(lg,null),"Ready for you",n.createElement(Da,{state:e})),n.createElement("button",{onClick:()=>a("settings")},n.createElement(Hc,null),"Settings",n.createElement(Da,{state:e,settings:!0})),n.createElement("button",{onClick:()=>a("feedback")},n.createElement(Dk,null),"Send feedback"),n.createElement("button",{onClick:()=>a("agent")},n.createElement(lx,null),"What the agent sees"))))}function qL({state:e,session:t,act:a,open:r,narrow:o,presentation:i}){var m,h,f,g;const s=v.useContext(zi),l=_s(e),c=l!=="chat",u=!t&&!c?Ja(e):null,d=(m=e.workspaces)==null?void 0:m.find(y=>{var E;return u?((E=u.location)==null?void 0:E.kind)!=="managed"&&y.path===u.workspace:y.id===(c?e.view.workWorkspaceId:e.selectedWorkspaceId)}),p=l==="workspaces"?"All workspaces":l==="chats"?"All chats":l==="workspace"?(d==null?void 0:d.name)||"Workspace":(t==null?void 0:t.title)||"New chat";return n.createElement("header",{className:"a-work-header","data-part":"header"},n.createElement("div",{className:"a-brand a-work-brand"},n.createElement("img",{src:"/branding/icons/amplifier-icon-128.png",alt:""}),n.createElement("span",null,"Amplifier")),(o||!((h=e.view)!=null&&h.navPinned)&&!((f=e.view)!=null&&f.navExpanded))&&n.createElement("button",{type:"button",className:"a-icon a-work-nav-toggle","aria-label":"Open navigation","aria-expanded":!1,"aria-controls":"workspace-navigation","data-action":"view.update",onClick:()=>a("view.update",{patch:{navExpanded:!0,...o?{}:{navPinned:!0},toolbarMenuOpen:!1}})},n.createElement(Du,null),n.createElement(Da,{state:e})),n.createElement(Ur,{name:"conversation.header"},n.createElement("div",{className:"a-work-heading"},l==="chat"&&d&&((g=t==null?void 0:t.location)==null?void 0:g.kind)!=="managed"&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-work-crumb",onClick:()=>s.browse("workspace",d.id)},n.createElement(Fr,null),d.name),n.createElement(en,null)),n.createElement("strong",{title:p},p))),n.createElement("div",{className:"a-work-header-actions"},c&&n.createElement("button",{type:"button",className:"a-link",onClick:()=>s.browse("chat")},n.createElement(Sa,null),t?"Back to chat":"Back"),!c&&t&&n.createElement(n.Fragment,null,n.createElement(Uw,{label:"Chat actions"},n.createElement("button",{onClick:()=>r("session-details")},n.createElement(ug,null),"Chat details"),n.createElement("button",{"data-action":"session.pin",onClick:()=>a("session.pin",{id:t.id,pinned:!(e.pinnedSessionIds||[]).includes(t.id)})},n.createElement(qu,null),(e.pinnedSessionIds||[]).includes(t.id)?"Unpin":"Pin chat"),n.createElement("button",{"data-action":"session.archive",onClick:()=>a("session.archive",{id:t.id})},n.createElement(wi,null),"Archive")),n.createElement(PL,{state:e,act:a,layout:i.layout}))))}function UL({workspace:e,state:t,act:a}){var S,w,N,x,A;const[r,o]=v.useState(e.path),[i,s]=v.useState(""),[l,c]=v.useState(!1),[u,d]=v.useState(""),p="workspace-files-"+e.id,m=((S=t.locationListing)==null?void 0:S.controlId)===p?t.locationListing:null,h=(w=t.actionStatus)==null?void 0:w["locations.list"],f=((N=h==null?void 0:h.target)==null?void 0:N.controlId)===p?h:null,g=l||["queued","working"].includes(f==null?void 0:f.phase),y=i||((f==null?void 0:f.phase)==="error"?f.error:"");v.useEffect(()=>{let C=!0;return c(!0),s(""),Promise.resolve(a("locations.list",{controlId:p,path:r,directoriesOnly:!1})).then(O=>{(O==null?void 0:O.accepted)===!1&&C&&s(O.error||"Could not list files.")}).catch(O=>{C&&s(O.message)}).finally(()=>{C&&c(!1)}),()=>{C=!1}},[r,e.id]);const E=(x=t.sessions)==null?void 0:x.find(C=>C.id===t.selectedSessionId),b=(E==null?void 0:E.workspace)===e.path;return n.createElement("section",{className:"a-work-files","aria-label":"Workspace files"},n.createElement("p",{className:"a-caption"},"Files on ",((A=t.workspaceDefaults)==null?void 0:A.hostLabel)||"this host",". Viewing this list does not add files to a message."),n.createElement("div",{className:"a-work-file-path"},n.createElement("button",{className:"a-icon",type:"button",disabled:r===e.path,"aria-label":"Parent folder",onClick:()=>o((m==null?void 0:m.parent)||e.path)},n.createElement(Sa,null)),n.createElement("code",null,r)),g&&n.createElement("p",{role:"status"},"Loading files…"),y&&n.createElement("p",{role:"alert"},y),(m==null?void 0:m.path)===r&&m.entries.map(C=>n.createElement("div",{className:"a-work-file-row",key:C.path},C.directory?n.createElement(Fr,null):n.createElement(No,null),n.createElement("button",{type:"button",disabled:!C.directory&&!b,onClick:()=>C.directory?o(C.path):a("canvas.openFile",{sessionId:E.id,workspace:e.path,path:C.path}).then(O=>{O!=null&&O.accepted&&a("view.update",{patch:{workSurface:"chat"}})})},C.name),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy path for "+C.name,onClick:()=>navigator.clipboard.writeText(C.path).then(()=>d(C.name),()=>s("Clipboard unavailable."))},n.createElement(rr,null)))),(m==null?void 0:m.truncated)&&n.createElement("p",null,"Showing the first 300 entries. Browse a subfolder to see more."),!b&&n.createElement("p",{className:"a-caption"},"Open a chat in this workspace to preview a file beside it."),u&&n.createElement("p",{role:"status"},"Path copied: ",u))}function jL({host:e,workspaceHost:t,state:a,act:r}){var g,y,E;const o=fo(e,"chats"),i=fo(t||e,"workspaces"),s=ol(),l=v.useContext(zi),c=_s(a),u=i.workspace,d=a.view.workWorkspaceTab||"chats",p=b=>r("view.update",{patch:{workWorkspaceTab:b}}),m=c==="chats"?{...o.view,...(g=o.state.sidebarNavigation)==null?void 0:g.recentView,...o.view.navRecentView,navChatScope:"all"}:{...o.view,navChatScope:"workspace"},h=Es({...o.state,view:m},o.workspace,{section:c==="chats"?"recent":"workspace"}),f=(b,S)=>{var N;if(b!=="view.update"||c!=="chats")return o.act(b,S);const w={...(N=o.state.sidebarNavigation)==null?void 0:N.recentView,...o.view.navRecentView,...S.patch};return Object.hasOwn(S.patch,"navChatPage")||delete w.navChatPage,o.act(b,{patch:{navRecentView:w}})};return n.createElement("div",{className:"a-work-browser","data-part":"work-browser"},n.createElement(go,{model:o}),n.createElement(go,{model:i}),n.createElement("div",{className:"a-work-browser-heading"},n.createElement("div",null,n.createElement("h1",null,c==="workspace"?(u==null?void 0:u.name)||"Workspace unavailable":c==="workspaces"?"Your workspaces":"Your chats"),n.createElement("p",null,c==="workspace"?"A place for related chats and files.":c==="workspaces"?"Keep related work together. Each workspace has its own chats and files.":"Find a conversation and pick up where you left off.")),n.createElement("button",{type:"button",className:"a-primary",onClick:()=>c==="workspaces"?l.create():l.newChat(c==="workspace"?u==null?void 0:u.path:void 0)},n.createElement(Ln,null),c==="workspaces"?"New workspace":"New chat")),c==="workspaces"?n.createElement(ji,{state:i.state,act:i.act,onEdit:i.setDraft,heading:!1,onSelect:b=>l.browse("workspace",b.workspaceId)}):n.createElement(n.Fragment,null,c==="workspace"&&u&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-work-tabs",role:"group","aria-label":"Workspace view"},["chats","files","details"].map(b=>n.createElement("button",{key:b,type:"button","aria-pressed":d===b,"data-action":"view.update",onClick:()=>p(b)},b[0].toUpperCase()+b.slice(1)))),d==="details"&&n.createElement("div",{className:"a-work-details"},n.createElement(Ms,{label:"Folder",value:u.path}),n.createElement("p",null,"Chats are discovered from native Amplifier history for this folder. Files stay in place and are visible from your terminal."),n.createElement("button",{className:"a-soft",onClick:()=>i.setDraft({mode:"rename",id:u.id,name:u.name})},"Rename workspace")),d==="files"&&n.createElement(UL,{key:u.id,workspace:u,state:a,act:r})),c==="chats"&&((E=(y=o.state.sidebarNavigation)==null?void 0:y.pinned)==null?void 0:E.total)>0&&n.createElement("section",{className:"a-browser-pins","aria-label":"Pinned chats"},n.createElement("h2",null,"Pinned"),n.createElement(Gu,{page:o.state.sidebarNavigation.pinned,model:o,now:s})),(c==="chats"||d==="chats")&&n.createElement(Zc,{page:h,model:o,view:m,viewAct:f,now:s,showLocation:c==="chats"})))}function $L({shell:e,state:t,act:a}){const r=e.composition.instances.find(i=>i.package==="builtin.chats"),o=e.composition.instances.find(i=>i.package==="builtin.workspaces");return r?n.createElement(jL,{host:e.hostFor(r),workspaceHost:o?e.hostFor(o):void 0,state:t,act:a}):n.createElement("div",{className:"a-work-browser"},n.createElement("p",null,"Your custom navigation is available in the sidebar. This browser uses the standard Chats component."),n.createElement("a",{href:"?shell=recovery"},"Open with standard navigation"))}function BL({voice:e={},callSession:t,callActive:a,browsing:r,working:o,session:i,act:s,onReturn:l,children:c}){const u=Fw(t).busy||((t==null?void 0:t.workers)||[]).some(p=>["queued","starting","working","running","stopping"].includes(p.status)),d=(t==null?void 0:t.workspaceAvailable)===!1||!!(t!=null&&t.historyReadOnlyReason)||Ml(t).blocked;return n.createElement("div",{className:"a-work-live-controls"},a&&n.createElement("div",{className:"a-call-strip","data-part":"voice"},n.createElement(zu,null),n.createElement("span",null,e.model||"Voice"," · ",e.status),n.createElement("button",{className:"a-icon","aria-label":e.muted?"Unmute microphone":"Mute microphone",title:e.muted?"Unmute microphone":"Mute microphone; replies and work continue","data-action":"call.mute",onClick:()=>s("call.mute",{muted:!e.muted})},e.muted?n.createElement(Xk,null):n.createElement(ex,null)),n.createElement("button",{className:"a-soft",title:"End audio; work continues","data-action":"call.end",onClick:()=>s("call.end")},"End call"),u&&t&&n.createElement("button",{type:"button",className:"a-soft","data-action":"conversation.stop",title:"Stop work in "+(t.title||"this call’s conversation")+"; keep the call connected",disabled:t.status==="stopping"||d,onClick:()=>s("conversation.stop",{sessionId:t.id})},t.status==="stopping"?"Stopping work…":"Stop work"),e.muted&&n.createElement("small",{role:"status"},"Microphone muted. Replies and work continue."),n.createElement("button",{className:"a-link","data-action":"call.keepAwake","aria-pressed":e.keepAwake!==!1,onClick:()=>s("call.keepAwake",{enabled:e.keepAwake===!1})},e.wakeLock==="active"?"Screen staying awake":"Keep screen awake"),e.keepAwake!==!1&&["unsupported","unavailable","released"].includes(e.wakeLock)&&n.createElement("small",{role:"status"},"Screen may lock. Keep this page visible; battery-saving settings can prevent staying awake."),e.audioSessionState==="interrupted"&&n.createElement("small",{role:"status"},"Call audio interrupted by your device. Waiting for audio to become available."),e.microphoneEnded?n.createElement("small",{role:"status"},"Microphone stopped. End this call and start again."):e.microphoneInterrupted&&n.createElement("small",{role:"status"},"Microphone temporarily unavailable."),e.playbackBlocked&&n.createElement("small",{role:"status"},"Voice playback paused. ",n.createElement("button",{type:"button",className:"a-link","data-action":"call.resumeAudio",onClick:()=>s("call.resumeAudio")},"Resume audio")),e.fallbackReason&&n.createElement("small",null,e.fallbackReason)),c,r&&o&&i&&n.createElement("div",{className:"a-call-strip",role:"status"},n.createElement("span",null,i.title||"Chat"," · Working…"),n.createElement("button",{type:"button",className:"a-link",onClick:l},"Back to chat"),n.createElement("button",{type:"button",className:"a-soft","data-action":"conversation.stop",onClick:()=>s("conversation.stop",{sessionId:i.id})},"Stop")))}const HL=`/* The shell uses the current theme's tokens and keeps existing viewers mounted. */ +container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:R().optional().describe("User's language and region preference in BCP 47 format."),timeZone:R().optional().describe("User's timezone in IANA format."),userAgent:R().optional().describe("Host application identifier."),platform:Te([J("web"),J("desktop"),J("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:B({touch:Ae().optional().describe("Whether the device supports touch input."),hover:Ae().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:B({top:be().describe("Top safe area inset in pixels."),right:be().describe("Right safe area inset in pixels."),bottom:be().describe("Bottom safe area inset in pixels."),left:be().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough();B({method:J("ui/notifications/host-context-changed"),params:Pw.describe("Partial context update containing only changed fields.")});var lL=B({method:J("ui/update-model-context"),params:B({content:re(Do).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Ne(R(),He().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),cL=B({method:J("ui/initialize"),params:B({appInfo:Oo.describe("App identification (name and version)."),appCapabilities:aL.describe("Features and capabilities this app provides."),protocolVersion:R().describe("Protocol version this app supports.")})}),uL=B({protocolVersion:R().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Oo.describe("Host application identification and version."),hostCapabilities:nL.describe("Features and capabilities provided by the host."),hostContext:Pw.describe("Rich context about the host environment.")}).passthrough();class dL{constructor(t=window.parent,a){Ke(this,"eventTarget");Ke(this,"eventSource");Ke(this,"messageListener");Ke(this,"onclose");Ke(this,"onerror");Ke(this,"onmessage");Ke(this,"sessionId");Ke(this,"setProtocolVersion");this.eventTarget=t,this.eventSource=a,this.messageListener=r=>{var i,s,l;if(a&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=Ry.safeParse(r.data);o.success?(console.debug("Parsed message",o.data),(i=this.onmessage)==null||i.call(this,o.data)):((s=r.data)==null?void 0:s.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,r):(console.error("Failed to parse message",o.error.message,r),(l=this.onerror)==null||l.call(this,Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,a){t.method!==$z&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){var t;window.removeEventListener("message",this.messageListener),(t=this.onclose)==null||t.call(this)}}var pL=[_w];class mL extends xz{constructor(a,r,o,i){super(i);Ke(this,"_client");Ke(this,"_hostInfo");Ke(this,"_hostCapabilities");Ke(this,"_appCapabilities");Ke(this,"_hostContext",{});Ke(this,"_appInfo");Ke(this,"_initializedReceived",!1);Ke(this,"_registeredEvents",new Set);Ke(this,"_events",new qz);Ke(this,"_methods",new Uz);Ke(this,"setRequestHandler",(...a)=>{let[r,...o]=Nf("request",a)??a;this._methods.claim(r,"setRequestHandler"),super.setRequestHandler.call(this,r,...o)});Ke(this,"setNotificationHandler",(...a)=>{let[r,...o]=Nf("notification",a)??a;this._methods.claim(r,"setNotificationHandler"),super.setNotificationHandler.call(this,r,...o)});Ke(this,"removeRequestHandler",a=>{this._methods.release(a),super.removeRequestHandler(a)});Ke(this,"removeNotificationHandler",a=>{this._methods.release(a),super.removeNotificationHandler(a)});Ke(this,"replaceRequestHandler",(a,...r)=>{this._methods.replace(a),super.setRequestHandler.call(this,a,...r)});Ke(this,"eventSchemas",{sizechange:Gz,sandboxready:Yz,initialized:rL,requestteardown:tL,loggingmessage:ap});Ke(this,"onping");Ke(this,"_onmessage");Ke(this,"_onopenlink");Ke(this,"_ondownloadfile");Ke(this,"_onrequestdisplaymode");Ke(this,"_onupdatemodelcontext");Ke(this,"_oncalltool");Ke(this,"_oncreatesamplingmessage");Ke(this,"_onlistresources");Ke(this,"_onlistresourcetemplates");Ke(this,"_onreadresource");Ke(this,"_onlistprompts");Ke(this,"sendResourceTeardown",this.teardownResource);this._client=a,this._hostInfo=r,this._hostCapabilities=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=(i==null?void 0:i.hostContext)||{},this.replaceRequestHandler("ui/initialize",{params:cL.shape.params,result:uL},s=>this._onAppsInitialize(s)),this.replaceRequestHandler("ping",(s,l)=>{var c;return(c=this.onping)==null||c.call(this,s.params,l),{}}),this.replaceRequestHandler("ui/request-display-mode",{params:Tf.shape.params,result:If},()=>({mode:this._hostContext.displayMode??"inline"}))}_wrapHandler(a,r){let o=super._wrapHandler(a,r);return a==="ui/initialize"||a==="ping"?o:async(i,s)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${a}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),o(i,s))}setEventHandler(a,r){this._ensureEventSlot(a),this._events.setHandler(a,r)}getEventHandler(a){return this._events.getHandler(a)}addEventListener(a,r){this._ensureEventSlot(a),this._events.addEventListener(a,r)}removeEventListener(a,r){this._events.removeEventListener(a,r)}_ensureEventSlot(a){if(this._registeredEvents.has(a))return;let r=this.eventSchemas[a];if(!r)throw Error(`Unknown event: ${String(a)}`);let o=i=>{a==="initialized"&&(this._initializedReceived=!0),this._events.dispatch(a,i)};a==="loggingmessage"?this.setNotificationHandler("notifications/message",i=>{o(i.params)}):this.setNotificationHandler(r.shape.method.value,{params:r.shape.params},i=>o(i)),this._registeredEvents.add(a)}warnIfRequestHandlerReplaced(a,r,o){r&&o&&console.warn(`[MCP Apps] ${a} handler replaced. Previous handler will no longer be called.`)}buildContext(a){return a}assertCapabilityForMethod(a){}assertRequestHandlerCapability(a){}assertNotificationCapability(a){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(a){this.setEventHandler("sizechange",a)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(a){this.setEventHandler("sandboxready",a)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(a){this.setEventHandler("initialized",a)}get onmessage(){return this._onmessage}set onmessage(a){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,a),this._onmessage=a,this.replaceRequestHandler("ui/message",{params:sL.shape.params,result:Kz},async(r,o)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(r,o)})}get onopenlink(){return this._onopenlink}set onopenlink(a){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,a),this._onopenlink=a,this.replaceRequestHandler("ui/open-link",{params:Wz.shape.params,result:Zz},async(r,o)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(r,o)})}get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(a){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,a),this._ondownloadfile=a,this.replaceRequestHandler("ui/download-file",{params:iL.shape.params,result:Jz},async(r,o)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(r,o)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(a){this.setEventHandler("requestteardown",a)}get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(a){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,a),this._onrequestdisplaymode=a,this.replaceRequestHandler("ui/request-display-mode",{params:Tf.shape.params,result:If},async(r,o)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(r,o)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(a){this.setEventHandler("loggingmessage",a)}get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(a){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,a),this._onupdatemodelcontext=a,this.replaceRequestHandler("ui/update-model-context",{params:lL.shape.params,result:Cl},async(r,o)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(r,o)})}get oncalltool(){return this._oncalltool}set oncalltool(a){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,a),this._oncalltool=a,this.replaceRequestHandler("tools/call",async(r,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(r.params,o)})}get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(a){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,a),this._oncreatesamplingmessage=a,this.replaceRequestHandler("sampling/createMessage",async(r,o)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(r.params,o)})}sendToolListChanged(a={}){return this.notification({method:"notifications/tools/list_changed",params:a})}get onlistresources(){return this._onlistresources}set onlistresources(a){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,a),this._onlistresources=a,this.replaceRequestHandler("resources/list",async(r,o)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(r.params,o)})}get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(a){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,a),this._onlistresourcetemplates=a,this.replaceRequestHandler("resources/templates/list",async(r,o)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(r.params,o)})}get onreadresource(){return this._onreadresource}set onreadresource(a){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,a),this._onreadresource=a,this.replaceRequestHandler("resources/read",async(r,o)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(r.params,o)})}sendResourceListChanged(a={}){return this.notification({method:"notifications/resources/list_changed",params:a})}get onlistprompts(){return this._onlistprompts}set onlistprompts(a){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,a),this._onlistprompts=a,this.replaceRequestHandler("prompts/list",async(r,o)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(r.params,o)})}sendPromptListChanged(a={}){return this.notification({method:"notifications/prompts/list_changed",params:a})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(a){let r=a.protocolVersion;return this._appInfo!==void 0&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=a.appCapabilities,this._appInfo=a.appInfo,{protocolVersion:pL.includes(r)?r:_w,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(a){let r={},o=!1;for(let i of Object.keys(a)){let s=this._hostContext[i],l=a[i];hL(s,l)||(r[i]=l,o=!0)}o&&(this._hostContext=a,this.sendHostContextChange(r))}sendHostContextChange(a){return this.notification({method:"ui/notifications/host-context-changed",params:a})}sendToolInput(a){return this.notification({method:"ui/notifications/tool-input",params:a})}sendToolInputPartial(a){return this.notification({method:"ui/notifications/tool-input-partial",params:a})}sendToolResult(a){return this.notification({method:"ui/notifications/tool-result",params:a})}sendToolCancelled(a){return this.notification({method:"ui/notifications/tool-cancelled",params:a})}sendSandboxResourceReady(a){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:a})}teardownResource(a,r){return this.request({method:"ui/resource-teardown",params:a},eL,r)}callTool(a,r){return this.request({method:"tools/call",params:a},r)}listTools(a,r){return this.request({method:"tools/list",params:a},r)}async connect(a){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let r=this._client.getServerCapabilities();if(!r)throw Error("Client server capabilities not available");r.tools&&(this.oncalltool=async(o,i)=>this._client.request({method:"tools/call",params:o},{signal:i.mcpReq.signal}),r.tools.listChanged&&this._client.setNotificationHandler("notifications/tools/list_changed",o=>this.sendToolListChanged(o.params))),r.resources&&(this.onlistresources=async(o,i)=>this._client.request({method:"resources/list",params:o},{signal:i.mcpReq.signal}),this.onlistresourcetemplates=async(o,i)=>this._client.request({method:"resources/templates/list",params:o},{signal:i.mcpReq.signal}),this.onreadresource=async(o,i)=>this._client.request({method:"resources/read",params:o},{signal:i.mcpReq.signal}),r.resources.listChanged&&this._client.setNotificationHandler("notifications/resources/list_changed",o=>this.sendResourceListChanged(o.params))),r.prompts&&(this.onlistprompts=async(o,i)=>this._client.request({method:"prompts/list",params:o},{signal:i.mcpReq.signal}),r.prompts.listChanged&&this._client.setNotificationHandler("notifications/prompts/list_changed",o=>this.sendPromptListChanged(o.params)))}return super.connect(a)}}function hL(e,t){return JSON.stringify(e)===JSON.stringify(t)}const Ow=v.createContext("system");function fL({scheme:e,children:t}){return n.createElement(Ow.Provider,{value:e||"system"},t)}function gL(){return v.useContext(Ow)}const ds="com.microsoft.amplifier/visibility",Mw=v.createContext(!0);function vL({visible:e,children:t}){return n.createElement(Mw.Provider,{value:e},t)}function bL(e){const t=v.useContext(Mw),[a,r]=v.useState(()=>document.visibilityState!=="hidden");return v.useEffect(()=>{const o=()=>r(document.visibilityState!=="hidden");return document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)},[]),e!==!1&&t&&a}const Cu=e=>Array.isArray(e)?e.map(Cu):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,Cu(e[t])])):e;function yL({limit:e=2,maxQueued:t=4,isVisible:a=()=>!0}={}){const r=new Map,o=[];let i=0,s=!1;const l=d=>Object.assign(new Error(d),{backgroundReadPaused:!0}),c=()=>l(s?"This tool view closed.":"Background reads are paused. Refresh when the tool view is visible."),u=()=>{for(;o.length&&i{i--,u()})}};return{run(d,p){if(s||!a())return Promise.reject(c());const m=JSON.stringify(Cu({name:d.name,arguments:d.arguments||{}}));if(r.has(m))return r.get(m);if(i>=e&&o.length>=t)return Promise.reject(l("Too many background reads. Wait for the current refresh to finish."));const h=new Promise((f,g)=>{o.push({run:p,resolve:f,reject:g}),u()}).finally(()=>r.delete(m));return r.set(m,h),h},close(){for(s=!0;o.length;)o.shift().reject(c())}}}async function Af(e,t,a){var i;const r=await St("/api/actions",{method:"POST",body:{id:crypto.randomUUID(),action:e,args:t},signal:a});if(!r.operationId)return r;const o=Date.now()+31e4;for(;Date.now()setTimeout(l,350))}throw new Error("No completion received. Inspect Smart Tools activity before retrying.")}const EL=e=>Object.fromEntries(["viewId","resourceId","resourceRevision","generation"].filter(t=>e[t]!=null).map(t=>[t,e[t]])),pr=(e,t,a={})=>{const r=new URLSearchParams({...EL(e),...a}).toString();return`/api/canvas/${encodeURIComponent(e.id)}/${t}${r?"?"+r:""}`};async function wL(e,t,a){var s;const r=crypto.randomUUID(),o=Date.now()+31e4;let i=await St(pr(e,"tools/call"),{method:"POST",body:{id:r,expectedRevision:e.revision||1,name:t.name,arguments:t.arguments||{}},signal:a});for(;["pending","running","queued"].includes(i.status);){if(a!=null&&a.aborted||Date.now()>=o)throw new Error("No completion received. Inspect Smart Tools activity before retrying; input was not replayed.");await new Promise(l=>setTimeout(l,350)),i=await St(`/api/smart-tools/operations/${encodeURIComponent(r)}`,{signal:a})}if(i.status==="completed"||(s=i.result)!=null&&s.isError)return i.result;throw new Error(i.error||"Tool work was interrupted; it was not replayed.")}function kL(e){const t=()=>window.matchMedia("(prefers-color-scheme: dark)"),[a,r]=v.useState(()=>t().matches?"dark":"light");return v.useEffect(()=>{if(e!=="system")return;const o=t(),i=s=>r(s.matches?"dark":"light");return r(o.matches?"dark":"light"),o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]),e==="dark"||e==="light"?e:a}function xL({canvas:e,act:t,connectionKey:a}){var O,k;const r=v.useRef(null),o=v.useRef(e),i=v.useRef(null),s=v.useRef(null),l=v.useRef(),[c,u]=v.useState({phase:"loading",text:"Connecting tool view…"}),d=v.useRef(null),p=v.useRef(!1),[m,h]=v.useState(null),[f,g]=v.useState(!1),E=v.useRef(null),y=v.useRef(null),b=v.useRef(null),S=v.useRef(null),w=T=>{d.current=T,h(T)},N=kL(gL()),x=bL(e.open!==!1&&!e.visibilityPending),A=v.useRef(x);A.current=x,o.current=e,l.current=N,v.useEffect(()=>{const T=i.current,I=s.current;if(!T||!I||I.theme===N&&I[ds]===x)return;const F={...I,theme:N,[ds]:x};s.current=F,T.setHostContext(F)},[N,x]),v.useEffect(()=>{const T=new AbortController;let I,F=!0,z=!1,q="",W=0,X;const U=yL({isVisible:()=>A.current});let _;const P=()=>{_=void 0};y.current=P;const G=()=>e.readOnlyVersion?Promise.resolve({tools:[]}):_||(_=St(pr(e,"tools"),{signal:T.signal}).catch(j=>{throw _=null,j})),Z=(j,ie)=>{!F||q===j+ie||(q=j+ie,u({phase:j,text:ie}),t("canvas.report",{id:e.id,part:"mcp-app",status:j==="ready"?"ready":j==="error"?"error":"pending",message:ie}))};E.current=Z;const D=()=>{const j=++W;return X=(async()=>{try{const ie=await St(pr(e,"status"),{signal:T.signal});return F&&j===W&&(w(ie),z&&Z(["ready","saved_version"].includes(ie.status)?"ready":"error",ie.message),P()),ie}catch(ie){throw F&&j===W&&Z("error",ie.message),ie}})(),X};b.current=D;const ne=async()=>{let j=D(),ie;for(;F;){try{ie=await j}catch(me){if(j===X)throw me}if(j===X)break;j=X}if(!F)return;if(ie.source!=="available"){Z("error",ie.message);return}s.current={theme:l.current,[ds]:A.current,displayMode:"inline",availableDisplayModes:["inline"],locale:navigator.language},I=new mL(null,{name:"Amplifier Unified",version:"0.6.0"},{serverTools:{},serverResources:{},updateModelContext:{text:{},structuredContent:{}},sandbox:{permissions:{},csp:{connectDomains:[],resourceDomains:[],frameDomains:["blob:"],baseUriDomains:[]}}},{hostContext:s.current}),I.oncalltool=async me=>{var Je,De,ue,ye;const _e=W;try{if(o.current.readOnlyVersion)throw Error("This saved version is read-only. Select Latest for live features.");const Y=(Je=(await G().catch(oe=>{if(T.signal.aborted)throw oe;return{tools:[]}})).tools)==null?void 0:Je.find(oe=>oe.name===me.name),se=()=>wL(e,me,T.signal),je=await(((De=Y==null?void 0:Y.annotations)==null?void 0:De.readOnlyHint)===!0&&((ue=Y==null?void 0:Y.annotations)==null?void 0:ue.destructiveHint)!==!0?U.run(me,se):se());return je!=null&&je.isError?Z("error","The tool reported an error. See its result below."):_e===W&&((ye=d.current)==null?void 0:ye.status)==="ready"&&Z("ready","Tool view connected"),je}catch(M){throw M.backgroundReadPaused||Z("error",M.message),M}},I.onlisttools=G;const Ee=(me,_e={})=>St(pr(e,"resources",{kind:me,..._e}),{signal:T.signal});if(I.onreadresource=me=>Ee("read",{uri:me.uri}),I.onlistresources=me=>Ee("list",me!=null&&me.cursor?{cursor:me.cursor}:{}),I.onlistresourcetemplates=me=>Ee("templates",me!=null&&me.cursor?{cursor:me.cursor}:{}),I.onupdatemodelcontext=async me=>e.readOnlyVersion?{}:(await Af("smartTools.context",{canvasId:e.id,expectedRevision:e.revision||1,context:me},T.signal),{}),I.oninitialized=async()=>{var me,_e,Je,De;z=!0,p.current=!0;try{await I.sendToolInput({arguments:((me=o.current.mcp)==null?void 0:me.toolArguments)||{}});const ue=(_e=o.current.mcp)==null?void 0:_e.operationId,ye=(Je=o.current.mcp)!=null&&Je.savedResult?(await St(pr(e,"result"),{signal:T.signal})).result:ue?(await St(`/api/smart-tools/operations/${encodeURIComponent(ue)}`,{signal:T.signal})).result:(De=o.current.mcp)==null?void 0:De.result;ye&&await I.sendToolResult(ye);const M=d.current;Z(["ready","saved_version"].includes(M==null?void 0:M.status)?"ready":"error",(M==null?void 0:M.message)||"Tool view connected")}catch(ue){Z("error",ue.message)}},I.onerror=me=>Z("error",me.message),await I.connect(new dL(r.current.contentWindow,r.current.contentWindow)),F){i.current=I;const me={...s.current,theme:l.current,[ds]:A.current};s.current=me,I.setHostContext(me),r.current.src=$i(pr(e,"document"))}};p.current=!1,w(null),Z("loading","Checking saved tool view…"),ne().catch(j=>Z("error",j.message));const H=setTimeout(()=>{var j,ie;F&&!z&&Z("error",((j=d.current)==null?void 0:j.source)==="available"?"The saved tool document did not initialize. Reload it to retry. Its scripts must work within the self-contained MCP App sandbox.":((ie=d.current)==null?void 0:ie.message)||"The saved tool document could not be checked. Retry when the host is available.")},15e3);return()=>{F=!1,clearTimeout(H),U.close(),T.abort(),E.current===Z&&(E.current=null),b.current===D&&(b.current=null),y.current===P&&(y.current=null),i.current===I&&(i.current=null),s.current=null,I==null||I.close().catch(()=>{})}},[e.id,e.resourceRevision,e.generation,(O=e.view)==null?void 0:O.reload]),v.useEffect(()=>{var F,z;const T=JSON.stringify([e.id,e.resourceRevision,e.generation,(F=e.view)==null?void 0:F.reload]),I=S.current;S.current={identity:T,connectionKey:a,visible:x},x&&(I==null?void 0:I.identity)===T&&(I.connectionKey!==a||!I.visible)&&((z=b.current)==null||z.call(b).catch(()=>{}))},[a,x,e.id,e.resourceRevision,e.generation,(k=e.view)==null?void 0:k.reload]);const C=async T=>{var I,F,z;g(!0);try{const q=await St(pr(e,"status"));if(w(q),!q.canReconnect)throw new Error(q.message);const W=await Af("smartTools.reconnectView",{canvasId:e.id,expectedBindingRevision:q.bindingRevision,...T?{reviewedContract:T}:{}});w(W),W.status==="ready"&&((I=y.current)==null||I.call(y)),(F=E.current)==null||F.call(E,W.status==="ready"&&p.current?"ready":"error",W.status==="ready"&&!p.current?"Tool reconnected. Reload the saved view to retry initialization.":W.message)}catch(q){try{w(await St(pr(e,"status")))}catch{}(z=E.current)==null||z.call(E,"error",q.message)}finally{g(!1)}};return n.createElement("div",{className:"a-mcp-app-viewer",style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0}},n.createElement(yr,{inline:c.phase==="error"},n.createElement("div",{"data-phase":c.phase,className:`a-mcp-status a-canvas-result ${c.phase==="error"?"error":c.phase==="ready"?"success":""}`,role:"status"},c.phase==="error"?n.createElement(zn,null):c.phase==="ready"?n.createElement(Pt,null):n.createElement(dg,{className:"a-progress-spinner"}),n.createElement("span",null,c.text),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Reconnect tool view","data-action":"smartTools.reconnectView",disabled:f||(m==null?void 0:m.canReconnect)===!1,onClick:()=>C()},n.createElement(Mt,null)),c.phase==="error"&&(m==null?void 0:m.source)==="available"&&n.createElement("button",{type:"button",className:"a-link",style:{whiteSpace:"nowrap"},title:"Reloading resets unfinished inputs in this tool view","data-action":"canvas.view",onClick:()=>t("canvas.view",{id:e.id,patch:{reload:Date.now()}})},"Reload saved view"))),(m==null?void 0:m.review)&&n.createElement("div",{className:"a-canvas-result",role:"region","aria-label":"Review saved tool connection"},n.createElement("p",null,"This older view did not save its action schemas. Reconnecting keeps its saved document and existing action names. Review the current definitions before enabling them; no previous calls will run."),n.createElement("details",null,n.createElement("summary",null,"Existing tool actions (",m.review.tools.length,")"),n.createElement("pre",null,JSON.stringify(m.review.tools,null,2))),n.createElement("button",{type:"button",disabled:f,"data-action":"smartTools.reconnectView",onClick:()=>C(m.review.fingerprint)},"Use reviewed actions in this tab")),e.sharedToolView&&n.createElement("p",{className:"a-caption"},"This view shares tool work with the original conversation."),n.createElement("iframe",{ref:r,title:e.title||"Interactive tool",className:"a-canvas-html",style:{flex:1,minHeight:0},sandbox:"allow-scripts allow-downloads",referrerPolicy:"no-referrer"}))}function SL({surface:e,act:t}){const a=new Map(((e==null?void 0:e.components)||[]).map(o=>[o.id,o])),r=(o,i=[])=>{var d;if(i.length>20||i.includes(o))return null;const s=a.get(o);if(!s)return null;const[l,c]=Object.entries(s.component||{})[0]||[];if(!c)return null;const u=()=>{var p;return(((p=c.children)==null?void 0:p.explicitList)||[]).map(m=>n.createElement(n.Fragment,{key:m},r(m,[...i,o])))};if(l==="Text"){const p=["h1","h2","h3","h4","h5"].includes(c.usageHint)?c.usageHint:"p";return n.createElement(p,{className:"a-canvas-text"},((d=c.text)==null?void 0:d.literalString)||"")}return l==="Row"||l==="Column"?n.createElement("div",{className:`a-canvas-${l.toLowerCase()}`},u()):l==="Card"?n.createElement("div",{className:"a-canvas-card"},r(c.child,[...i,o])):l==="Divider"?n.createElement("hr",null):l==="Button"?n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.event",onClick:()=>t("canvas.event",{surfaceId:e.surfaceId,componentId:o,name:c.action.name})},r(c.child,[...i,o])):null};return n.createElement("div",{className:"a-canvas-surface","data-part":"agent-surface"},r(e==null?void 0:e.root))}const CL=({canvas:e,act:t})=>n.createElement(SL,{surface:e.surface,act:t}),Rs=Object.fromEntries(["markdown","text","code","json","jsonl","image","html","babylon","mermaid","dot"].map(e=>["builtin.canvas."+e,FI]));Object.assign(Rs,{"builtin.canvas.browser":cS,"builtin.canvas.mcp-app":xL,"builtin.canvas.a2ui":CL});const ui=e=>Object.fromEntries(["viewId","resourceId","resourceRevision","generation"].map(t=>[t,e[t]])),ps=new Map;async function NL(e){return ps.has(e)||ps.set(e,import(e).then(t=>{const a=t.default({React:n});if(typeof a!="function")throw Error("The renderer did not export a component.");return a}).catch(t=>{throw ps.delete(e),t})),ps.get(e)}class RL extends n.Component{constructor(){super(...arguments);Ke(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a){this.props.onError(a.message)}render(){return this.state.error?this.props.fallback:this.props.children}}function _f({report:e}){return v.useEffect(()=>{e("ready","Renderer mounted")},[e]),null}function TL({view:e,canvas:t,dispatch:a,recovery:r,connectionKey:o}){const i=JSON.stringify(ui(e)),s=v.useMemo(()=>JSON.parse(i),[i]),l=v.useRef(new Set),c=v.useMemo(()=>({visible:!!t.open,viewId:e.viewId,resource:{id:t.id,kind:t.kind,title:t.title,content:t.content,surface:t.surface,url:t.url,path:t.path,revision:e.resourceRevision},view:t.view||{}}),[t,e.viewId,e.resourceRevision]),u=v.useRef(c);u.current=c,v.useEffect(()=>{l.current.forEach(T=>T())},[c]);const d=v.useMemo(()=>Object.freeze({apiVersion:"1.0",instanceId:s.viewId,viewId:s.viewId,getSnapshot:()=>u.current,subscribe:T=>(l.current.add(T),()=>l.current.delete(T)),readSource:()=>St(`/api/canvas/views/${s.viewId}/source?`+new URLSearchParams(s)).then(T=>T.content),dispatch:(T,I={})=>{const F={"view.update":"canvas.view","view.report":"canvas.report"}[T];return F?a("canvas.views.command",{...s,action:F,args:I}):Promise.reject(Error("Unsupported renderer capability."))},setDirty:T=>a("canvas.views.dirty",{...s,dirty:!!T})}),[s,a]),p=v.useMemo(()=>(T,I)=>{a("canvas.views.status",{...s,status:T,message:String(I).slice(0,2e3)}).catch(()=>{})},[s,a]),m=r&&!e.renderer.startsWith("builtin."),h=v.useMemo(()=>(T,I)=>p(m||!e.available?"error":T,m?"Recovery mode is displaying the standard viewer.":e.available?I:"The saved renderer is unavailable; displaying the standard viewer."),[p,m,e.available]),f=v.useMemo(()=>(T,I)=>{const F=a("canvas.views.command",{...s,action:T,args:I});return T==="canvas.reference"?F:F.catch(()=>{})},[s,a]),g="builtin.canvas."+t.kind,E=Rs[g],y=e.choices.find(T=>T.id===e.renderer),b=r||!y?g:e.renderer,[S,w]=v.useState(null),[N,x]=v.useState("");v.useEffect(()=>{let T=!0;if(w(null),x(""),!Rs[b])return p("loading","Loading renderer"),NL(y.url).then(I=>{T&&w(()=>I)}).catch(I=>{T&&(x(I.message),p("error",I.message))}),()=>{T=!1}},[b,y==null?void 0:y.url,p]);const A=T=>{x(T),p("error",T)},C=E?n.createElement(E,{canvas:t,act:f,connectionKey:o}):n.createElement("p",{role:"alert"},"No standard viewer supports this artifact."),O=Rs[b],k=S;return n.createElement(n.Fragment,null,(N||!y||r)&&n.createElement("div",{role:"status",className:"a-renderer-notice"},r?"Recovery mode uses standard viewers.":N?`This renderer needs attention: ${N}`:"The saved renderer is unavailable. Showing the standard viewer; your artifact is retained.",n.createElement("button",{type:"button",className:"a-link",onClick:()=>a("canvas.views.recover",s)},"Use standard viewer")),O?n.createElement(n.Fragment,null,n.createElement(O,{canvas:t,act:f,connectionKey:o}),n.createElement(_f,{report:h})):k?n.createElement(RL,{onError:A,fallback:C},n.createElement(k,{host:d}),n.createElement(_f,{report:h})):N?C:n.createElement("p",{role:"status"},"Loading viewer…"))}function IL({view:e,state:t,dispatch:a,recovery:r}){var d,p,m,h,f;const[o,i]=v.useState(""),s=v.useMemo(()=>t.canvas?{...t.canvas,...e.app?{app:e.app}:{},...ui(e),view:e.view||t.canvas.view,renderReports:e.renderReports}:null,[t.canvas,e]),l=(p=(d=t.smartTools)==null?void 0:d.servers)==null?void 0:p.find(g=>{var E;return g.id===((E=s==null?void 0:s.mcp)==null?void 0:E.serverId)}),c=JSON.stringify([l==null?void 0:l.status,l==null?void 0:l.catalogState,l==null?void 0:l.catalogRevision,l==null?void 0:l.account,l==null?void 0:l.accountBinding,(m=s==null?void 0:s.mcp)==null?void 0:m.catalogRevision]),u=async(g,E)=>{var y;try{const b=await a(g,E);i(((y=b==null?void 0:b.result)==null?void 0:y.status)==="deferred"?b.result.reason:"")}catch(b){i(b.message)}};return n.createElement(aS,{label:"Artifact controls"},n.createElement("section",{className:"a-resource-view","data-canvas-view":e.viewId,"aria-label":"Artifact view"},n.createElement(yr,null,n.createElement("div",{className:"a-resource-view-controls a-canvas-toolbar"},!!((h=e.versions)!=null&&h.length)&&n.createElement(n.Fragment,null,n.createElement("label",null,"Version",n.createElement("select",{"aria-label":"Artifact version",value:e.selectedVersion??"latest",onChange:g=>u("canvas.select",{id:e.resourceId,...g.target.value==="latest"?{}:{version:Number(g.target.value)}})},n.createElement("option",{value:"latest"},"Latest · Version ",e.latestVersion),e.versions.slice().reverse().map(g=>n.createElement("option",{key:g.version,value:g.version},"Version ",g.version,g.createdAt?" · "+new Date(g.createdAt*1e3).toLocaleString():"")))),e.selectedVersion!=null&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-link",onClick:()=>u("canvas.select",{id:e.resourceId})},"Go to Latest"),(s==null?void 0:s.app)&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>u("canvas.apps.restore",{id:e.resourceId,sessionId:s.sessionId,version:e.selectedVersion,expectedRevision:e.latestVersion,expectedStateRevision:e.latestStateRevision})},"Restore as new version"),!(s!=null&&s.app)&&!["mcp-app","browser"].includes(s==null?void 0:s.kind)&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>u("canvas.versions.restore",{id:e.resourceId,sessionId:s.sessionId,version:e.selectedVersion,expectedRevision:e.latestVersion})},"Restore as new version"))),n.createElement("label",null,"Open with",n.createElement("select",{"aria-label":"Open with",value:e.renderer,onFocus:()=>a("canvas.views.inspect",{}).catch(()=>{}),onChange:g=>u("canvas.views.renderer",{...ui(e),renderer:g.target.value})},!e.available&&n.createElement("option",{value:e.renderer},"Unavailable renderer"),e.choices.map(g=>n.createElement("option",{key:g.id,value:g.id},g.label)))),((f=e.filePaths)==null?void 0:f.absolute)&&n.createElement("details",{className:"a-canvas-file-path"},n.createElement("summary",null,"File path"),n.createElement("div",null,n.createElement("p",null,"On the app server"),n.createElement("code",null,e.filePaths.absolute),n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.copyPath",onClick:()=>u("canvas.views.command",{...ui(e),action:"canvas.copyPath",args:{format:"absolute"}})},"Copy absolute path"),e.filePaths.relative&&n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.copyPath",onClick:()=>u("canvas.views.command",{...ui(e),action:"canvas.copyPath",args:{format:"relative"}})},"Copy relative path"))))),e.selectedVersion!=null&&n.createElement("p",{role:"status",className:"a-renderer-notice"},(s==null?void 0:s.kind)==="browser"?"Saved address · Website is live":"Saved version · Read only"),o&&n.createElement("p",{role:"alert",className:"a-renderer-notice"},o),n.createElement("div",{className:"a-resource-renderer"},s!=null&&s.app?n.createElement(hS,{key:e.resourceId+":"+(e.selectedVersion??"latest"),canvas:s,dispatch:a}):s?n.createElement(TL,{key:e.resourceId+":"+e.resourceRevision+":"+e.generation,view:e,canvas:s,dispatch:a,recovery:r,connectionKey:c}):n.createElement("p",{role:"status"},"Loading saved artifact…"))))}function AL({state:e,dispatch:t,hidden:a=!1}){var l;const r=v.useRef(new Map),o=(((l=e.canvasWorkspace)==null?void 0:l.views)||[]).filter(c=>c.viewId==="primary");for(const c of r.current.keys())o.some(u=>u.viewId===c)||r.current.delete(c);const i=o.filter(c=>{var u;return(u=e.canvas)!=null&&u.open&&r.current.set(c.viewId,c.resourceId),r.current.get(c.viewId)===c.resourceId}),s=typeof location<"u"&&new URLSearchParams(location.search).get("shell")==="recovery";return n.createElement("div",{className:"a-canvas-workspace",hidden:a,inert:a},i.map(c=>n.createElement(IL,{key:c.viewId,view:c,state:e,dispatch:t,recovery:s})))}const Ts=360,_r=300,mr=216;function Nu({available:e=1200,gap:t=12,rail:a=0,navPinned:r=!1,canvasOpen:o=!1,navWidth:i=320,canvasWidth:s=440,priority:l="canvas"}={}){const c=o&&e=Ts+mr+(u?_r+t*2:t),p=e-t*((d||a?1:0)+(u?1:0))-Ts,m=Math.min(16384,Math.max(mr,p-(u?_r:0))),h=Math.min(16384,Math.max(_r,p-(d?mr:a)));let f=d?Math.min(Math.max(mr,i),m):a,g=Math.min(Math.max(_r,s),h);return u&&(l==="nav"?g=Math.max(_r,Math.min(g,p-f)):d&&(f=Math.max(mr,Math.min(f,p-g)))),{overlay:c,docked:d,nav:f,canvas:g,navMax:m,canvasMax:h,expandedNav:d?f:Math.min(Math.max(mr,i),Math.max(mr,e-a))}}const zw=v.createContext(null);function _L({state:e,act:t,children:a,presentation:r={}}){var g,E;const o=Bu(),i=v.useRef(null),[s,l]=v.useState({available:1200,gap:12,rail:0}),[c,u]=v.useState(null);v.useEffect(()=>{const y=i.current;if(!y)return;const b=()=>l({available:y.clientWidth,gap:parseFloat(getComputedStyle(y).columnGap)||0,rail:0}),S=new ResizeObserver(b);return S.observe(y),b(),()=>S.disconnect()},[]);const d=e.view||{},p=(r.layout||d.layout)==="work",m=d.canvasWidth??((r.layout||d.layout)==="conversation"?300:440),h=Nu({...s,navPinned:!o&&!!d.navPinned,canvasOpen:!!e.selectedSessionId&&!!((g=e.canvas)!=null&&g.open),navWidth:d.navWidth,canvasWidth:m,...c}),f=(y,b)=>{var N,x;const S=Nu({...s,navPinned:!o&&!!d.navPinned,canvasOpen:!!e.selectedSessionId&&!!((N=e.canvas)!=null&&N.open),navWidth:d.navWidth,canvasWidth:m,[y]:b,priority:y==="navWidth"?"nav":"canvas"}),w={[y]:Math.round(b)};S.docked&&((x=e.canvas)!=null&&x.open)&&!S.overlay&&(w.navWidth=Math.round(S.nav),w.canvasWidth=Math.round(S.canvas)),u(null),t("view.update",{patch:w})};return n.createElement(zw.Provider,{value:{...h,narrow:o,canvasOnLeft:p,preview:(y,b)=>u({[y]:b,priority:y==="navWidth"?"nav":"canvas"}),cancel:()=>u(null),persist:f}},n.createElement("main",{ref:i,className:"a-layout","data-part":"workspace","data-narrow":o,"data-canvas-open":!!e.selectedSessionId&&!!((E=e.canvas)!=null&&E.open),"data-pane-layout":"","data-canvas-overlay":h.overlay,style:{"--nav-width":h.expandedNav+"px","--canvas-width":h.canvas+"px","--chat-min":Ts+"px"}},a))}function Lw(e,t){var r,o,i,s;return v.useContext(zw)||{...Nu({navPinned:(r=e.view)==null?void 0:r.navPinned,canvasOpen:!!e.selectedSessionId&&((o=e.canvas)==null?void 0:o.open),navWidth:(i=e.view)==null?void 0:i.navWidth,canvasWidth:(s=e.view)==null?void 0:s.canvasWidth}),preview:()=>{},cancel:()=>{},persist:(l,c)=>t("view.update",{patch:{[l]:c}})}}function Dw({layout:e,pane:t}){const a=v.useRef(null),r=t==="nav",o=r?"navWidth":"canvasWidth",i=r?e.nav:e.canvas,s=r?mr:_r,l=r?e.navMax:e.canvasMax,c=p=>Math.round(Math.max(s,Math.min(l,p))),u=r||e.canvasOnLeft?1:-1,d=p=>c(a.current.width+(p.clientX-a.current.x)*u);return n.createElement("div",{className:r?"a-nav-resize":"a-canvas-resize",role:"separator","aria-label":r?"Resize navigation":"Resize canvas","aria-orientation":"vertical","aria-valuemin":s,"aria-valuemax":Math.floor(l),"aria-valuenow":Math.round(i),tabIndex:0,"data-action":"view.update",onPointerDown:p=>{p.preventDefault(),a.current={x:p.clientX,width:i},p.currentTarget.setPointerCapture(p.pointerId)},onPointerMove:p=>{a.current&&e.preview(o,d(p))},onPointerUp:p=>{if(a.current){const m=d(p);a.current=null,e.persist(o,m)}},onPointerCancel:()=>{a.current=null,e.cancel()},onKeyDown:p=>{["ArrowLeft","ArrowRight","Home","End"].includes(p.key)&&(p.preventDefault(),e.persist(o,p.key==="Home"?s:p.key==="End"?Math.floor(l):c(i+(p.key==="ArrowLeft"?-20:20)*u)))}})}const hr=(e,t)=>e("view.update",{patch:t});function PL({state:e,act:t,layout:a}){var i,s;const r=(a||((i=e.view)==null?void 0:i.layout))==="work"?Du:rx,o=!!e.selectedSessionId&&!!((s=e.canvas)!=null&&s.open);return n.createElement("button",{type:"button",className:"a-icon a-canvas-toggle",disabled:!e.selectedSessionId,title:e.selectedSessionId?void 0:"Send a message to start a chat before opening Canvas","aria-label":o?"Close canvas":"Open canvas","aria-pressed":o,"aria-controls":"workspace-canvas","data-action":"canvas.visibility",onClick:()=>{var l;return t("canvas.visibility",{open:!((l=e.canvas)!=null&&l.open)})}},n.createElement(r,null))}function OL({state:e,session:t,act:a,selectSession:r,newSession:o,shell:i,footer:s}){const l=Lw(e,a),c=e.view||{},u=!l.narrow&&!!c.navPinned,d=(u||!!c.navExpanded)&&(!l.narrow||!c.canvasFocused&&!c.panel&&!c.toolbarMenuOpen);c.workspaceDraft;const p=v.useRef(null),m=v.useRef(l.narrow),h=()=>hr(a,{navExpanded:!1});v.useEffect(()=>{l.narrow&&!m.current&&c.navExpanded&&h(),m.current=l.narrow},[l.narrow]),rl(p,l.narrow&&d,h),al(e).find(E=>E.id===e.selectedWorkspaceId);const g=()=>{(o||(()=>a("session.draft",{})))(),u||hr(a,{navExpanded:!1})};return n.createElement(Eg.Provider,{value:d},l.narrow&&d&&n.createElement("div",{className:"a-navigation-scrim",onClick:h}),n.createElement("aside",{ref:p,id:"workspace-navigation",role:l.narrow?"dialog":void 0,"aria-modal":l.narrow&&d||void 0,hidden:!d,inert:!d,className:`a-nav-slot ${u?"is-pinned":""} ${d?"is-expanded":""}`,"data-docked":l.docked,"data-part":"navigation","aria-label":"Workspaces and conversations",onClick:E=>{l.narrow&&E.target.closest('[data-navigation-select],[data-action="session.select"]')&&h()}},n.createElement("div",{className:"a-nav-rail"},n.createElement("div",{className:"a-nav-head"},n.createElement("button",{className:"a-icon",type:"button","aria-label":"Close navigation",title:"Close sidebar","aria-pressed":u,"aria-expanded":d,"data-action":"view.update",onClick:()=>l.narrow?h():hr(a,{navPinned:!1,navExpanded:!1}).then(()=>{var E;typeof document<"u"&&((E=document.querySelector('[aria-label="Open navigation"]'))==null||E.focus())})},l.narrow?n.createElement(nn,null):n.createElement(Du,null),!l.narrow&&n.createElement(Da,{state:e,section:"chats"})),n.createElement("strong",{className:"a-nav-reveal"},"Your work")),n.createElement("button",{className:"a-nav-main",type:"button",onClick:g,"data-action":"session.draft","aria-label":"New chat",title:"New chat"},n.createElement(Ln,null),n.createElement("span",{className:"a-nav-reveal"},"New chat")),n.createElement("div",{className:"a-nav-content a-nav-reveal"},n.createElement(tS,{shell:i})),s),l.docked&&n.createElement(Dw,{layout:l,pane:"nav"})))}function ML({session:e,act:t,onLoadEarlier:a}){var m,h;if(!e)return null;const r=e.workspaceAvailable===!1,o=e.historyReadOnlyReason,i=!!e.historyLoading||e.historyLoaded===!1&&!e.historyError,s=Number(e.sharedHistoryOffset)>0,l=((m=e.historyActivity)==null?void 0:m.diagnostics)||[],c=l.some(f=>["activity_scan_limit","scan_limit","invalid_event","incomplete_event","unreadable_file"].includes(f.code)),u=l.some(f=>f.code==="recovered_backup"),d=()=>t("session.select",{id:e.id}),p=()=>(a==null||a(),t("session.history",{id:e.id,before:e.sharedHistoryOffset,limit:100}));return!i&&!e.historyError&&!s&&!r&&!o&&!c&&!u?null:n.createElement("div",{className:"a-session-history","data-part":"session-history"},(r||o)&&n.createElement("p",{role:"status"},n.createElement(nr,null),o||"This workspace folder is unavailable. You can read its saved chats here."),u&&n.createElement("p",{role:"status"},n.createElement(zn,null),"Showing a recovered history backup. Original files are unchanged."),c&&n.createElement("p",{role:"status"},n.createElement(zn,null),"Some saved activity is unavailable or outside the loaded window. Conversation text comes from the saved transcript."),i&&!((h=e.messages)!=null&&h.length)&&n.createElement("p",{role:"status"},n.createElement(Ro,{className:"a-progress-spinner"}),"Loading conversation…"),e.historyError&&n.createElement("div",{className:"a-session-history-error",role:"alert"},n.createElement(zn,null),n.createElement("span",null,e.historyError),n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",disabled:i,onClick:d},"Try again")),s&&n.createElement("button",{type:"button",className:"a-soft","data-action":"session.history",disabled:i,onClick:p},i?"Loading earlier messages…":"Load earlier messages"))}function zL({state:e,act:t,dispatch:a=t,suppressed:r=!1}){var N,x,A,C,O,k,T,I,F;const o=e.canvas||{},i=e.view||{},s=i.canvasDraft||{},l=Lw(e,t),c=v.useRef(null),u=v.useRef(t);u.current=t;const[d,p]=v.useState(null),m=vo(e),h=!!((x=(N=e.canvasWorkspace)==null?void 0:N.views)!=null&&x.length)&&!o.placeholder,f=m.length>0;v.useEffect(()=>{var z,q;!o.open&&((z=c.current)!=null&&z.contains(document.activeElement))&&((q=document.querySelector(".a-canvas-toggle"))==null||q.focus({preventScroll:!0}))},[o.open]);const g=v.useRef(!1);o.open&&(g.current=!0);const E=!r&&!!e.selectedSessionId&&!!o.open&&!!i.canvasFocused,y=!!i.canvasControlsExpanded,b=(C=(A=e.canvasWorkspace)==null?void 0:A.views)==null?void 0:C.find(z=>z.viewId==="primary"),S=z=>hr(t,{canvasDraft:{...s,...z},...z.open||z.browser?{canvasControlsExpanded:!0}:{}});if(rl(c,E,()=>hr(u.current,{canvasFocused:!1})),v.useEffect(()=>{var z,q;E&&((q=(z=c.current)==null?void 0:z.querySelector('[aria-label="Exit canvas focus"]'))==null||q.focus({preventScroll:!0}))},[E]),!g.current)return null;const w=(O=o.events)==null?void 0:O.at(-1);return n.createElement(Ls.Provider,{value:d},n.createElement("aside",{ref:c,id:"workspace-canvas",className:"a-canvas-panel",hidden:r||!o.open||!e.selectedSessionId,inert:r||!o.open||!e.selectedSessionId,"aria-hidden":r||!o.open||!e.selectedSessionId||void 0,"data-part":"canvas","data-focused":E,"data-controls":y,"data-pinned":!!i.canvasControlsPinned,"aria-label":"Agent canvas",role:E?"dialog":void 0,"aria-modal":E||void 0},!E&&!l.overlay&&n.createElement(Dw,{layout:l,pane:"canvas"}),n.createElement("div",{className:"a-canvas-chrome"},n.createElement("header",{className:"a-canvas-head"},l.narrow&&n.createElement("button",{type:"button",className:"a-canvas-back a-soft","data-action":"canvas.visibility",onClick:()=>t("canvas.visibility",{open:!1})},n.createElement(Sa,null),"Back to chat"),n.createElement("button",{type:"button",className:"a-link a-chat-overview-trigger","aria-pressed":!!s.library||!h,onClick:()=>S({library:!s.library,open:!1,browser:!1})},n.createElement(dm,null),"Chat overview"),n.createElement(oS,{state:e,act:t}),((k=b==null?void 0:b.versions)==null?void 0:k.length)>1&&n.createElement("button",{type:"button",className:"a-link a-canvas-version-shortcut","aria-label":"Choose artifact version",onClick:async()=>{await hr(t,{canvasControlsExpanded:!0}),requestAnimationFrame(()=>{var z,q;return(q=(z=c.current)==null?void 0:z.querySelector('[aria-label="Artifact version"]'))==null?void 0:q.focus()})}},"v",b.selectedVersion??b.latestVersion),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Canvas options","aria-expanded":y,"aria-controls":"canvas-options","data-action":"view.update",onClick:()=>hr(t,{canvasControlsExpanded:!y})},n.createElement(Di,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":E?"Exit canvas focus":"Focus canvas","aria-pressed":E,"data-action":"view.update",onClick:()=>hr(t,{canvasFocused:!E})},E?n.createElement(tx,null):n.createElement(Yk,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close canvas panel","data-action":"canvas.visibility",onClick:()=>t("canvas.visibility",{open:!1})},n.createElement(nn,null))),n.createElement("div",{id:"canvas-options",className:"a-canvas-controls",hidden:!y,inert:!y},n.createElement("div",{className:"a-canvas-location"},(h||f)&&n.createElement("details",{className:"a-file-actions-menu"},n.createElement("summary",null,"Open…"),n.createElement("div",{className:"a-canvas-actions"},n.createElement(Ur,{name:"canvas.toolbar"},n.createElement("button",{type:"button",className:"a-soft","aria-label":`Saved artifacts (${vo(e).length})`,"aria-pressed":!!s.library,"data-action":"view.update",onClick:()=>S({library:!s.library,open:!1,browser:!1})},n.createElement(dm,null),"Saved outputs"),n.createElement("button",{type:"button",className:"a-soft","aria-label":"Open a website in canvas","aria-expanded":!!s.browser,"data-action":"view.update",onClick:()=>S({browser:!s.browser,open:!1,library:!1})},n.createElement(vr,null),"Website"),n.createElement("button",{type:"button",className:"a-soft","aria-label":"Open a file in canvas","aria-expanded":!!s.open,"data-action":"view.update",onClick:()=>S({open:!s.open,browser:!1,library:!1})},n.createElement(nr,null),"File")))),o.path&&!s.library&&n.createElement("div",{className:"a-canvas-file-path",title:o.path},o.path)),s.browser&&n.createElement(sS,{state:e,act:t}),s.open&&n.createElement("form",{className:"a-canvas-file-form",onSubmit:z=>{z.preventDefault(),t("canvas.show",{kind:s.kind||"auto",path:s.path||""})}},n.createElement("label",{htmlFor:"canvas-file-path"},"File in this workspace"),n.createElement(Ma,{id:"canvas-file-path",value:s.path||"",onChange:z=>S({path:z}),state:e,act:t,placeholder:"README.md or a full path"}),n.createElement("div",{className:"a-canvas-file-actions"},n.createElement("select",{"aria-label":"Canvas file format",value:s.kind||"auto","data-action":"view.update",onChange:z=>S({kind:z.target.value})},n.createElement("option",{value:"auto"},"Detect automatically"),n.createElement("option",{value:"html"},"HTML"),n.createElement("option",{value:"babylon"},"3D · Babylon.js"),n.createElement("option",{value:"mermaid"},"Mermaid"),n.createElement("option",{value:"dot"},"Graphviz DOT"),n.createElement("option",{value:"json"},"JSON"),n.createElement("option",{value:"jsonl"},"JSONL"),n.createElement("option",{value:"text"},"Text"),n.createElement("option",{value:"markdown"},"Markdown"),n.createElement("option",{value:"code"},"Code"),n.createElement("option",{value:"image"},"Image")),n.createElement("button",{type:"submit",className:"a-primary","data-action":"canvas.show",disabled:!((T=s.path)!=null&&T.trim())},"Open file",n.createElement(en,null)))),n.createElement("div",{ref:p,hidden:!!s.library||!h}))),n.createElement("div",{className:"a-canvas-body"},!!((F=(I=e.canvasWorkspace)==null?void 0:I.views)!=null&&F.length)&&n.createElement(vL,{visible:!r&&!!o.open&&!s.library},n.createElement(AL,{state:e,dispatch:a,hidden:!!s.library})),(s.library||!h)&&n.createElement(dS,{state:e,act:t,changeDraft:S})),w&&n.createElement("div",{className:"a-canvas-event",role:"status"},n.createElement(Pt,null),n.createElement("span",null,"Response recorded · ",w.name),n.createElement("small",null,"The agent can see this response in app state."))))}function Ml(e){var r;const t=e==null?void 0:e.ownership,a=(t==null?void 0:t.source)||((r=e==null?void 0:e.lockOwner)==null?void 0:r.app)||"another application";switch(t==null?void 0:t.status){case"blocked":return t.reason==="takeover-failed"?{blocked:!0,canTakeover:!0,retry:!0,label:"Could not continue here",detail:t.detail||"The takeover did not complete. Your draft is kept. Try again to unlock the message box."}:{blocked:!0,canTakeover:!0,label:`In use by ${a}`,detail:t.detail||(t.supportsTakeover===!1?"This running interface does not support takeover requests. Close it, then choose Continue here.":"Continue here to take over and unlock the message box. Your draft is kept.")};case"yielded":return{blocked:!0,canTakeover:!0,label:`Continued in ${a}`,detail:"This view stays connected. Choose Continue here when you want to resume."};case"yielding":return{blocked:!0,canTakeover:!1,label:`Moving to ${a}`,detail:"Finishing current work and saving the session…"};case"taking-over":return{blocked:!0,canTakeover:!1,label:"Taking over…",detail:"Waiting for the current owner to finish, then loading your session."};case"yield-failed":return{blocked:!0,canTakeover:!1,label:"The session could not be released",detail:t.detail||"Saving or cleanup needs attention. Ownership is retained."};default:return{blocked:!1,canTakeover:!1}}}function _a(e){return e.code==="session_busy"?"":e.message}function Fw(e){if(!e)return{label:"Call it. Text it. Chat with it.",detail:"",busy:!1};const t=Ml(e);if(t.blocked)return{label:t.label,detail:t.detail,busy:!1};const a=e.progress,r=typeof a=="string"?a:(a==null?void 0:a.message)||(a==null?void 0:a.detail)||(a==null?void 0:a.description)||"";switch(e.status){case"starting":return{label:"Preparing your Amplifier session…",detail:r,explanation:"First launch loads your configured bundle and tools. Your message stays in this conversation while Amplifier gets ready.",busy:!0};case"stopping":return{label:"Stopping the current work…",detail:r,busy:!0};case"working":case"running":case"busy":return{label:"Amplifier is working…",detail:r,busy:!0};case"error":case"failed":return{label:"Amplifier needs your attention",detail:"",busy:!1};case"stopped":return{label:"Work stopped. Ready for your next message.",detail:"",busy:!1};default:return{label:"Ready when you are",detail:"",busy:!1}}}function qw({label:e,onClose:t,children:a,initialFocus:r}){const o=v.useRef(null);return rl(o,!0,t),v.useEffect(()=>{var i,s;r&&((s=(i=o.current)==null?void 0:i.querySelector(r))==null||s.focus())},[r]),Mi.createPortal(n.createElement("div",{className:"a-work-dialog-backdrop",onSubmit:i=>i.stopPropagation(),onPaste:i=>i.stopPropagation(),onDrop:i=>i.stopPropagation(),onClick:i=>{i.target===i.currentTarget&&t()}},n.createElement("section",{ref:o,role:"dialog","aria-modal":"true","aria-label":e,className:"a-work-dialog"},n.createElement("div",{className:"a-work-dialog-head"},n.createElement("strong",null,e),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close "+e,onClick:t},n.createElement(nn,null))),a)),document.getElementById("amp-one"))}function LL({state:e,act:t}){var c,u;const[a,r]=v.useState(!1),o=v.useRef(null),i=Ja(e),s=(c=e.workspaces)==null?void 0:c.find(d=>d.path===i.workspace),l=()=>{r(!1),requestAnimationFrame(()=>{var d;return(d=o.current)==null?void 0:d.focus()})};return n.createElement(n.Fragment,null,n.createElement("button",{type:"button",ref:o,className:"a-composer-workspace","aria-label":"Choose workspace","aria-expanded":a,onClick:d=>{d.currentTarget.focus(),r(!0)}},n.createElement(Fr,null),n.createElement("span",null,((u=i.location)==null?void 0:u.kind)==="managed"||!i.workspace?"No workspace":(s==null?void 0:s.name)||i.workspace.split("/").at(-1)),n.createElement(en,null)),a&&n.createElement(qw,{initialFocus:'input[type="search"]',label:"Choose a workspace",onClose:l},n.createElement(Mx,{state:e,act:t,setup:i,onChange:async d=>{const p=await t("view.update",{patch:{newSessionDraft:{...i,...d}}});if(!(p!=null&&p.accepted))throw Error((p==null?void 0:p.error)||"Could not select this workspace.");l()}})))}function DL({state:e,act:t,onClose:a}){const r=v.useContext(zi);return n.createElement(qw,{label:"Workspace",onClose:a},n.createElement(sl,{state:e,act:t,fromDraft:!e.selectedSessionId,onCancel:a,onDone:o=>{a(),o!=null&&o.workspaceId?r.browse("workspace",o.workspaceId):r.browse("workspaces")}}))}function Uw({label:e,children:t,icon:a=n.createElement(Di,null),badge:r}){const o=v.useRef(null),[i,s]=v.useState(!1);return v.useEffect(()=>{var u,d;if(!i)return;(d=(u=o.current)==null?void 0:u.querySelector(".a-work-menu-items button"))==null||d.focus();const l=p=>{var m;(m=o.current)!=null&&m.contains(p.target)||s(!1)},c=p=>{var m,h;p.key==="Escape"&&(s(!1),(h=(m=o.current)==null?void 0:m.querySelector("button"))==null||h.focus())};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",c)}},[i]),n.createElement("div",{className:"a-work-menu",ref:o,onBlur:l=>{l.relatedTarget&&!l.currentTarget.contains(l.relatedTarget)&&s(!1)}},n.createElement("button",{type:"button",className:"a-icon","aria-label":e,"aria-expanded":i,onClick:()=>s(!i)},a,r),i&&n.createElement("div",{className:"a-work-menu-items",role:"group","aria-label":e,onClickCapture:()=>{var l,c;return(c=(l=o.current)==null?void 0:l.querySelector("button"))==null?void 0:c.focus()},onClick:l=>{l.target.closest("button")&&s(!1)}},t))}function FL({state:e,connected:t,open:a,act:r}){return n.createElement("div",{className:"a-work-footer"},n.createElement(Ur,{name:"app.status"},n.createElement("span",{className:`a-dot ${t?"":"pending"}`,title:t?"Connected":"Reconnecting"})),n.createElement("span",{className:"a-nav-reveal"},t?"Connected":"Reconnecting…"),n.createElement(Ur,{name:"app.actions"},n.createElement(Uw,{label:"App options",icon:n.createElement(Hc,null),badge:n.createElement(Da,{state:e})},n.createElement("button",{onClick:()=>a("activity")},n.createElement(lg,null),"Ready for you",n.createElement(Da,{state:e})),n.createElement("button",{onClick:()=>a("settings")},n.createElement(Hc,null),"Settings",n.createElement(Da,{state:e,settings:!0})),n.createElement("button",{onClick:()=>a("feedback")},n.createElement(Dk,null),"Send feedback"),n.createElement("button",{onClick:()=>a("agent")},n.createElement(lx,null),"What the agent sees"))))}function qL({state:e,session:t,act:a,open:r,narrow:o,presentation:i}){var m,h,f,g;const s=v.useContext(zi),l=_s(e),c=l!=="chat",u=!t&&!c?Ja(e):null,d=(m=e.workspaces)==null?void 0:m.find(E=>{var y;return u?((y=u.location)==null?void 0:y.kind)!=="managed"&&E.path===u.workspace:E.id===(c?e.view.workWorkspaceId:e.selectedWorkspaceId)}),p=l==="workspaces"?"All workspaces":l==="chats"?"All chats":l==="workspace"?(d==null?void 0:d.name)||"Workspace":(t==null?void 0:t.title)||"New chat";return n.createElement("header",{className:"a-work-header","data-part":"header"},n.createElement("div",{className:"a-brand a-work-brand"},n.createElement("img",{src:"/branding/icons/amplifier-icon-128.png",alt:""}),n.createElement("span",null,"Amplifier")),(o||!((h=e.view)!=null&&h.navPinned)&&!((f=e.view)!=null&&f.navExpanded))&&n.createElement("button",{type:"button",className:"a-icon a-work-nav-toggle","aria-label":"Open navigation","aria-expanded":!1,"aria-controls":"workspace-navigation","data-action":"view.update",onClick:()=>a("view.update",{patch:{navExpanded:!0,...o?{}:{navPinned:!0},toolbarMenuOpen:!1}})},n.createElement(Du,null),n.createElement(Da,{state:e})),n.createElement(Ur,{name:"conversation.header"},n.createElement("div",{className:"a-work-heading"},l==="chat"&&d&&((g=t==null?void 0:t.location)==null?void 0:g.kind)!=="managed"&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-work-crumb",onClick:()=>s.browse("workspace",d.id)},n.createElement(Fr,null),d.name),n.createElement(en,null)),n.createElement("strong",{title:p},p))),n.createElement("div",{className:"a-work-header-actions"},c&&n.createElement("button",{type:"button",className:"a-link",onClick:()=>s.browse("chat")},n.createElement(Sa,null),t?"Back to chat":"Back"),!c&&t&&n.createElement(n.Fragment,null,n.createElement(Uw,{label:"Chat actions"},n.createElement("button",{onClick:()=>r("session-details")},n.createElement(ug,null),"Chat details"),n.createElement("button",{"data-action":"session.pin",onClick:()=>a("session.pin",{id:t.id,pinned:!(e.pinnedSessionIds||[]).includes(t.id)})},n.createElement(qu,null),(e.pinnedSessionIds||[]).includes(t.id)?"Unpin":"Pin chat"),n.createElement("button",{"data-action":"session.archive",onClick:()=>a("session.archive",{id:t.id})},n.createElement(wi,null),"Archive")),n.createElement(PL,{state:e,act:a,layout:i.layout}))))}function UL({workspace:e,state:t,act:a}){var S,w,N,x,A;const[r,o]=v.useState(e.path),[i,s]=v.useState(""),[l,c]=v.useState(!1),[u,d]=v.useState(""),p="workspace-files-"+e.id,m=((S=t.locationListing)==null?void 0:S.controlId)===p?t.locationListing:null,h=(w=t.actionStatus)==null?void 0:w["locations.list"],f=((N=h==null?void 0:h.target)==null?void 0:N.controlId)===p?h:null,g=l||["queued","working"].includes(f==null?void 0:f.phase),E=i||((f==null?void 0:f.phase)==="error"?f.error:"");v.useEffect(()=>{let C=!0;return c(!0),s(""),Promise.resolve(a("locations.list",{controlId:p,path:r,directoriesOnly:!1})).then(O=>{(O==null?void 0:O.accepted)===!1&&C&&s(O.error||"Could not list files.")}).catch(O=>{C&&s(O.message)}).finally(()=>{C&&c(!1)}),()=>{C=!1}},[r,e.id]);const y=(x=t.sessions)==null?void 0:x.find(C=>C.id===t.selectedSessionId),b=(y==null?void 0:y.workspace)===e.path;return n.createElement("section",{className:"a-work-files","aria-label":"Workspace files"},n.createElement("p",{className:"a-caption"},"Files on ",((A=t.workspaceDefaults)==null?void 0:A.hostLabel)||"this host",". Viewing this list does not add files to a message."),n.createElement("div",{className:"a-work-file-path"},n.createElement("button",{className:"a-icon",type:"button",disabled:r===e.path,"aria-label":"Parent folder",onClick:()=>o((m==null?void 0:m.parent)||e.path)},n.createElement(Sa,null)),n.createElement("code",null,r)),g&&n.createElement("p",{role:"status"},"Loading files…"),E&&n.createElement("p",{role:"alert"},E),(m==null?void 0:m.path)===r&&m.entries.map(C=>n.createElement("div",{className:"a-work-file-row",key:C.path},C.directory?n.createElement(Fr,null):n.createElement(No,null),n.createElement("button",{type:"button",disabled:!C.directory&&!b,onClick:()=>C.directory?o(C.path):a("canvas.openFile",{sessionId:y.id,workspace:e.path,path:C.path}).then(O=>{O!=null&&O.accepted&&a("view.update",{patch:{workSurface:"chat"}})})},C.name),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy path for "+C.name,onClick:()=>navigator.clipboard.writeText(C.path).then(()=>d(C.name),()=>s("Clipboard unavailable."))},n.createElement(rr,null)))),(m==null?void 0:m.truncated)&&n.createElement("p",null,"Showing the first 300 entries. Browse a subfolder to see more."),!b&&n.createElement("p",{className:"a-caption"},"Open a chat in this workspace to preview a file beside it."),u&&n.createElement("p",{role:"status"},"Path copied: ",u))}function jL({host:e,workspaceHost:t,state:a,act:r}){var g,E,y;const o=fo(e,"chats"),i=fo(t||e,"workspaces"),s=ol(),l=v.useContext(zi),c=_s(a),u=i.workspace,d=a.view.workWorkspaceTab||"chats",p=b=>r("view.update",{patch:{workWorkspaceTab:b}}),m=c==="chats"?{...o.view,...(g=o.state.sidebarNavigation)==null?void 0:g.recentView,...o.view.navRecentView,navChatScope:"all"}:{...o.view,navChatScope:"workspace"},h=Es({...o.state,view:m},o.workspace,{section:c==="chats"?"recent":"workspace"}),f=(b,S)=>{var N;if(b!=="view.update"||c!=="chats")return o.act(b,S);const w={...(N=o.state.sidebarNavigation)==null?void 0:N.recentView,...o.view.navRecentView,...S.patch};return Object.hasOwn(S.patch,"navChatPage")||delete w.navChatPage,o.act(b,{patch:{navRecentView:w}})};return n.createElement("div",{className:"a-work-browser","data-part":"work-browser"},n.createElement(go,{model:o}),n.createElement(go,{model:i}),n.createElement("div",{className:"a-work-browser-heading"},n.createElement("div",null,n.createElement("h1",null,c==="workspace"?(u==null?void 0:u.name)||"Workspace unavailable":c==="workspaces"?"Your workspaces":"Your chats"),n.createElement("p",null,c==="workspace"?"A place for related chats and files.":c==="workspaces"?"Keep related work together. Each workspace has its own chats and files.":"Find a conversation and pick up where you left off.")),n.createElement("button",{type:"button",className:"a-primary",onClick:()=>c==="workspaces"?l.create():l.newChat(c==="workspace"?u==null?void 0:u.path:void 0)},n.createElement(Ln,null),c==="workspaces"?"New workspace":"New chat")),c==="workspaces"?n.createElement(ji,{state:i.state,act:i.act,onEdit:i.setDraft,heading:!1,onSelect:b=>l.browse("workspace",b.workspaceId)}):n.createElement(n.Fragment,null,c==="workspace"&&u&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-work-tabs",role:"group","aria-label":"Workspace view"},["chats","files","details"].map(b=>n.createElement("button",{key:b,type:"button","aria-pressed":d===b,"data-action":"view.update",onClick:()=>p(b)},b[0].toUpperCase()+b.slice(1)))),d==="details"&&n.createElement("div",{className:"a-work-details"},n.createElement(Ms,{label:"Folder",value:u.path}),n.createElement("p",null,"Chats are discovered from native Amplifier history for this folder. Files stay in place and are visible from your terminal."),n.createElement("button",{className:"a-soft",onClick:()=>i.setDraft({mode:"rename",id:u.id,name:u.name})},"Rename workspace")),d==="files"&&n.createElement(UL,{key:u.id,workspace:u,state:a,act:r})),c==="chats"&&((y=(E=o.state.sidebarNavigation)==null?void 0:E.pinned)==null?void 0:y.total)>0&&n.createElement("section",{className:"a-browser-pins","aria-label":"Pinned chats"},n.createElement("h2",null,"Pinned"),n.createElement(Gu,{page:o.state.sidebarNavigation.pinned,model:o,now:s})),(c==="chats"||d==="chats")&&n.createElement(Zc,{page:h,model:o,view:m,viewAct:f,now:s,showLocation:c==="chats"})))}function $L({shell:e,state:t,act:a}){const r=e.composition.instances.find(i=>i.package==="builtin.chats"),o=e.composition.instances.find(i=>i.package==="builtin.workspaces");return r?n.createElement(jL,{host:e.hostFor(r),workspaceHost:o?e.hostFor(o):void 0,state:t,act:a}):n.createElement("div",{className:"a-work-browser"},n.createElement("p",null,"Your custom navigation is available in the sidebar. This browser uses the standard Chats component."),n.createElement("a",{href:"?shell=recovery"},"Open with standard navigation"))}function BL({voice:e={},callSession:t,callActive:a,browsing:r,working:o,session:i,act:s,onReturn:l,children:c}){const u=Fw(t).busy||((t==null?void 0:t.workers)||[]).some(p=>["queued","starting","working","running","stopping"].includes(p.status)),d=(t==null?void 0:t.workspaceAvailable)===!1||!!(t!=null&&t.historyReadOnlyReason)||Ml(t).blocked;return n.createElement("div",{className:"a-work-live-controls"},a&&n.createElement("div",{className:"a-call-strip","data-part":"voice"},n.createElement(zu,null),n.createElement("span",null,e.model||"Voice"," · ",e.status),n.createElement("button",{className:"a-icon","aria-label":e.muted?"Unmute microphone":"Mute microphone",title:e.muted?"Unmute microphone":"Mute microphone; replies and work continue","data-action":"call.mute",onClick:()=>s("call.mute",{muted:!e.muted})},e.muted?n.createElement(Xk,null):n.createElement(ex,null)),n.createElement("button",{className:"a-soft",title:"End audio; work continues","data-action":"call.end",onClick:()=>s("call.end")},"End call"),u&&t&&n.createElement("button",{type:"button",className:"a-soft","data-action":"conversation.stop",title:"Stop work in "+(t.title||"this call’s conversation")+"; keep the call connected",disabled:t.status==="stopping"||d,onClick:()=>s("conversation.stop",{sessionId:t.id})},t.status==="stopping"?"Stopping work…":"Stop work"),e.muted&&n.createElement("small",{role:"status"},"Microphone muted. Replies and work continue."),n.createElement("button",{className:"a-link","data-action":"call.keepAwake","aria-pressed":e.keepAwake!==!1,onClick:()=>s("call.keepAwake",{enabled:e.keepAwake===!1})},e.wakeLock==="active"?"Screen staying awake":"Keep screen awake"),e.keepAwake!==!1&&["unsupported","unavailable","released"].includes(e.wakeLock)&&n.createElement("small",{role:"status"},"Screen may lock. Keep this page visible; battery-saving settings can prevent staying awake."),e.audioSessionState==="interrupted"&&n.createElement("small",{role:"status"},"Call audio interrupted by your device. Waiting for audio to become available."),e.microphoneEnded?n.createElement("small",{role:"status"},"Microphone stopped. End this call and start again."):e.microphoneInterrupted&&n.createElement("small",{role:"status"},"Microphone temporarily unavailable."),e.playbackBlocked&&n.createElement("small",{role:"status"},"Voice playback paused. ",n.createElement("button",{type:"button",className:"a-link","data-action":"call.resumeAudio",onClick:()=>s("call.resumeAudio")},"Resume audio")),e.fallbackReason&&n.createElement("small",null,e.fallbackReason)),c,r&&o&&i&&n.createElement("div",{className:"a-call-strip",role:"status"},n.createElement("span",null,i.title||"Chat"," · Working…"),n.createElement("button",{type:"button",className:"a-link",onClick:l},"Back to chat"),n.createElement("button",{type:"button",className:"a-soft","data-action":"conversation.stop",onClick:()=>s("conversation.stop",{sessionId:i.id})},"Stop")))}const HL=`/* The shell uses the current theme's tokens and keeps existing viewers mounted. */ #amp-one.a-approachable-shell{padding:0 12px 12px;height:100dvh;gap:0;--a-work-row-height:40px} #amp-one.a-approachable-shell .a-layout{gap:12px;padding:0} #amp-one.a-approachable-shell .a-nav-rail{padding:10px 8px 0;inset:0 auto 0 0} @@ -836,13 +836,13 @@ container holding the app. Specify either width or maxWidth, and either height o #amp-one .a-canvas-controls[hidden]{display:none!important} #amp-one .a-canvas-version-shortcut{white-space:nowrap;flex:0 0 auto;font-size:12px} #amp-one .a-canvas-unsaved{margin:0;padding:6px 14px;color:var(--a-muted);font-size:12px} -`;var Pf={version:"0.20.45",id:"c3304b45fe6d541f"};const Ru=typeof Pf>"u"?{version:"dev",id:"dev"}:Pf,Ei=new Map;let jw="unknown";function ti(e){jw=["connecting","open","reconnecting","closed"].includes(e)?e:"unknown"}function VL(){const e=Symbol();return Ei.set(e,Date.now()),()=>Ei.delete(e)}function $w(e,t=globalThis){var l,c,u,d,p,m,h;const a=t.navigator||{},r=a.userAgent||"",o=r.match(/(Edg)\/([0-9.]+)/)||r.match(/(Firefox)\/([0-9.]+)/)||r.match(/(Chrome)\/([0-9.]+)/)||r.match(/(Version)\/([0-9.]+)/),i=!!((l=t.matchMedia)!=null&&l.call(t,"(prefers-color-scheme: dark)").matches),s=["light","dark","system"].includes((c=e==null?void 0:e.view)==null?void 0:c.scheme)?e.view.scheme:"system";return{frontendVersion:Ru.version,frontendBuild:Ru.id,browser:o?{Edg:"Edge",Firefox:"Firefox",Chrome:"Chrome",Version:"Safari"}[o[1]]:"Other",browserVersion:(o==null?void 0:o[2])||"",deviceOS:/Android/.test(r)?"Android":/iPhone|iPad|iPod/.test(r)?"iOS":/Windows/.test(r)?"Windows":/Macintosh/.test(r)?"macOS":/Linux/.test(r)?"Linux":"Other",width:Math.min(32768,t.innerWidth||0),height:Math.min(32768,t.innerHeight||0),pixelRatio:Math.min(16,t.devicePixelRatio||1),colorPreference:i?"dark":"light",appearance:s,resolvedAppearance:s==="system"?i?"dark":"light":s,standalone:!!((u=t.matchMedia)!=null&&u.call(t,"(display-mode: standalone)").matches||a.standalone),secureContext:!!t.isSecureContext,online:a.onLine!==!1,eventStream:jw,serviceWorkerControlled:!!((d=a.serviceWorker)!=null&&d.controller),reducedMotion:!!((p=t.matchMedia)!=null&&p.call(t,"(prefers-reduced-motion: reduce)").matches),visible:((m=t.document)==null?void 0:m.visibilityState)!=="hidden",pageAgeSeconds:Math.min(31536e3,Math.floor((((h=t.performance)==null?void 0:h.now())||0)/1e3)),pendingActions:Ei.size,oldestPendingMs:Ei.size?Date.now()-Math.min(...Ei.values()):0}}function WL(e,t){const a=r=>typeof r=="string"&&/^[a-f0-9]{12,64}$/.test(r);return a(e==null?void 0:e.id)&&a(t==null?void 0:t.id)&&(e.id!==t.id||e.version!==t.version)}async function ZL({prepare:e,reload:t}){await e(),t()}const Bw=v.createContext(null);function JL({enabled:e,blocked:t,prepare:a}){const[r,o]=v.useState(null),[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(a);d.current=a,v.useEffect(()=>{if(!e)return;let m=!0,h=!1;const f=new AbortController,g=async()=>{if(!(h||document.hidden)){h=!0;try{const E=await fetch("/build.json",{cache:"no-store",credentials:"same-origin",signal:f.signal});if(E.ok){const b=await E.json();m&&o(WL(Ru,b)?b:null)}}catch{}finally{h=!1}}};g();const y=setInterval(g,6e4);return window.addEventListener("focus",g),window.addEventListener("amplifier-reconnected",g),document.addEventListener("visibilitychange",g),()=>{m=!1,f.abort(),clearInterval(y),window.removeEventListener("focus",g),window.removeEventListener("amplifier-reconnected",g),document.removeEventListener("visibilitychange",g)}},[e]);const p=async()=>{if(!(!r||t||u.current)){u.current=!0,s(!0),c("");try{await ZL({prepare:()=>d.current(),reload:()=>window.location.reload()})}catch(m){c(m.message||"Your changes could not be saved. Try again when connected."),u.current=!1,s(!1)}}};return{available:!!r,version:r==null?void 0:r.version,busy:i,blocked:t,error:l,reload:p}}function Hw(){const e=v.useContext(Bw);return e!=null&&e.available?n.createElement("aside",{className:"a-reload-notice","data-part":"app-reload","aria-label":"App update ready"},n.createElement(Mt,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,"Update ready—reload to finish"),n.createElement("p",null,e.blocked||"Load the updated app in this tab. Your chats and saved settings stay in place."),e.error&&n.createElement("p",{role:"alert"},e.error)),n.createElement("button",{type:"button",className:"a-primary",disabled:e.busy||!!e.blocked,onClick:e.reload},e.busy?"Saving before reload…":"Reload now")):null}const Kr=v.createContext({compact:!1,active:!0,footer:null});function Rn({children:e,active:t=!0,className:a=""}){const r=v.useContext(Kr);if(r.compact&&!t)return null;const o=n.createElement("div",{className:"a-dialog-actions "+a},e);return r.compact&&r.active&&r.footer&&t?Mi.createPortal(o,r.footer):o}function KL(e){const[t,a]=v.useState(()=>typeof window<"u"&&window.matchMedia("(max-width:959px)").matches);return v.useLayoutEffect(()=>{var s;const r=((s=e.current)==null?void 0:s.closest(".a-overlay"))||e.current;if(!r)return;const o=()=>a(r.clientWidth<960);o();const i=new ResizeObserver(o);return i.observe(r),()=>i.disconnect()},[]),t}function YL(e,t){v.useEffect(()=>{var l;const a=(l=e.current)==null?void 0:l.closest(".a-overlay"),r=window.visualViewport;if(!t||!a||!r)return;let o;const i=()=>{r.scale===1&&(a.style.setProperty("--a-settings-viewport-top",r.offsetTop+"px"),a.style.setProperty("--a-settings-viewport-height",r.height+"px"),cancelAnimationFrame(o),o=requestAnimationFrame(()=>{var m;const c=document.activeElement;if(!((m=e.current)!=null&&m.contains(c))||!c.matches("input,textarea,select"))return;const u=c.closest(".a-settings-content");if(!u)return;const d=c.getBoundingClientRect(),p=u.getBoundingClientRect();d.bottom>p.bottom-16?u.scrollTop+=d.bottom-p.bottom+16:d.top{cancelAnimationFrame(o),r.removeEventListener("resize",i),r.removeEventListener("scroll",i),s.removeEventListener("focusin",i),a.style.removeProperty("--a-settings-viewport-top"),a.style.removeProperty("--a-settings-viewport-height")}},[t])}function GL({compact:e,trail:t,view:a,act:r,close:o,body:i,navigationRef:s,confirmClose:l=()=>Promise.resolve(!0),hasUnsaved:c=()=>!1}){const u=v.useRef(null),d=v.useRef(null),p=v.useRef(new Map),m=v.useRef(null),h=v.useRef(!1),[f,g]=v.useState(!1),y=v.useRef(!1);u.current={trail:t,view:a,act:r,close:o,confirmClose:l};const E=t.at(-1),b=E.key,S=v.useRef(a.settingsRootVisit);v.useEffect(()=>{const A=S.current!==a.settingsRootVisit;S.current=a.settingsRootVisit,m.current=b,h.current=!0;const C=requestAnimationFrame(()=>{i.current&&(i.current.scrollTop=A?0:p.current.get(b)||0),h.current=!1});return()=>cancelAnimationFrame(C)},[b,a.settingsRootVisit]);const w=()=>{i.current&&!h.current&&p.current.set(m.current,i.current.scrollTop)};v.useLayoutEffect(()=>{var z;if(!e||typeof window>"u")return;const A=(z=history.state)==null?void 0:z.amplifierSettings,C=typeof(A==null?void 0:A.token)=="string"&&A.token.startsWith("settings-")&&Number.isInteger(A.index)&&A.index>0&&A.index<10?A:null,O=(C==null?void 0:C.token)||"settings-"+crypto.randomUUID(),k={...history.state};delete k.amplifierSettings;const T={token:O,entries:C?[...u.current.trail]:[],index:(C==null?void 0:C.index)||0,closing:!1};d.current=T;const I=U=>{T.entries.splice(T.index),T.entries.push(U),T.index=T.entries.length,history.pushState({...k,amplifierSettings:{token:O,index:T.index}},"")};C||u.current.trail.forEach(I);const F=async U=>{var P,G;const H=(P=U.state)==null?void 0:P.amplifierSettings;if((H==null?void 0:H.token)!==O){if(T.confirming)return;if(T.closing){u.current.close();return}T.confirming=!0,g(!0);const W=await u.current.confirmClose();if(T.confirming=!1,W)T.closing=!0,u.current.close();else for(let D=1;D<=T.index;D++)history.pushState({...k,amplifierSettings:{token:O,index:D}},"");g(!1);return}T.index=H.index;const te=T.entries[T.index-1];if(!te)return;const j=Object.keys(te.navigation).find(W=>{var D;return((D=te.navigation[W])==null?void 0:D.orderOpen)===!0});if(j&&!((G=u.current.view[j])!=null&&G.order)){history.back();return}const _={...te.navigation};for(const W of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])_[W]&&(_[W]={...u.current.view[W],..._[W]});u.current.act("view.update",{patch:_})};return window.addEventListener("popstate",F),()=>{var U,H;window.removeEventListener("popstate",F),d.current=null,((H=(U=history.state)==null?void 0:U.amplifierSettings)==null?void 0:H.token)===O&&!T.closing&&history.go(-T.index)}},[e]),v.useLayoutEffect(()=>{const A=d.current;if(!e||!A||A.closing||A.confirming)return;const C=A.entries[A.index-1];if(t.forEach((O,k)=>{A.entries[k]=O}),A.index>t.length){history.go(t.length-A.index);return}if(A.index===t.length){(C==null?void 0:C.key)!==b&&history.replaceState({...history.state,amplifierSettings:{token:A.token,index:A.index}},"");return}for(;A.index{const A=d.current;if(A&&A.index>1)w(),history.back();else if(t.length>1){const C=t.at(-2),O={...C.navigation};for(const k of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])O[k]&&(O[k]={...a[k],...O[k]});r("view.update",{patch:O})}else x()},x=async()=>{if(y.current)return;y.current=!0;const A=d.current;A&&(A.confirming=!0),g(!0);const C=await u.current.confirmClose();A&&(A.confirming=!1),C&&(A&&!A.closing?(A.closing=!0,history.go(-A.index)):o()),y.current=!1,g(!1)};return v.useEffect(()=>(s&&(s.current={close:x,confirmClose:l,hasUnsaved:c}),()=>{s&&(s.current=null)})),{back:N,dismiss:x,rememberScroll:w}}function QL(e){const[t,a]=v.useState(()=>typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches);return v.useEffect(()=>{const r=matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e==="dark"||e==="system"&&t?"dark":"light"}function XL({root:e,state:t,shell:a,scheme:r,mode:o,preview:i,css:s}){var l,c;v.useLayoutEffect(()=>{var h,f,g,y,E;if(!e.current||!a.ready||i||(h=t==null?void 0:t.view)!=null&&h.themePreview||(f=a.data)!=null&&f.preview)return;const u=getComputedStyle(e.current),d={};try{Object.assign(d,(g=JSON.parse(sessionStorage.getItem("amplifier.appearance")||"null"))==null?void 0:g.colors)}catch{}d[o]={background:u.backgroundColor,foreground:u.color};const p=(E=(y=t==null?void 0:t.theme)==null?void 0:y.definition)==null?void 0:E.palette;if(p)for(const b of["light","dark"])d[b]={background:p[b].bg,foreground:p[b].ink};const m={version:1,scheme:["light","dark","system"].includes(r)?r:"light",colors:d};try{sessionStorage.setItem("amplifier.appearance",JSON.stringify(m))}catch{}document.documentElement.style.colorScheme=o,document.documentElement.style.setProperty("--boot-bg",d[o].background),document.documentElement.style.setProperty("--boot-ink",d[o].foreground)},[e,a.ready,(l=a.data)==null?void 0:l.preview,(c=t==null?void 0:t.view)==null?void 0:c.themePreview,t==null?void 0:t.theme,r,o,i,s])}function eD({shell:e,onError:t}){const a=e.composition.presentation.decorations!==!1,[r,o]=v.useState(!1),[i,s]=v.useState(a);v.useEffect(()=>{r||s(a)},[a,r]);async function l(c){const u=c.target.checked;s(u),o(!0);try{await e.setPresentation({decorations:u})}catch(d){s(a),t(d.message)}finally{o(!1)}}return n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:i,disabled:r,"data-action":"shell.changes.apply",onChange:l}),"Show decorative theme background")}const tD={bg:"#e9ecf5",surface:"#ffffff",ink:"#23304d",accent:"#6353c7",line:"#d7ddec"};function nD({item:e}){const t={...tD,...e.palette};return n.createElement("div",{className:"a-appearance-swatch","aria-hidden":"true",style:{"--sw-bg":t.bg,"--sw-surface":t.surface,"--sw-ink":t.ink,"--sw-accent":t.accent,"--sw-line":t.line,"--sw-radius":e.radius||"12px",backgroundImage:e.background||"none",fontFamily:e.heading||"inherit",backgroundSize:e.id==="builtin:graphite"?"16px 16px":"cover"}},n.createElement("div",{className:"a-swatch-header"},n.createElement("span",null,"◉ Amplifier"),n.createElement("span",null,"•••")),n.createElement("div",{className:"a-swatch-body"},n.createElement("div",{className:"a-swatch-nav"},n.createElement("i",null),n.createElement("i",null),n.createElement("i",null)),n.createElement("div",{className:"a-swatch-chat"},n.createElement("strong",null,"Room for ideas."),n.createElement("span",{className:"a-swatch-line"}),n.createElement("span",{className:"a-swatch-line short"}),n.createElement("div",{className:"a-swatch-prompt"},n.createElement("span",null,"Ask anything…"),n.createElement("b",null,"↑")))))}function aD({state:e,shell:t,act:a,name:r,css:o,preview:i,setName:s,setCss:l,setPreview:c,defaultSkin:u,simple:d=!1,advancedOnly:p=!1,onAdvanced:m}){var ke,me,_e,Je,De;const{active:h}=v.useContext(Kr),[f,g]=v.useState(""),[y,E]=v.useState({items:[],errors:[],directory:""}),[b,S]=v.useState(null),[w,N]=v.useState(!1),[x,A]=v.useState(""),[C,O]=v.useState(""),[k,T]=v.useState(!1),I=v.useRef(a),F=v.useRef(!0),z=v.useRef(0),U=v.useRef(i);I.current=a,U.current=i;const H=t.composition.presentation,te=H.scheme||((ke=e.view)==null?void 0:ke.scheme)||"system";async function j(){var ye;const ue=await I.current("theme.list",{});if(!Array.isArray((ye=ue.result)==null?void 0:ye.items))throw Error("The appearance library is unavailable. Try reopening Settings.");F.current&&(E(ue.result),g(""))}v.useEffect(()=>{if(!h)return;F.current=!0,j().catch(ye=>g(ye.message));const ue=setInterval(()=>j().catch(()=>{}),5e3);return()=>{F.current=!1,z.current++,clearInterval(ue),U.current&&(c(!1),I.current("view.update",{patch:{themePreview:!1}}).catch(()=>{}))}},[h]);async function _(ue){N(!0),A(""),O("");try{await ue()}catch(ye){F.current&&A(ye.message)}finally{F.current&&N(!1)}}async function P(ue){const ye=++z.current;await _(async()=>{const{result:M}=await I.current("theme.read",{id:ue.id});if(!F.current||ye!==z.current)return;S(ue.id),s(M.name),l(M.css);const Y=await I.current(d?"theme.apply":"theme.preview",{name:M.name,css:M.css});if((Y==null?void 0:Y.accepted)===!1)throw Error(Y.error||"Could not save appearance.");c(!d),d&&O(M.name+" saved.")})}async function G(){await _(async()=>{await I.current("theme.apply",{name:r,css:o}),c(!1),O(r+" applied.")})}async function W(){await _(async()=>{var ue,ye;i&&await I.current("theme.revert",{}),c(!1),s(((ue=e.theme)==null?void 0:ue.name)||"Amplifier Unified"),l(((ye=e.theme)==null?void 0:ye.css)||u),S(null)})}async function D(ue){"name"in ue&&s(ue.name),"css"in ue&&l(ue.css),S(null),c(!1),await I.current("view.update",{patch:{themeDraft:ue.css??o,themeDraftName:ue.name??r,themePreview:!1}})}async function ne(){await _(async()=>{const{result:ue}=await I.current("theme.save",{name:r,css:o});S(ue.id),await j(),O("Saved to your appearance library.")})}async function q(ue){if(!ue)return;if(ue.size>99e4)throw Error("Choose a CSS appearance smaller than 1 MB.");const ye=await ue.text(),M=ue.name.replace(/\.amplifier\.css$|\.css$/i,"").slice(0,100),{result:Y}=await I.current("theme.save",{name:M,css:ye});return await j(),O(M+" added to your library. Select it to preview."),Y}const Z=b||(((me=e.theme)==null?void 0:me.name)==="Amplifier Unified"?"builtin:default":(_e=y.items.find(ue=>{var ye;return ue.name===((ye=e.theme)==null?void 0:ye.name)}))==null?void 0:_e.id),ie=ue=>_(()=>t.setPresentation(ue));return n.createElement("div",{className:"a-appearance-settings","data-appearance-simple":d,"data-appearance-advanced":p},n.createElement("div",{className:"a-appearance-intro"},n.createElement("div",null,d?n.createElement("p",null,"Choose a look. Your choice is saved automatically."):n.createElement(n.Fragment,null,n.createElement("p",null,"Make this space yours."),n.createElement("small",null,"Choose an appearance to try it. Apply when it feels right."))),!d&&n.createElement("span",{className:"a-appearance-current"},n.createElement(Bc,{size:14}),i?"Previewing "+r:((Je=e.theme)==null?void 0:Je.name)||"Amplifier")),d&&n.createElement("h4",{className:"a-appearance-label"},"Look & feel"),n.createElement("div",{className:"a-appearance-gallery","aria-label":"Appearance library"},y.items.map(ue=>n.createElement("button",{type:"button",key:ue.id,className:"a-appearance-card","aria-label":(d?"Use ":"Preview ")+ue.name,"aria-pressed":Z===ue.id,disabled:w,"data-action":d?"theme.apply":"theme.preview",onClick:()=>P(ue)},n.createElement(nD,{item:ue}),n.createElement("div",{className:"a-appearance-card-caption"},n.createElement("div",null,n.createElement("strong",null,ue.name),!d&&n.createElement("small",null,ue.tag)),Z===ue.id?n.createElement(Pt,null):n.createElement(Bc,null)),!d&&n.createElement("p",null,ue.description))),!y.items.length&&!f&&n.createElement("p",{role:"status"},"Loading appearances…")),i&&n.createElement("div",{className:"a-appearance-preview",role:"status"},n.createElement("span",null,i?"Previewing "+r:"Current appearance"),n.createElement("div",null,i&&n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:W},"Cancel preview"),n.createElement("button",{type:"button",className:"a-primary",disabled:w||!i,"data-action":"theme.apply",onClick:G},n.createElement(Pt,null),d?"Apply appearance":"Use "+r))),(x||f)&&n.createElement("p",{role:"alert",className:"a-danger"},x||f),C&&n.createElement("p",{role:"status",className:"a-appearance-notice"},n.createElement(Pt,{size:15}),C),n.createElement("section",{className:"a-appearance-options"},d?n.createElement("div",{className:"a-appearance-color"},n.createElement("label",{htmlFor:"appearance-color-mode"},"Color mode"),n.createElement("select",{id:"appearance-color-mode",value:te,disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({scheme:ue.target.value})},n.createElement("option",{value:"system"},"Device"),n.createElement("option",{value:"light"},"Light"),n.createElement("option",{value:"dark"},"Dark"))):n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Color mode"),n.createElement("p",null,"Keep a favorite look throughout the day.")),n.createElement("div",{className:"a-appearance-modes",role:"group","aria-label":"Color mode"},[["light","Light",gx],["dark","Dark",nx],["system","Device",Lu]].map(([ue,ye,M])=>n.createElement("button",{type:"button",key:ue,disabled:w,"aria-pressed":te===ue,"data-action":"shell.changes.apply",onClick:()=>ie({scheme:ue})},n.createElement(M,null),ye)))),n.createElement("fieldset",{className:"a-detail-level"},n.createElement("legend",null,"How much would you like to see?"),n.createElement("p",null,"Choose a calmer workspace or keep more information at hand. You can always open details."),n.createElement("div",{className:"a-detail-choices"},[["minimal","Focused","Quiet lists and simple work summaries. Extra information stays in details."],["standard","Balanced","Useful context and work totals, with deeper details one click away."],["detailed","Everything","Work activity opens automatically. Counts and list actions stay visible."]].map(([ue,ye,M])=>n.createElement("label",{key:ue,"data-selected":(H.interfaceDetail||H.executionDetail||"standard")===ue},n.createElement("input",{type:"radio",name:"interface-detail",value:ue,checked:(H.interfaceDetail||H.executionDetail||"standard")===ue,disabled:w,"data-action":"shell.changes.apply",onChange:()=>ie({interfaceDetail:ue,executionDetail:ue})}),n.createElement("span",null,n.createElement("strong",null,ye),n.createElement("small",null,M)))))),n.createElement("details",{className:"a-everyday-disclosure",open:!d||void 0},n.createElement("summary",null,"Layout & background"),n.createElement("div",null,n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Background"),n.createElement("p",null,"Decorative artwork stays behind your content.")),n.createElement(eD,{shell:t,onError:A})),n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("label",{htmlFor:"layout"},"Layout"),n.createElement("p",null,"Choose where the conversation and Canvas sit.")),n.createElement("select",{id:"layout",value:H.layout||((De=e.view)==null?void 0:De.layout)||"balanced",disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({layout:ue.target.value})},n.createElement("option",{value:"balanced"},"Canvas on the right"),n.createElement("option",{value:"conversation"},"More room for conversation"),n.createElement("option",{value:"work"},"Canvas on the left")))))),!d&&n.createElement("section",{className:"a-appearance-import"},n.createElement("div",null,n.createElement("h3",null,n.createElement(mg,null),"Your appearance library"),n.createElement("p",null,"Upload a CSS appearance once. It will stay here across restarts and be available to every connected device.")),n.createElement(Cg,{id:"theme-import",accept:".css,text/css",action:"theme.save",label:"Upload appearance",hint:"Drop a CSS file here · up to 1 MB",onFile:q}),y.errors.map(ue=>n.createElement("p",{className:"a-danger",key:ue.name},ue.name,": ",ue.message)),n.createElement("details",{className:"a-appearance-folder"},n.createElement("summary",null,n.createElement(nr,null),"Theme folder"),n.createElement("p",null,"CSS files placed here appear in the library automatically."),n.createElement("code",null,y.directory))),!d&&n.createElement("details",{className:"a-appearance-advanced",open:k,onToggle:ue=>T(ue.currentTarget.open)},n.createElement("summary",null,"Advanced customization"),n.createElement("p",null,"Edit or export a complete, portable CSS appearance. Embedded images and fonts travel with it."),n.createElement("label",{htmlFor:"theme-name"},"Appearance name"),n.createElement("input",{id:"theme-name",value:r,"data-action":"view.update",onChange:ue=>D({name:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("label",{htmlFor:"theme-css"},"CSS"),n.createElement("textarea",{id:"theme-css",spellCheck:!1,className:"a-css-editor",value:o,"data-action":"view.update",onChange:ue=>D({css:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"theme.save",onClick:ne},"Save to library"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.preview",onClick:()=>_(async()=>{await I.current("theme.preview",{name:r,css:o}),c(!0)})},"Preview"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.apply",onClick:G},"Apply skin"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:W},"Revert edits"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.export",onClick:()=>_(()=>I.current("theme.export",{}))},n.createElement(wa,null),"Export current appearance"))),d&&n.createElement("div",{className:"a-everyday-footer"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:m},"Custom themes & CSS")),!d&&n.createElement("button",{type:"button",className:"a-link a-appearance-reset",disabled:w,"data-action":"theme.reset",onClick:()=>_(async()=>{await I.current("theme.reset",{}),c(!1),S(null)})},n.createElement(Mt,null),"Restore original appearance"))}const Zi=[{id:"ai",title:"AI connections",scope:"Across workspaces on this Amplifier host",pages:[["ai-connections","AI connections"],["overview","AI connections"]]},{id:"smart-tools",title:"Smart Tools",scope:"This Amplifier host",pages:[["smart-tools","Smart Tools"]]},{id:"appearance",title:"Appearance",scope:"This interface",pages:[["appearance","Appearance"]]},{id:"voice",title:"Voice",scope:"Future voice connections",pages:[["voice","Voice"]]},{id:"notifications",title:"Notifications",scope:"This app",pages:[["notifications","Notifications"]]},{id:"privacy",title:"Privacy & files",scope:"Your work and access choices",pages:[["privacy","Privacy & files"],["workspaces","Files & folders"],["recall","Memory & past work"],["permissions","File access"],["desktop","Screen & computer access"],["diagnostics","App diagnostic capture"],["history","Saved work"]]},{id:"updates",title:"Updates",scope:"This Amplifier host",pages:[["updates","Updates"]]},{id:"advanced",title:"Advanced",scope:"Full configuration",pages:[["advanced","Advanced"],["providers","Provider configuration"],["routing","Model rules"],["app-bundles","Configured bundles"],["add-bundles","Discover bundles"],["defaults","Conversation defaults"],["loaded-modules","Conversation modules"],["share-bundle","Save & share a bundle"],["registries","Module & source registries"],["tool-connections","Tool connections"],["custom-appearance","Custom appearance"],["conversation","Current conversation"],["outputs","Outputs & review"],["publishing","Publishing"],["repair","Backup & repair"],["reset","Advanced recovery"],["ready-conversations","Ready conversations"],["automation","Terminal & automation"],["install-app","Install app"],["runtime","Session controls"]]}],Of={setup:["overview","ai-connections","advanced","appearance","voice","providers","routing","defaults","conversation","install-app","runtime","custom-appearance"],capabilities:["smart-tools","tool-connections","app-bundles","add-bundles","loaded-modules","registries","share-bundle"],maintenance:["privacy","ready-conversations","updates","diagnostics","history","recall","outputs","publishing","permissions","notifications","automation","repair","reset"]};function Vw(e={},t=Zi){var o,i;const a=new Set(t.flatMap(s=>s.pages.map(([l])=>l))),r=e.panel==="appearance"?"appearance":((i=(o=e.settingsExpanded)==null?void 0:o.find)==null?void 0:i.call(o,s=>a.has(s)))||{capabilities:"app-bundles",maintenance:"updates"}[e.settingsSection]||"ai-connections";return{page:r,section:t.find(s=>s.pages.some(([l])=>l===r))}}function Ww(e,t=Zi){if(!t.some(a=>a.pages.some(([r])=>r===e)))throw new Error("Unknown settings page");return{panel:"settings",settingsSection:Object.keys(Of).find(a=>Of[a].includes(e))||"setup",settingsExpanded:[e]}}function rD(e,t){return t.pages.reduce((a,[r])=>{var o,i;return a+(((i=(o=e.attention)==null?void 0:o.pages)==null?void 0:i[r])||0)},0)}function bp(e,t=Zi){var a;return((a=t.flatMap(r=>r.pages).find(([r])=>r===e))==null?void 0:a[1])||"Settings"}function Is(e,t=Zi){const a=t.find(r=>r.pages.some(([o])=>o===e));return["privacy","advanced"].includes(a==null?void 0:a.id)&&e!==a.id?a.id:null}function Zw({state:e,id:t,sessionId:a,act:r,disabled:o=!1}){var y,E,b,S,w,N,x,A;const[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(null),p=(E=(y=e.setup)==null?void 0:y.operations)==null?void 0:E["providers.testMessage:"+t],m=(S=(b=e.setup)==null?void 0:b.messageTests)==null?void 0:S[t],h=(N=(w=e.setup)==null?void 0:w.providers)==null?void 0:N.find(C=>C.id===t),f=(h==null?void 0:h.module)==="provider-openai-chatgpt"&&(((x=h.account)==null?void 0:x.authMode)||((A=h.config)==null?void 0:A.auth_mode))==="chatgpt_plan";v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[p==null?void 0:p.commandId,p==null?void 0:p.phase]);async function g(){if(!(u.current||f)){u.current=!0,s(!0),c("");try{const C=await r("providers.testMessage",{id:t,...a?{sessionId:a}:{}});if(!(C!=null&&C.accepted)||!C.operationId)throw Error((C==null?void 0:C.error)||"The test could not be started.");d.current=C.operationId,s(C.operationId)}catch(C){u.current=!1,s(!1),c(C.message)}}}return v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[i]),n.createElement("div",{"data-part":"provider-message-test"},n.createElement("button",{type:"button",className:"a-soft","data-action":"providers.testMessage",disabled:!t||o||f||!!i,onClick:g},i?"Sending test message…":"Send test message"),n.createElement("p",{className:"a-caption"},f?"ChatGPT plan does not support this test's output limit. Use Test connection to check the model catalog; no test message is sent.":"Sends a small message using the saved model and credentials. Provider charges may apply. No chat is created."),l&&n.createElement("p",{role:"alert"},l),!i&&m&&n.createElement("div",{role:"status"},n.createElement("p",null,n.createElement("strong",null,m.supported===!1?"Test message unavailable":m.reachable?"Test message succeeded":"Test message failed")," · ",m.model," · ",(m.elapsedMs/1e3).toFixed(1)," s",m.statusCode?` · HTTP ${m.statusCode}`:""),n.createElement("p",null,m.reachable?m.response:m.error)))}function Tu({credential:e}){const t=e==null?void 0:e.preview;if(!t)return null;const a=t.source==="key-file"?"Private keys file (keys.env)":t.source==="environment"?"Service environment":t.source==="configuration"?"Provider configuration":"Provider managed";return n.createElement("div",{className:"a-provider-key-preview","data-part":"provider-key-preview"},n.createElement("p",null,"Service API key: ",n.createElement("strong",null,t.status==="available"?n.createElement("code",null,t.masked):t.status==="missing"?"Not available":"Preview unavailable")),n.createElement("p",{className:"a-caption"},a,t.envVar&&n.createElement(n.Fragment,null," · ",n.createElement("code",null,t.envVar))),n.createElement("p",{className:"a-caption"},"For new connections from this running service. Existing chats may still use an earlier key. A changed shell environment does not update a running service."))}function tr(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Provider configuration must be a JSON object.");function a(r){if(!(!r||typeof r!="object"))for(const[o,i]of Object.entries(r)){if(/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(o)&&typeof i=="string"&&!/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(i)&&!/^\[redacted\]$/i.test(i))throw new Error("Enter credentials in the private API key field, or use an environment reference in configuration.");a(i)}}return a(t),t}function zl(e){return(Array.isArray(e)?e:(e==null?void 0:e.models)||[]).map(a=>typeof a=="string"?{id:a,name:a}:{id:a.id||a.name||a.model,name:a.display_name||a.displayName||a.name||a.id||a.model}).filter(a=>a.id)}function Pr(e,t,a){var r;return{...e,roles:{...e==null?void 0:e.roles,[t]:{...(r=e==null?void 0:e.roles)==null?void 0:r[t],...a}}}}function oD(e,t,a,r){var i,s;const o=[...((s=(i=e==null?void 0:e.roles)==null?void 0:i[t])==null?void 0:s.candidates)||[]];return o[a]={...o[a],...r},Pr(e,t,{candidates:o})}function Mf(e="my-routing"){return{name:e,roles:{general:{description:"General conversation and work",candidates:[{provider:"",model:""}]},fast:{description:"Quick and lightweight work",candidates:[{provider:"",model:""}]}}}}function Jw(e){try{const t=new URL(e);if(t.protocol!=="https:"||t.username||t.password||t.hash)return null;for(const a of t.searchParams.keys())if(/^(id_token_hint|access_token|refresh_token|id_token|code|client_secret)$/i.test(a))return null;return t.href}catch{return null}}function yp(e,t={}){var r,o;return(((r=e==null?void 0:e.configSchema)==null?void 0:r.fields)||((o=e==null?void 0:e.info)==null?void 0:o.config_fields)||[]).filter(i=>i.id&&i.field_type!=="secret"&&!/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(i.id)&&!["model","default_model"].includes(i.id)).filter(i=>i.requires_model&&!t.default_model&&!t.model?!1:Object.entries(i.show_when||{}).every(([s,l])=>{const c=String(t[s]??"").toLowerCase(),u=String(l).toLowerCase();if(u.startsWith("matches:"))try{return new RegExp(String(l).slice(8),"i").test(c)}catch{return!1}for(const[d,p]of[["not_contains:",m=>!c.includes(m)],["contains:",m=>c.includes(m)],["not_startswith:",m=>!c.startsWith(m)],["startswith:",m=>c.startsWith(m)]])if(u.startsWith(d))return p(u.slice(d.length));return c===u}))}function Iu(e,t,a){return!!a&&a.role===t&&a.source===JSON.stringify(e)&&Array.isArray(a.ids)&&a.ids.length===e.length&&new Set(a.ids).size===e.length&&a.ids.every(r=>e.some((o,i)=>String(i)===r))}function Tc(e,t,a){return Iu(e,t,a)?a:{role:t,ids:e.map((r,o)=>String(o)),source:JSON.stringify(e),notice:(a==null?void 0:a.role)===t?"The choices changed. Review the current order before saving.":""}}const Or=e=>!e||e==="legacy_codex"?"chatgpt_codex":e,iD="https://chatgpt.com/settings/usage";function Ep({account:e}){return e?n.createElement("div",{className:"a-ai-hint"},n.createElement("p",null,e.authMode==="chatgpt_plan"?e.planEnabled?"Using ChatGPT plan":e.connected?"Signed in. Permission to use your ChatGPT plan is still needed.":"Sign in to use your ChatGPT plan.":"This connection uses ChatGPT Codex with device sign-in.",e.email&&n.createElement(n.Fragment,null," · ",e.email)),e.authMode==="chatgpt_plan"&&n.createElement("a",{className:"a-link",href:iD,target:"_blank",rel:"noopener noreferrer"},"Manage usage")):null}function Kw({mode:e,onChange:t,disabled:a=!1}){const r=v.useId();return n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:r},"ChatGPT connection"),n.createElement("select",{id:r,value:Or(e),disabled:a,onChange:o=>t(o.target.value)},n.createElement("option",{value:"chatgpt_codex"},"ChatGPT Codex · device sign-in"),n.createElement("option",{value:"chatgpt_plan"},"ChatGPT plan · browser sign-in")),e==="chatgpt_plan"?n.createElement(n.Fragment,null,n.createElement("p",null,"Continue with ChatGPT to authorize Amplifier Unified to use your plan. Use a browser on the computer running Amplifier."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Using a remote host, such as Spark?"),n.createElement("p",null,"Browser sign-in returns to the computer where the browser is open. For a remote host, sign in locally with the ChatGPT provider, transfer the credentials over SSH, and import them on the remote host. Keep its host identity separate; let the remote host own subsequent refreshes."),n.createElement("p",null,"ChatGPT Codex device sign-in is the default for Unified."),n.createElement("a",{href:"https://developers.openai.com/siwc/token-sharing-open-source/self-hosted-vms",target:"_blank",rel:"noopener noreferrer"},"Remote-host sign-in guide"),n.createElement("p",null,n.createElement("a",{href:"https://github.com/microsoft/amplifier-module-provider-openai-chatgpt/blob/main/docs/CHATGPT_PLAN_SIGN_IN.md#self-hosted-server",target:"_blank",rel:"noopener noreferrer"},"Amplifier setup commands")))):n.createElement("p",null,"Sign in with a one-time code. This is the default ChatGPT connection for Amplifier Unified."))}function Au({login:e,onCancel:t,onRetry:a,busy:r=!1,chooseModel:o=!1,onEnablePlan:i,onWelcomeDismiss:s,welcomeDismissed:l=!1}){var N,x,A;const{active:c}=v.useContext(Kr),u=v.useId(),d=v.useRef(null),p=v.useRef(""),[m,h]=v.useState(!1),[f,g]=v.useState(!1),y=e.authMode==="chatgpt_plan",E=e.deviceCode||"",b=Jw(e.url),S=["starting","waiting"].includes(e.status);async function w(){var C;try{if(!((C=navigator.clipboard)!=null&&C.writeText))throw Error();await navigator.clipboard.writeText(E),h(!0),g(!1)}catch{h(!1),g(!0)}}return v.useEffect(()=>{c&&E&&p.current!==E&&(p.current=E,w())},[E,c]),e.status==="completed"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-signin-success",role:"status"},n.createElement(Pt,null),y&&!((N=e.account)!=null&&N.planEnabled)?"Signed in. Plan access needs permission.":o?"Signed in. Choose your model below.":"Signed in successfully."),y&&n.createElement(Ep,{account:e.account})," ",y&&((x=e.account)==null?void 0:x.connected)&&!((A=e.account)!=null&&A.planEnabled)&&i&&n.createElement("button",{className:"a-primary",disabled:r,onClick:i},"Enable ChatGPT plan access"),e.showPlanWelcome&&!l&&n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"You’re using your ChatGPT plan"),n.createElement("p",null,"Usage from this connection counts toward your ChatGPT plan."),s&&n.createElement("button",{className:"a-soft",onClick:s},"Got it"))):n.createElement("div",{className:"a-device-signin"},S?n.createElement(n.Fragment,null,y?n.createElement(n.Fragment,null,n.createElement("p",{role:"status"},b?"Finish signing in on this host’s browser.":"Preparing secure sign-in…"),b&&n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Continue with ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption"},"Waiting for sign-in. This page will continue automatically.")):E?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:u},"1. Copy your sign-in code"),n.createElement("div",{className:"a-device-code"},n.createElement("input",{id:u,ref:d,readOnly:!0,value:E,spellCheck:!1,onFocus:C=>C.target.select(),onClick:C=>C.currentTarget.select()}),n.createElement("button",{className:"a-soft",type:"button","aria-label":"Copy sign-in code",onClick:w},m?n.createElement(Pt,null):n.createElement(rr,null),m?"Copied":"Copy")),n.createElement("p",{className:"a-caption",role:"status"},m?"Copied to your clipboard.":f?"Select the code to copy it, or use the Copy button.":"Keep this code ready for the next step.")):n.createElement("p",{role:"status"},"Getting your sign-in code…"),E&&b&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-device-step"},"2. Open ChatGPT and paste the code"),n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Open ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption",role:"status"},"Waiting for sign-in. This page will continue automatically.")),n.createElement("button",{className:"a-link",type:"button",disabled:r,"data-action":"providers.loginCancel",onClick:t},"Cancel sign-in")):n.createElement(n.Fragment,null,n.createElement("p",{role:e.error?"alert":"status"},e.error||"Sign-in was cancelled. You can try again."),n.createElement("button",{className:"a-primary",disabled:r,"data-action":"providers.login",onClick:a},"Try sign-in again")))}function gr({title:e,description:t,onClick:a,Icon:r=Dr,page:o,count:i,disabled:s=!1}){return n.createElement("button",{type:"button",className:"a-everyday-row",disabled:s,"data-action":"view.update","data-settings-destination":o,onClick:a},r!==Dr&&n.createElement(r,{"aria-hidden":"true"}),n.createElement("span",null,n.createElement("strong",null,e),t&&n.createElement("small",null,t)),n.createElement(Da,{count:i}),n.createElement(en,{"aria-hidden":"true"}))}function sD({navigate:e,state:t}){var r,o,i,s;const a=[["recall","Memory & past work","Choose what is saved and reused. Review and correct memories.",Lk],["workspaces","Files & folders","Choose where new workspaces are created.",nr],["permissions","File access","Review additional allowed and blocked folders.",px],["desktop","Screen & computer access","Check the host, browser, and permission status.",Lu],["history","Saved work","Import, export, and review cleanup.",wi],["diagnostics","App diagnostic capture","Review recorded data and forwarding destinations.",mo]];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Your saved work, memory, and access choices."),n.createElement("div",{className:"a-everyday-list"},a.filter(l=>l[0]!=="diagnostics").map(([l,c,u,d])=>{var p,m;return n.createElement(gr,{key:l,count:(m=(p=t.attention)==null?void 0:p.pages)==null?void 0:m[l],page:l,title:c,description:u,Icon:d,onClick:()=>e(l)})})),n.createElement("h4",null,"Diagnostics"),n.createElement("div",{className:"a-everyday-list"},n.createElement(gr,{page:"diagnostics",count:(o=(r=t.attention)==null?void 0:r.pages)==null?void 0:o.diagnostics,title:"App diagnostic capture",description:"Review collected records and forwarding.",Icon:mo,onClick:()=>e("diagnostics")})),n.createElement("div",{className:"a-everyday-footer"},n.createElement(gr,{page:"repair",count:(s=(i=t.attention)==null?void 0:i.pages)==null?void 0:s.repair,title:"Backups & recovery",description:"Create a private backup or troubleshoot this app.",onClick:()=>e("repair")})))}function lD({sections:e,navigate:t,state:a}){const r=e.flatMap(i=>i.pages).filter(([i])=>i.startsWith("shell:")),o=[{title:"Model rules",description:"Routing profiles, roles, and model preference.",page:"routing"},{title:"Provider configuration",description:"Instance names, credentials, and custom providers.",page:"providers"},{title:"Bundles & modules",description:"Composition, discovery, defaults, registries, and loaded modules.",pages:["app-bundles","add-bundles","defaults","loaded-modules","share-bundle","registries"]},{title:"Tool connections",description:"MCP connections, installation sources, and authentication.",page:"tool-connections"},{title:"Custom appearance",description:"Import, export, theme folders, and custom CSS.",page:"custom-appearance"},{title:"Conversation & work",description:"Current conversation, outputs, review, and publishing.",pages:["conversation","outputs","publishing"]},{title:"Performance & runtime",description:"Ready conversations, session controls, and terminal access.",pages:["ready-conversations","runtime","automation","install-app"]},{title:"Troubleshooting & recovery",description:"Diagnostics, backups, repair, and reset options.",pages:["diagnostics","repair","reset"]}];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"The full configuration, when you need it."),n.createElement("div",{className:"a-everyday-list"},o.map(i=>{var s,l;return i.page?n.createElement(gr,{key:i.title,title:i.title,description:i.description,page:i.page,count:(l=(s=a.attention)==null?void 0:s.pages)==null?void 0:l[i.page],onClick:()=>t(i.page)}):n.createElement("details",{className:"a-advanced-group",key:i.title},n.createElement("summary",null,n.createElement("span",null,n.createElement("strong",null,i.title),n.createElement("small",null,i.description)),n.createElement(Da,{count:i.pages.reduce((c,u)=>{var d,p;return c+(((p=(d=a.attention)==null?void 0:d.pages)==null?void 0:p[u])||0)},0)}),n.createElement(en,null)),n.createElement("div",null,i.pages.map(c=>{var u,d;return n.createElement(gr,{key:c,page:c,count:(d=(u=a.attention)==null?void 0:u.pages)==null?void 0:d[c],title:bp(c,e),onClick:()=>t(c)})})))})),r.length>0&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Extension settings"),n.createElement("div",{className:"a-everyday-list"},r.map(([i,s])=>{var l,c;return n.createElement(gr,{key:i,page:i,count:(c=(l=a.attention)==null?void 0:l.pages)==null?void 0:c[i],title:s,Icon:qr,onClick:()=>t(i)})}))))}const Yw=v.createContext(null);function Gw(e,t){const a=v.useContext(Yw);v.useEffect(()=>{a==null||a.register(e,t)}),v.useEffect(()=>()=>a==null?void 0:a.remove(e),[a,e])}function cD(){const e=v.useRef(new Map),t=v.useRef(null),[a,r]=v.useState(0),[o,i]=v.useState(null),s=v.useCallback(()=>r([...e.current.values()].filter(f=>f.dirty).length),[]),l=v.useCallback((f,g)=>{var E;const y=!!((E=e.current.get(f))!=null&&E.dirty)!=!!g.dirty;e.current.set(f,g),y&&s()},[s]),c=v.useCallback(f=>{e.current.delete(f)&&s()},[s]),u=v.useMemo(()=>({register:l,remove:c}),[l,c]),d=v.useCallback(()=>[...e.current.values()].some(f=>f.dirty),[]),p=v.useCallback(()=>{const f=[...e.current.values()].filter(E=>E.dirty);if(!f.length)return Promise.resolve(!0);if(t.current)return t.current.promise;let g;const y=new Promise(E=>{g=E});return t.current={promise:y,resolve:g},i(f),y},[]),m=f=>{const g=t.current;t.current=null,i(null),g==null||g.resolve(f)};v.useEffect(()=>{if(!a)return;const f=g=>{g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[a]),v.useEffect(()=>()=>{var f;(f=t.current)==null||f.resolve(!1)},[]);const h=o&&n.createElement("div",{className:"a-settings-draft-overlay"},n.createElement("div",{className:"a-settings-draft-confirm",role:"alertdialog","aria-modal":"true","aria-labelledby":"settings-unsaved-title",onKeyDown:f=>{var g;if(f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),m(!1)),f.key==="Tab"){const y=[...f.currentTarget.querySelectorAll("button")],E=y.indexOf(document.activeElement);f.preventDefault(),(g=y[(E+(f.shiftKey?-1:1)+y.length)%y.length])==null||g.focus()}}},n.createElement("h3",{id:"settings-unsaved-title"},"Unsaved connection changes"),n.createElement("p",null,"Your changes have not been saved. Review them before closing Settings, or discard them."),n.createElement("ul",null,o.map(f=>n.createElement("li",{key:f.label},f.label))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",autoFocus:!0,onClick:()=>{o[0].review(),m(!1)}},"Review and save"),n.createElement("button",{type:"button",className:"a-soft a-danger",onClick:()=>{o.forEach(f=>f.discard()),m(!0)}},"Discard changes"),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>m(!1)},"Keep settings open"))));return{context:u,confirmClose:p,hasUnsaved:d,count:a,dialog:h}}function uD({value:e,children:t}){return n.createElement(Yw.Provider,{value:e},t)}function dD(e,t,a){const[r,o]=v.useState(e),i=v.useRef(a);return i.current=a,v.useEffect(()=>{if(e===r)return;const s=u=>u==="settings"||u==="appearance",l=t.current;if(!s(r)||s(e)||!(l!=null&&l.hasUnsaved())){o(e);return}let c=!0;return l.confirmClose().then(u=>{c&&(u?o(e):i.current(r))}),()=>{c=!1}},[e,r,t]),r}function xa(e,t,a,r,o,i,{simple:s=!1}={}){var h,f;const l=((f=(h=e.view)==null?void 0:h.settingsFilters)==null?void 0:f[a])||"",[c,u]=v.useState(l);v.useEffect(()=>u(l),[l]);const d=nl(r,c,o),p=g=>{var y;u(g),t("view.update",{patch:{settingsFilters:{...(y=e.view)==null?void 0:y.settingsFilters,[a]:g}}})},m=n.createElement("div",{className:"a-list-filter"},n.createElement("label",{htmlFor:"filter-"+a},n.createElement(To,null),i),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"filter-"+a,type:"search",value:c,placeholder:s?i:"Search or pattern, e.g. *openai*","data-action":"view.update",onChange:g=>p(g.target.value)}),c&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Clear "+i.toLowerCase(),"data-action":"view.update",onClick:()=>p("")},n.createElement(nn,null))),n.createElement("small",{role:"status"},d.length," of ",r.length,c&&!d.length?" · No matches":"",!s&&n.createElement(n.Fragment,null," · Text search or wildcards: * ? [abc] [!abc]")));return[d,m,c]}function wp({id:e,label:t="Model",value:a="",onChange:r,onCommit:o,entry:i,models:s,state:l,act:c,disabled:u=!1,placeholder:d="Enter a model ID",catalogKey:p=e,editable:m=!1}){var S;const h=(i==null?void 0:i.phase)==="working"||(i==null?void 0:i.phase)==="queued",f=v.useRef(null),g=v.useRef(null);let y=zl((i==null?void 0:i.models)??s??[]);!m&&(h||(i==null?void 0:i.phase)==="error")&&!y.length&&((S=f.current)==null?void 0:S.key)===p&&(y=f.current.models),!h&&(i==null?void 0:i.phase)!=="error"&&(f.current={key:p,models:y}),Zu(g,h);const[E,b]=xa(l,c,"model-picker-"+e,y,w=>[w.id,w.name],"Filter "+t.toLowerCase());return m?n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},n.createElement("input",{list:y.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),y.length>0&&n.createElement(n.Fragment,null,n.createElement("datalist",{id:e+"-options"},y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))),y.length>12&&b,n.createElement("select",{id:e+"-catalog","aria-label":"Choose "+t.toLowerCase()+" from catalog",value:y.some(w=>w.id===a)?a:"",disabled:u,"data-action":"view.update",onChange:w=>{w.target.value&&(r(w.target.value),o==null||o(w.target.value))}},n.createElement("option",{value:""},"Choose from ",y.length," cached models…"),E.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),h&&n.createElement("small",{role:"status"},y.length?"Refreshing in the background. Saved models are available.":"Discovering models. You can enter a model ID now."),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.loadedAt)&&n.createElement("small",null,"Catalog checked ",new Date(i.loadedAt*1e3).toLocaleString()),(i==null?void 0:i.phase)==="ready"&&!y.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID.")):n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},y.length>12&&b,(i==null?void 0:i.phase)!=="error"&&(y.length||h)?n.createElement("select",{id:e,"aria-label":t,value:a,disabled:u||h&&!y.length,"data-action":"view.update",onChange:w=>{r(w.target.value),o==null||o(w.target.value)}},n.createElement("option",{value:""},h?"Loading provider models…":"Choose a model…"),a&&!E.some(w=>w.id===a)&&n.createElement("option",{value:a},a," (selected)"),E.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))):n.createElement(n.Fragment,null,n.createElement("input",{list:y.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),y.length>0&&n.createElement("datalist",{id:e+"-options"},E.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.phase)==="ready"&&!y.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID."))}function Qw(e){const t=r=>{var o;return((o=r.info)==null?void 0:o.id)||r.module||r.id},a=new Map;for(const r of e)a.set(t(r),(a.get(t(r))||0)+1);return e.map(r=>{var o;return{id:r.id,label:(((o=r.info)==null?void 0:o.display_name)||t(r))+(a.get(t(r))>1?` (${r.id})`:"")}}).sort((r,o)=>r.label.localeCompare(o.label,void 0,{sensitivity:"base"}))}const zf={"provider-anthropic":"git+https://github.com/microsoft/amplifier-module-provider-anthropic@main","provider-azure-openai":"git+https://github.com/microsoft/amplifier-module-provider-azure-openai@main","provider-chat-completions":"git+https://github.com/microsoft/amplifier-module-provider-chat-completions@main","provider-gemini":"git+https://github.com/microsoft/amplifier-module-provider-gemini@main","provider-github-copilot":"git+https://github.com/microsoft/amplifier-module-provider-github-copilot@main","provider-ollama":"git+https://github.com/microsoft/amplifier-module-provider-ollama@main","provider-openai":"git+https://github.com/microsoft/amplifier-module-provider-openai@main","provider-openai-chatgpt":"git+https://github.com/microsoft/amplifier-module-provider-openai-chatgpt@main","provider-vllm":"git+https://github.com/microsoft/amplifier-module-provider-vllm@main"},kp=[{module:"provider-github-copilot",name:"GitHub Copilot Subscription",description:"Use your GitHub Copilot subscription.",auth:"token"},{module:"provider-openai-chatgpt",name:"ChatGPT Subscription",description:"Sign in with your ChatGPT account.",auth:"signin"},{module:"provider-openai",name:"OpenAI API",description:"Use an API key. API billing is separate from ChatGPT.",auth:"key"},{module:"provider-anthropic",name:"Anthropic API",description:"Connect with your Anthropic API key.",auth:"key"},{module:"provider-gemini",name:"Google Gemini API",description:"Connect with your Gemini API key.",auth:"key"},{module:"provider-chat-completions",name:"OpenAI Compatible API",description:"Connect a local model or another compatible service.",auth:"optional-key"}],pD=[...kp,{module:"provider-azure-openai",name:"Azure OpenAI"},{module:"provider-ollama",name:"Ollama"},{module:"provider-vllm",name:"vLLM"}],Ic=Object.keys(zf).map(e=>({...pD.find(t=>t.module===e),module:e,source:zf[e]}));function Ac(e){return kp.find(t=>t.module===e)||{module:e,name:(e==null?void 0:e.replace(/^provider-/,""))||"AI service",auth:"key"}}function mD(e,t,a){var r,o;return(o=(r=e.setup)==null?void 0:r.operations)==null?void 0:o[t+":"+a]}function Lf(e){return["working","pending","queued"].includes(e==null?void 0:e.phase)}function hD(e,t){if(!t)return null;const a=mD(e,t.action,t.id);return(a==null?void 0:a.commandId)===t.commandId?a:null}function fD({state:e,session:t,act:a,navigate:r}){var Z,ie,ke,me,_e,Je,De,ue,ye,M,Y,se,Fe,je;const o=v.useContext(Kr),i=e.setup||{},s=(i.providers||[]).filter(oe=>oe.enabled!==!1),l=new Map(Qw(s.map(oe=>({...oe,info:{id:oe.module,display_name:Ac(oe.module).name}}))).map(oe=>[oe.id,oe.label])),c=((Z=e.view)==null?void 0:Z.aiConnectionEditor)||{},u=c.step||"list",d=Ac(c.module),p=s.find(oe=>oe.id===c.id),m=Or(c.authMode||((ie=p==null?void 0:p.config)==null?void 0:ie.auth_mode)),h={id:c.id,authMode:m,scope:c.scope||"global"},[f,g]=v.useState(""),[y,E]=v.useState(""),[b,S]=v.useState(""),[w,N]=v.useState(null),x=v.useRef(!1),A=v.useRef(t==null?void 0:t.workspace),C=v.useRef(0),O=v.useRef(!0),k=oe=>a("view.update",{patch:{aiConnectionEditor:{...c,...oe}}});v.useEffect(()=>(O.current=!0,()=>{O.current=!1,C.current++}),[]),v.useEffect(()=>{A.current!==(t==null?void 0:t.workspace)&&(C.current++,A.current=t==null?void 0:t.workspace,g(""),N(null),x.current=!1,k({step:"list",id:"",model:""})),a("providers.list",t?{sessionId:t.id}:{}),a("routing.list")},[t==null?void 0:t.workspace]);async function T(oe,Ze={},it=""){if(x.current)return;x.current=!0;const zt=++C.current;E(""),S(""),N({action:oe,id:Ze.id||Ze.module||"",commandId:null,next:it});try{const ct=await a(oe,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(oe)?{sessionId:t.id}:{},...Ze});if(!O.current||zt!==C.current)return;if(!(ct!=null&&ct.accepted)||!ct.operationId)throw Error((ct==null?void 0:ct.error)||"The request could not be confirmed. Please try again.");N({action:oe,id:Ze.id||Ze.module||"",commandId:ct.operationId,next:it})}catch(ct){O.current&&zt===C.current&&(E(ct.message),N(null),x.current=!1)}}const I=hD(e,w),F=!!w;v.useEffect(()=>{var it;if(!I||Lf(I))return;const oe=w.next,Ze=w.action;if(N(null),x.current=!1,I.phase==="error"){E(I.error||"The request did not finish. Your choices are kept.");return}I.phase==="ready"&&(Ze==="providers.save"?(g(""),k({saved:!0,...oe==="models"?{step:"model"}:{}}),oe==="signin"?T("providers.login",h):oe==="models"&&T("providers.models",{id:c.id})):Ze==="providers.remove"?(g(""),k({step:"list",id:"",saved:!1}),S("Connection removed. Chats that used it will need a replacement connection when resumed.")):Ze==="providers.finishSetup"?(k({step:"list",saved:!1}),S((it=i.setupCompletion)!=null&&it.routingSelected?"Connection saved. Balanced model rules are ready for new conversations.":"Model saved. Existing model rules are unchanged.")):Ze==="providers.models"&&S("Model list checked. No chat request was sent."))},[I==null?void 0:I.commandId,I==null?void 0:I.phase]);const z=((ke=i.login)==null?void 0:ke.providerId)===c.id?i.login:null;v.useEffect(()=>{var oe;o.active&&u==="connect"&&c.saved&&(z==null?void 0:z.status)==="completed"&&(z.authMode!=="chatgpt_plan"||(oe=z.account)!=null&&oe.planEnabled)&&z.loginId!==c.previousLoginId&&!F&&(k({step:"model"}),T("providers.models",{id:c.id}))},[u,c.saved,z==null?void 0:z.status,z==null?void 0:z.loginId,F,o.active]);const U=(me=i.providerCatalogs)==null?void 0:me[c.id],H=zl((U==null?void 0:U.models)||((_e=i.modelCatalogs)==null?void 0:_e[c.id])||[]),te=Lf((Je=i.operations)==null?void 0:Je["providers.models:"+c.id])||(U==null?void 0:U.phase)==="working",j=((De=i.credentialCheck)==null?void 0:De.module)===c.module?i.credentialCheck:null,_=c.credentialMode==="auto"?j!=null&&j.githubCliAvailable?"github-cli":j!=null&&j.available?"environment":"private":c.credentialMode||"private",P=oe=>{Ac(oe).auth!=="signin"&&T("providers.credentials",{module:oe})},G=oe=>{x.current||(g(""),E(""),S(""),k({step:"connect",module:oe.module,id:oe.module.replace("provider-","")+"-"+crypto.randomUUID().slice(0,8),model:"",baseUrl:"",previousLoginId:null,scope:"global",authMode:"chatgpt_codex",saved:!1,credentialMode:"auto",initializeRouting:s.length===0}),P(oe.module))},W=()=>{var oe;return T("providers.save",{id:c.id,module:c.module,config:{...p==null?void 0:p.config,...d.auth==="optional-key"?{base_url:(oe=c.baseUrl)==null?void 0:oe.trim()}:{}},scope:c.scope||"global",...d.auth==="signin"?{}:_==="environment"?{apiKeyEnv:j==null?void 0:j.envVar}:_==="github-cli"?{useGitHubCli:!0}:{apiKey:f}},d.auth==="signin"?"signin":"models")},D=()=>{E(""),k({step:u==="services"||u==="detail"?"list":u==="model"?"detail":"services"})},ne=()=>r("providers"),q=!!f||u==="connect"&&!!c.baseUrl&&c.baseUrl!==(((ue=p==null?void 0:p.config)==null?void 0:ue.base_url)||"")||u==="model"&&!!c.model&&c.model!==(((ye=p==null?void 0:p.config)==null?void 0:ye.default_model)||((M=p==null?void 0:p.config)==null?void 0:M.model)||"");return Gw("ai-connections",{label:"AI connection setup",dirty:q,review:()=>{r("ai-connections"),k({step:u})},discard:()=>{g(""),E(""),k({step:"list",id:"",module:"",model:"",baseUrl:"",saved:!1})}}),n.createElement("section",{"data-part":"ai-connections",className:"a-ai-form"},u==="list"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Connect the AI services Amplifier can use for your work."),s.length?n.createElement(n.Fragment,null,n.createElement("div",{className:"a-everyday-list"},s.map(oe=>{var Ze,it,zt,ct;return n.createElement(gr,{key:oe.id,disabled:F,title:l.get(oe.id),description:(((Ze=oe.config)==null?void 0:Ze.default_model)||((it=oe.config)==null?void 0:it.model)||"Choose a model")+" · "+(oe.accountConnected?"Account connected":oe.credentialsConfigured?"Credentials available":oe.keySource==="provider-managed"?"Account sign-in":"Connection needs setup")+((ct=(zt=oe.credential)==null?void 0:zt.preview)!=null&&ct.masked?" · Key "+oe.credential.preview.masked:""),onClick:()=>{var qt,le,fe,xe,ze;E(""),S(""),k({step:"detail",id:oe.id,module:oe.module,authMode:Or((qt=oe.config)==null?void 0:qt.auth_mode),model:((le=oe.config)==null?void 0:le.default_model)||((fe=oe.config)==null?void 0:fe.model)||"",scope:"global",baseUrl:((xe=oe.config)==null?void 0:xe.base_url)||"",previousLoginId:(ze=i.login)==null?void 0:ze.loginId,saved:!0,initializeRouting:!1})}})})),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect another service")):n.createElement("div",{className:"a-ai-welcome"},n.createElement(hx,{"aria-hidden":"true"}),n.createElement("h4",null,"Start with one connection"),n.createElement("p",null,"Choose a service, connect your account, and choose a model. You can add more later."),n.createElement("button",{className:"a-primary","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect AI")),i.active&&s.length>0&&n.createElement("div",{className:"a-ai-hint"},"Your model rules are saved. ",n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>r("routing")},"Advanced model rules")),n.createElement("div",{className:"a-everyday-footer"},n.createElement("p",{className:"a-caption"},"Connections are stored on the Amplifier host. Existing conversations keep their settings."),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Advanced connection settings",n.createElement(sa,null)))):n.createElement(n.Fragment,null,n.createElement("button",{className:"a-link","data-action":"view.update",disabled:F,onClick:D},n.createElement(Sa,null),"Back"),u==="services"?n.createElement(n.Fragment,null,n.createElement("h4",null,"Which service would you like to use?"),n.createElement("div",{className:"a-everyday-list"},kp.map(oe=>n.createElement(gr,{key:oe.module,disabled:F,title:oe.name,description:oe.description,onClick:()=>G(oe)}))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Other provider or custom endpoint")):n.createElement(n.Fragment,null,n.createElement("p",{className:"a-ai-step"},u==="connect"?"1 · Connect":u==="model"?"2 · Choose a model":"Saved connection"),n.createElement("h4",null,l.get(c.id)||d.name),u==="detail"?n.createElement(n.Fragment,null,d.auth==="signin"&&n.createElement(Ep,{account:p==null?void 0:p.account}),n.createElement("p",null,p!=null&&p.accountConnected?"Your ChatGPT account is connected.":p!=null&&p.credentialsConfigured?"This connection has credentials available on the Amplifier host.":"This connection needs credentials before it can be used."),n.createElement("p",null,"Model: ",n.createElement("strong",null,((Y=p==null?void 0:p.config)==null?void 0:Y.default_model)||((se=p==null?void 0:p.config)==null?void 0:se.model)||"Not selected")),n.createElement(Tu,{credential:p==null?void 0:p.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:F,onClick:()=>T("providers.list")},n.createElement(Mt,null),"Refresh credentials"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"providers.models",disabled:F,onClick:()=>{k({step:"model"}),T("providers.models",{id:c.id})}},"Choose model"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>{k({step:"connect",previousLoginId:z==null?void 0:z.loginId,credentialMode:"private"}),P(c.module)}},d.auth==="signin"?p!=null&&p.accountConnected?"Reconnect account":"Sign in":"Change credentials"),n.createElement("button",{className:"a-soft","data-action":"providers.test",disabled:F,onClick:()=>T("providers.test",{id:c.id})},"Check connection")),n.createElement("p",{className:"a-caption"},"Checking verifies the model catalog, without sending a chat request."),n.createElement(Zw,{key:c.id,state:e,id:c.id,sessionId:t==null?void 0:t.id,act:a,disabled:F}),n.createElement("div",{className:"a-dialog-actions a-connection-secondary-actions"},n.createElement("button",{className:"a-soft a-danger","data-action":"providers.remove",disabled:F,onClick:()=>T("providers.remove",{id:c.id,scope:c.scope||"global"})},n.createElement(ea,null),"Remove connection"),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full connection settings"))):u==="connect"?n.createElement(n.Fragment,null,d.auth==="signin"?n.createElement(n.Fragment,null,z&&z.loginId!==c.previousLoginId?n.createElement(Au,{login:z,busy:F,onCancel:()=>T("providers.loginCancel",{id:c.id}),onRetry:()=>T("providers.login",h),onEnablePlan:()=>T("providers.login",{...h,enablePlan:!0})}):n.createElement(n.Fragment,null,n.createElement(Kw,{mode:m,onChange:oe=>k({authMode:oe}),disabled:F}),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":p?"providers.login":"providers.save",disabled:F,onClick:()=>p?T("providers.login",h):W()},F?"Getting ready…":m==="chatgpt_plan"?"Continue with ChatGPT":"Get sign-in code")))):n.createElement(n.Fragment,null,d.auth==="optional-key"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-base-url"},"API base URL"),n.createElement("input",{id:"ai-base-url",type:"url",placeholder:"http://localhost:1234/v1",value:c.baseUrl||"",disabled:F,onChange:oe=>k({baseUrl:oe.target.value})}),n.createElement("p",{className:"a-caption"},"Use an address reachable from the computer running Amplifier. Include /v1 if your service requires it.")),((j==null?void 0:j.available)||(j==null?void 0:j.githubCliAvailable))&&n.createElement("fieldset",{className:"a-credential-options"},n.createElement("legend",null,"How would you like to connect?"),j.available&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="environment",onChange:()=>{g(""),k({credentialMode:"environment"})}}),n.createElement("span",null,n.createElement("strong",null,"Use the key already on this host"),n.createElement("small",null,"Found ",j.envVar,". Only its name is saved; the key stays in the environment."))),j.githubCliAvailable&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="github-cli",onChange:()=>{g(""),k({credentialMode:"github-cli"})}}),n.createElement("span",null,n.createElement("strong",null,"Use GitHub CLI sign-in"),n.createElement("small",null,"Use the host’s signed-in GitHub account. Its token is saved privately for this connection."))),n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="private",onChange:()=>k({credentialMode:"private"})}),n.createElement("span",null,n.createElement("strong",null,"Use a different key"),n.createElement("small",null,"Connect another account or enter a key yourself.")))),_==="environment"&&n.createElement(Tu,{credential:j}),_==="private"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-private-key"},d.auth==="token"?"GitHub token":d.auth==="optional-key"?"API key (optional)":"API key"),n.createElement("input",{id:"ai-private-key",type:"password",autoComplete:"off",spellCheck:!1,value:f,onChange:oe=>g(oe.target.value),disabled:F}),n.createElement("p",{className:"a-caption"},d.auth==="optional-key"?"Leave blank if your local service does not need a key.":"Stored privately for this connection. Other accounts keep their own keys.")),d.auth==="token"&&!(j!=null&&j.githubCliAvailable)&&!(j!=null&&j.available)&&n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Help connecting GitHub Copilot"),n.createElement("div",null,n.createElement("p",null,"Sign in to GitHub CLI on the computer running Amplifier, then check again. Or use a GitHub token for an account with Copilot access."),n.createElement("a",{href:"https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli",target:"_blank",rel:"noreferrer"},"GitHub setup guide"),n.createElement("button",{className:"a-link",disabled:F,onClick:()=>P(c.module)},"Check host sign-in again"))),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"providers.save",disabled:F||d.auth==="optional-key"&&!/^https?:\/\/[^\s]+$/.test(c.baseUrl||"")||(_==="environment"?!(j!=null&&j.available):_==="github-cli"?!(j!=null&&j.githubCliAvailable):d.auth!=="optional-key"&&!f.trim()),onClick:W},F?"Connecting…":"Save and check connection")))):u==="model"?n.createElement(n.Fragment,null,(z==null?void 0:z.status)==="completed"&&n.createElement(Au,{login:z,chooseModel:!0,welcomeDismissed:c.welcomedLoginId===z.loginId,onWelcomeDismiss:()=>k({welcomedLoginId:z.loginId})}),n.createElement("p",null,"Choose from the models available through this connection."),H.length>0?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model"},"Model"),n.createElement(wp,{id:"ai-model",label:"Model",value:c.model||"",catalogKey:c.id,entry:{...U,models:H,phase:"ready"},state:e,act:a,onChange:oe=>k({model:oe})})):n.createElement("p",{role:"status"},te?"Loading models…":"No model list is available yet. Retry or enter a model ID under More options."),te&&H.length>0&&n.createElement("p",{className:"a-caption",role:"status"},"Refreshing in the background. Saved models remain available."),(U==null?void 0:U.phase)==="error"&&n.createElement(nt,{phase:"error",message:U.error||"Could not refresh the model list. Saved choices are kept."}),n.createElement("button",{className:"a-link","data-action":"providers.models",disabled:F||te,onClick:()=>T("providers.models",{id:c.id,refresh:!0})},n.createElement(Mt,null),"Refresh models"),n.createElement("div",{className:"a-ai-hint"},c.initializeRouting?"Balanced model rules choose suitable models for each task. This connection’s default is used when no rule applies.":"This changes the connection’s default model. Existing model rules may choose a different model."),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:F||!((Fe=c.model)!=null&&Fe.trim()),"data-action":"providers.finishSetup",onClick:()=>T("providers.finishSetup",{id:c.id,model:c.model,scope:c.scope||"global",initializeRouting:!!c.initializeRouting})},F?"Saving…":"Finish setup"))):null,n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"More options"),n.createElement("div",null,n.createElement("label",{htmlFor:"ai-scope"},"Save for"),n.createElement("select",{id:"ai-scope",value:c.scope||"global",disabled:F,"data-action":"view.update",onChange:oe=>k({scope:oe.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"local"},"This workspace on this host"),n.createElement("option",{value:"project"},"This project (shareable configuration)")),u==="model"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model-manual"},"Model ID"),n.createElement("input",{id:"ai-model-manual",value:c.model||"",disabled:F,"data-action":"view.update",onChange:oe=>k({model:oe.target.value})})),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full provider configuration"))))),y&&n.createElement(nt,{phase:"error",message:y}),b&&n.createElement(nt,{phase:"ready",message:b}),F&&n.createElement(nt,{phase:"working",message:"Working on this connection…"}),!F&&((je=i.test)==null?void 0:je.providerId)===c.id&&u==="detail"&&n.createElement(nt,{phase:i.test.reachable===!1?"error":"ready",message:i.test.reachable===!1?"Connection check failed.":"Model catalog check passed."}))}function Va({id:e,label:t,description:a,selected:r,onSelect:o,checked:i,onCheck:s,disabled:l,badge:c,checkLabel:u,checkAction:d="view.update"}){return n.createElement("div",{className:"a-collection-row"+(r?" selected":""),"data-collection-id":e},s&&n.createElement("label",{className:"a-collection-check"},n.createElement("input",{type:"checkbox","aria-label":u||"Select "+t,checked:!!i,disabled:l,"data-action":d,onChange:p=>s(p.target.checked)})),n.createElement("button",{type:"button","aria-current":r?"true":void 0,"data-action":"view.update",onClick:o},n.createElement("span",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a)),c&&n.createElement("small",{className:"a-collection-badge"},c),n.createElement(en,{"aria-hidden":"true"})))}function Co({list:e,children:t,detailOpen:a=!0,onBack:r,label:o="items"}){const i=v.useRef(null),s=v.useRef(null),l=v.useContext(Kr);v.useEffect(()=>{var u;a&&l.compact&&((u=s.current)==null||u.focus({preventScroll:!0}))},[a,l.compact]);const c=()=>{r==null||r(),requestAnimationFrame(()=>{var u,d;return(d=(u=i.current)==null?void 0:u.querySelector("button[aria-current=true],button"))==null?void 0:d.focus({preventScroll:!0})})};return n.createElement("div",{className:"a-collection"+(a?" detail-open":"")},n.createElement("div",{className:"a-collection-list",ref:i},e),n.createElement("div",{className:"a-collection-detail",ref:s,tabIndex:-1},r&&!l.compact&&n.createElement("button",{type:"button",className:"a-link a-collection-back","data-action":"view.update",onClick:c},n.createElement(Sa,null),"Back to ",o),t))}function xp({title:e,description:t,items:a,ids:r,onChange:o,onSave:i,onCancel:s,busy:l=!1,error:c,notice:u,action:d="view.update"}){const[p,m]=v.useState(!1);return n.createElement("section",{className:"a-order-editor"},n.createElement("h4",null,e),u&&n.createElement("p",{role:"status"},u),n.createElement("p",null,t),n.createElement("p",{className:"a-caption"},"Drag the handle or choose a position. Changes apply when you save."),n.createElement(kg,{items:a,ids:r,onChange:o,onDraggingChange:m,busy:l,className:"a-order-list",rowClassName:"a-order-item",floatingClassName:"a-order-item",savedHint:"Save order to apply.",renderItem:(h,{handle:f,index:g,move:y})=>n.createElement(n.Fragment,null,f,n.createElement("span",{className:"a-order-copy"},n.createElement("strong",null,h.label),n.createElement("small",null,h.description)),n.createElement("span",{className:"a-order-arrows"},n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===0,"aria-label":"Move "+h.label+" up","data-action":"view.update",onClick:()=>y(g-1)},n.createElement(Li,null)),n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===r.length-1,"aria-label":"Move "+h.label+" down","data-action":"view.update",onClick:()=>y(g+1)},n.createElement(sg,null))),n.createElement("select",{"aria-label":"Position of "+h.label,value:g,disabled:l,"data-action":"view.update",onChange:E=>y(Number(E.target.value))},r.map((E,b)=>n.createElement("option",{key:b,value:b},b+1))))}),c&&n.createElement("p",{role:"alert",className:"a-danger"},c),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:l||p,"data-action":d,onClick:i},l?"Saving order…":"Save order"),n.createElement("button",{type:"button",className:"a-soft",disabled:l,"data-action":"view.update",onClick:s},"Cancel")))}const cr=e=>JSON.stringify(e,null,2),ms=e=>["queued","working","pending","running"].includes(e==null?void 0:e.phase);function gD({state:e,act:t}){var _,P,G,W,D,ne,q,Z,ie,ke,me,_e,Je,De,ue,ye;v.useContext(Kr);const a=(_=e.view)==null?void 0:_.routingEditor,[r,o]=v.useState({name:"my-routing",scope:"global",matrix:null,newRole:"",...a}),i=v.useRef(r),[s,l]=v.useState({});v.useEffect(()=>{a&&(i.current=a,o(a))},[a]);const c=M=>{const Y={...i.current,...M};i.current=Y,o(Y),t("view.update",{patch:{routingEditor:Y}})},u=e.setup||{},d=u.providers||[],p=u.matrices||[],[m,h]=xa(e,t,"routing-profiles",p,M=>[M.name,M.description,M.source],"Filter routing profiles"),f=M=>{var Y;return s[M]||((Y=e.actionStatus)==null?void 0:Y[M])},g=async(M,Y={})=>{l(se=>({...se,[M]:{phase:"pending"}}));try{const se=await t(M,Y);return l(Fe=>({...Fe,[M]:se?null:{phase:"error",error:"Request could not be sent. Try again."}})),se}catch(se){l(Fe=>({...Fe,[M]:{phase:"error",error:se.message}}))}};v.useEffect(()=>{g("routing.list"),i.current.requested&&g("routing.show",{name:i.current.requested})},[]);const y=()=>({...r.profiles,...r.matrix?{[r.profileKey||r.name]:{matrix:r.matrix,name:r.name,role:r.role,candidate:r.candidate,rawText:r.rawText,raw:r.raw}}:{}}),E=M=>{const Y=y(),se=Y[M];se?c({...se,profileKey:M,requested:null,profiles:Y,order:null,error:"",detailOpen:!1,candidateOpen:!1}):(c({profileKey:M,requested:M,profiles:Y,order:null,error:""}),g("routing.show",{name:M}))};v.useEffect(()=>{if(u.matrix&&u.matrix.name===i.current.requested){const M=u.matrix;c({matrix:M,name:M.name,profileKey:M.name,requested:null,rawText:cr(M),raw:!1,role:Object.keys(M.roles||{})[0],candidate:0,detailOpen:!1,candidateOpen:!1,error:""})}},[u.matrix,r.requested]),v.useEffect(()=>{!i.current.matrix&&!i.current.requested&&p.length&&E(u.active||p[0].name)},[p]);const b=r.matrix||Mf(r.name),S=Object.entries(b.roles||{}),w=(P=b.roles)!=null&&P[r.role]?r.role:(G=S[0])==null?void 0:G[0],N=(W=b.roles)==null?void 0:W[w],x=(N==null?void 0:N.candidates)||[],A=Math.min(r.candidate||0,Math.max(0,x.length-1)),C=x[A],[O,k]=xa(e,t,"routing-roles",S,([M,Y])=>[M,Y.description,...(Y.candidates||[]).flatMap(se=>[se.provider,se.model])],"Filter task roles");v.useEffect(()=>{r.order&&r.orderOpen!==!1&&!Iu(x,w,r.order)&&c({order:Tc(x,w,r.order)})},[r.order,r.orderOpen,w,x]);const T=M=>c({matrix:M,rawText:cr(M),error:""}),I=M=>T(oD(b,w,A,M)),F=C?d.filter(M=>M.id===C.provider||M.module==="provider-"+C.provider||M.module===C.provider):[],z=F.find(M=>M.id===(C==null?void 0:C.provider)),U=z?[z]:F,H=[...new Map(U.flatMap(M=>{var Y;return(((Y=u.modelCatalogs)==null?void 0:Y[M.id])||[]).map(se=>[typeof se=="string"?se:se.id,se])}).filter(([M])=>M)).values()],te=z?(D=u.providerCatalogs)==null?void 0:D[z.id]:void 0;v.useEffect(()=>{var Y,se;const M=(Y=e.actionStatus)==null?void 0:Y["routing.save"];(M==null?void 0:M.phase)==="ready"&&((se=M.target)==null?void 0:se.name)===i.current.name&&c({profileKey:i.current.name})},[(q=(ne=e.actionStatus)==null?void 0:ne["routing.save"])==null?void 0:q.updatedAt]);const j=ms(f("routing.save"))||ms(f("routing.use"));return n.createElement("section",{className:"a-settings-section","data-part":"routing-settings","data-candidate-open":!!r.candidateOpen},n.createElement("div",{className:"a-settings-row"},n.createElement("p",null,"Choose models for each role. Routing uses the first resolvable choice."),n.createElement("button",{className:"a-icon","aria-label":"Refresh routing profiles","data-action":"routing.list",disabled:ms(f("routing.list")),onClick:()=>g("routing.list")},n.createElement(Mt,null))),u.routingCatalogError&&n.createElement(nt,{phase:"error",message:u.routingCatalogError}),n.createElement("div",{className:"a-routing-profile-picker"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-profile"},"Routing profile"),n.createElement("select",{id:"routing-profile",value:r.profileKey||"","data-action":"routing.show",onChange:M=>E(M.target.value)},n.createElement("option",{value:"",disabled:!0},"Choose a profile"),m.map(M=>n.createElement("option",{key:M.name,value:M.name},M.name,M.active||u.active===M.name?" · active":"")),r.profileKey&&!m.some(M=>M.name===r.profileKey)&&n.createElement("option",{value:r.profileKey},r.name," · draft"))),n.createElement("button",{className:"a-soft",disabled:!p.some(M=>M.name===r.profileKey)||u.active===r.profileKey||j||!!r.requested,"data-action":"routing.use",onClick:()=>g("routing.use",{name:r.profileKey,scope:r.scope})},"Use profile"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{const M=Mf();c({profiles:y(),matrix:M,name:M.name,profileKey:"new:"+Date.now(),requested:null,role:"general",candidate:0,rawText:cr(M),order:null,detailOpen:!1,candidateOpen:!1})}},n.createElement(Ln,null),"New profile")),r.requested&&n.createElement(nt,{phase:((Z=f("routing.show"))==null?void 0:Z.phase)==="error"?"error":"working",message:((ie=f("routing.show"))==null?void 0:ie.error)||"Opening "+r.requested+"…"}),r.requested&&((ke=f("routing.show"))==null?void 0:ke.phase)==="error"&&n.createElement("button",{className:"a-soft","data-action":"routing.show",onClick:()=>g("routing.show",{name:r.requested})},"Retry opening profile"),["routing.list","routing.use"].map(M=>{var Y;return((Y=f(M))==null?void 0:Y.phase)==="error"&&n.createElement(nt,{key:M,phase:"error",message:f(M).error})}),r.matrix&&n.createElement(n.Fragment,null,n.createElement("details",{className:"a-routing-profile-options",open:!!r.profileDetails},n.createElement("summary",{"data-action":"view.update",onClick:M=>{M.preventDefault(),c({profileDetails:!r.profileDetails})}},"Profile settings"),h,n.createElement("p",{className:"a-caption"},(me=p.find(M=>M.name===r.profileKey))==null?void 0:me.description),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-name"},"Custom profile name"),n.createElement("input",{id:"routing-name",value:r.name,"data-action":"view.update",onChange:M=>c({name:M.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"routing-scope"},"Save for"),n.createElement("select",{id:"routing-scope",value:r.scope,"data-action":"view.update",onChange:M=>c({scope:M.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace"))))),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:w+" preference order",notice:r.order.notice,description:"Place your preferred choice first. Routing selects the first resolvable match; this is not a retry chain for failed API calls.",items:x.map((M,Y)=>({id:String(Y),label:M.model||"Choose a model",description:M.provider||"Choose a provider"})),ids:r.order.ids,onChange:M=>c({order:{...r.order,ids:M}}),onCancel:()=>c({order:null}),onSave:()=>{if(!Iu(x,w,r.order)){c({order:Tc(x,w,r.order)});return}const M=Pr(b,w,{candidates:r.order.ids.map(Y=>x[Number(Y)])});c({order:null,matrix:M,rawText:cr(M),candidate:0})}}):n.createElement(Co,{label:"roles",detailOpen:!!r.detailOpen,onBack:()=>c({detailOpen:!1,candidateOpen:!1}),list:n.createElement(n.Fragment,null,k,O.map(([M,Y])=>{var se;return n.createElement(Va,{key:M,id:M,label:M,description:Y.description||`${((se=Y.candidates)==null?void 0:se.length)||0} choices`,selected:M===w,onSelect:()=>c({role:M,candidate:0,detailOpen:!0,candidateOpen:!1,candidateRaw:!1})})}))},N&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,w),n.createElement("button",{className:"a-icon a-danger","aria-label":"Remove role "+w,disabled:["general","fast"].includes(w),"data-action":"view.update",onClick:()=>{const M={...b,roles:{...b.roles}};delete M.roles[w],T(M)}},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-description"},"Role description"),n.createElement("input",{id:"routing-description","aria-label":w+" description",value:N.description||"",placeholder:"Describe this role","data-action":"view.update",onChange:M=>T(Pr(b,w,{description:M.target.value}))}),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,x.length," ordered choices"),n.createElement("button",{className:"a-soft",disabled:x.length<2,"data-action":"view.update",onClick:()=>c({orderOpen:!0,order:Tc(x,w,r.order)})},"Preference order")),n.createElement("div",{className:"a-routing-candidates"},x.map((M,Y)=>n.createElement(Va,{key:Y,id:String(Y),label:`${Y+1}. ${M.model||"Choose a model"}`,description:M.provider||"Choose a provider",selected:Y===A,onSelect:()=>c({candidate:Y,candidateOpen:!0,candidateRaw:!1})}))),C&&n.createElement("div",{className:"a-routing-selected"},n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,"Choice ",A+1),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove ${w} candidate ${A+1}`,"data-action":"view.update",onClick:()=>T(Pr(b,w,{candidates:x.filter((M,Y)=>Y!==A)}))},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-candidate-provider"},"Provider or connection name"),n.createElement("input",{id:"routing-candidate-provider","aria-label":`${w} provider ${A+1}`,list:"routing-provider-options",value:C.provider||"",placeholder:"For example, anthropic or opus","data-action":"view.update",onChange:M=>I({provider:M.target.value})}),n.createElement("datalist",{id:"routing-provider-options"},[...new Set(d.flatMap(M=>[M.id,M.module.replace(/^provider-/,"")]))].map(M=>n.createElement("option",{key:M,value:M}))),n.createElement("p",{className:"a-caption"},"Use a provider family for a portable profile, or a connection name for a specific account and configuration."),n.createElement("label",{htmlFor:`routing-${w}-${A}`},"Model ID or pattern"),n.createElement(wp,{editable:!0,catalogKey:C.provider,id:`routing-${w}-${A}`,label:`${w} model ${A+1}`,value:C.model||"",entry:te,models:H,state:e,act:t,placeholder:"Model ID or pattern, e.g. claude-sonnet-*",onChange:M=>I({model:M})}),n.createElement("p",{className:"a-caption"},"Patterns are resolved by the routing module. Model lists are suggestions and do not limit what you can enter.",U.length>0?" Suggestions from "+U.map(M=>M.id).join(", ")+".":""),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":!!r.candidateRaw,onClick:()=>c({candidateRaw:!r.candidateRaw,candidateText:cr(C)})},"Edit choice configuration"),r.candidateRaw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Choice configuration JSON",className:"a-json-editor",value:r.candidateText,"data-action":"view.update",onChange:M=>c({candidateText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.candidateText);if(!M.provider||!M.model)throw new Error("Include a provider and model.");const Y=[...x];Y[A]=M,T(Pr(b,w,{candidates:Y}))}catch(M){c({error:M.message})}}},"Apply choice configuration"))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>{const M=Pr(b,w,{candidates:[...x,{provider:"",model:""}]});c({matrix:M,rawText:cr(M),candidate:x.length,candidateOpen:!0,candidateRaw:!1})}},n.createElement(Ln,null),"Add fallback model"))),n.createElement("div",{className:"a-routing-add"},n.createElement("input",{"aria-label":"New routing role",list:"routing-role-options",value:r.newRole||"",placeholder:"Add a role","data-action":"view.update",onChange:M=>c({newRole:M.target.value})}),n.createElement("datalist",{id:"routing-role-options"},(u.roles||[]).map(M=>n.createElement("option",{value:M,key:M}))),n.createElement("button",{className:"a-soft",disabled:!((_e=r.newRole)!=null&&_e.trim())||!!((Je=b.roles)!=null&&Je[r.newRole.trim()]),"data-action":"view.update",onClick:()=>{const M=r.newRole.trim(),Y=Pr(b,M,{description:"",candidates:[{provider:"",model:""}]});c({matrix:Y,rawText:cr(Y),newRole:"",role:M,candidate:0,detailOpen:!0,candidateOpen:!0})}},n.createElement(Ln,null),"Add role")),n.createElement("div",{className:"a-routing-advanced"},n.createElement("button",{className:"a-link","aria-expanded":!!r.raw,"data-action":"view.update",onClick:()=>c({raw:!r.raw,rawText:cr(b)})},r.raw?"Hide":"Show"," full profile JSON"),r.raw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Routing matrix JSON",className:"a-json-editor",spellCheck:!1,value:r.rawText,"data-action":"view.update",onChange:M=>c({rawText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.rawText);if(!M.roles||typeof M.roles!="object"||Array.isArray(M.roles))throw new Error("A profile needs a roles object.");T(M)}catch(M){c({error:M.message})}}},"Update draft from JSON"))),r.error&&n.createElement("p",{className:"a-danger",role:"alert"},r.error),n.createElement(Rn,{active:!r.order||r.orderOpen===!1},n.createElement("button",{className:"a-primary",disabled:j||!!r.requested||!!r.order&&r.orderOpen!==!1||!r.name.trim()||!S.length||S.some(([,M])=>{var Y;return!((Y=M.candidates)!=null&&Y.length)||M.candidates.some(se=>!se.provider||!se.model)}),"data-action":"routing.save",onClick:()=>g("routing.save",{name:r.name.trim(),matrix:{...b,name:r.name.trim()},scope:r.scope,activate:!0})},n.createElement($c,null),u.active===r.name?"Save active profile":"Save and use profile")),n.createElement("p",{className:"a-caption"},"General and fast roles are required. Saving applies to future conversation preparation."),n.createElement(nt,{phase:(De=f("routing.save"))==null?void 0:De.phase,message:((ue=f("routing.save"))==null?void 0:ue.error)||(ms(f("routing.save"))?"Saving routing profile…":((ye=f("routing.save"))==null?void 0:ye.phase)==="ready"?"Routing profile saved and selected.":"")})))}const ni=e=>JSON.stringify(e,null,2);function vD(e,t,a,r){var c;const o=(c=e.view)==null?void 0:c[t],[i,s]=v.useState({...a,...o});return v.useEffect(()=>{o&&s(u=>({...u,...o}))},[o]),[i,u=>{const d={...i,...u};s(d),r("view.update",{patch:{[t]:d}})}]}function bD({state:e,session:t,act:a,navigate:r=()=>{}}){var oe,Ze,it,zt,ct,qt,le,fe,xe,ze,Ye,ht,bt,ft,Ce,gt,Et,vt,at;const[o,i]=vD(e,"providerEditor",{id:"",module:"",source:"",config:"{}",scope:"global",model:"",effort:"",advanced:!1,credentialMode:(Ze=(oe=e.view)==null?void 0:oe.providerEditor)!=null&&Ze.id?"private":"environment",envVar:""},a),s=X=>i({dirty:!0,...X}),l=v.useRef({}),c=v.useRef(!1),[u,d]=v.useState(""),[p,m]=v.useState(o.config);v.useEffect(()=>{var X;m(c.current?((X=l.current[o.selectionKey??o.id])==null?void 0:X.configText)??o.config:o.config),c.current=!1},[o.config,o.selectionKey]);const h=e.setup||{},f=(h.providers||[]).filter(X=>X.enabled!==!1),g=f.find(X=>X.id===o.id),y=v.useRef(Date.now()/1e3),E=v.useRef(!1),[b,S]=v.useState({}),w=(X,Re=o.id)=>{var et;const ae=X+":"+Re,Le=(et=h.operations)==null?void 0:et[ae],Oe=b[ae];return Oe&&(!Le||Le.commandId!==Oe.commandId)?Oe:Le},N=X=>["queued","working","pending"].includes(X==null?void 0:X.phase),x=async(X,Re={})=>{const ae=X+":"+(["providers.credentials","providers.schema"].includes(X)?Re.module:Re.id||""),Le={phase:"pending",commandId:"local-"+Date.now(),envVar:Re.envVar||""};S(Oe=>({...Oe,[ae]:Le}));try{const Oe=await a(X,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(X)?{sessionId:t.id}:{},...Re});return S(et=>({...et,[ae]:Oe?null:{phase:"error",error:"The request could not be sent. Please retry."}})),Oe}catch(Oe){S(et=>({...et,[ae]:{phase:"error",error:Oe.message}}))}};v.useEffect(()=>{E.current=!1,y.current=h.providersLoadedAt||Date.now()/1e3,x("providers.list")},[t==null?void 0:t.workspace]);const A=((it=h.credentialCheck)==null?void 0:it.module)===o.module&&(o.envVar?h.credentialCheck.envVar===o.envVar:!h.credentialCheck.requestedEnvVar)?h.credentialCheck:null,C=A||((g==null?void 0:g.module)===o.module?g.credential:null),O=o.envVar||(C==null?void 0:C.envVar)||"",k=w("providers.credentials",o.module),T=k&&k.envVar===(o.envVar||"")?k:null,I=w("providers.models"),F=w("providers.schema",o.module),z=w("providers.test"),U=w("providers.list",""),H=o.credentialMode||"environment",te=o.module!=="provider-openai-chatgpt";v.useEffect(()=>{if(!o.module||H!=="environment"||!te)return;const X=setTimeout(()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}}),250);return()=>clearTimeout(X)},[o.module,o.envVar,H]);const j=["providers.save","providers.remove","providers.login","providers.move","providers.reorder"].some(X=>N(w(X))),_=((ct=(zt=h.providerCatalogs)==null?void 0:zt[o.id])==null?void 0:ct.metadata)||((qt=h.metadata)==null?void 0:qt[o.module])||(((le=h.providerMetadata)==null?void 0:le.module)===o.module?h.providerMetadata:null);v.useEffect(()=>{if(!/^provider-[A-Za-z0-9_.-]+$/.test(o.module)||_)return;const X=setTimeout(()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}}),250);return()=>clearTimeout(X)},[o.module,t==null?void 0:t.workspace]);const P=zl(((fe=h.modelCatalogs)==null?void 0:fe[o.id])||((h.modelsProviderId||h.providerId)===o.id?h.models:[])),G=((xe=h.login)==null?void 0:xe.providerId)===o.id?h.login:null,W=(G==null?void 0:G.status)||(G==null?void 0:G.phase),D=Jw(G==null?void 0:G.url);let ne,q="";try{ne=tr(p)}catch(X){q=X.message}const[Z,ie]=xa(e,a,"providers",f,X=>{var Re,ae;return[X.id,X.module,(Re=X.config)==null?void 0:Re.default_model,(ae=X.config)==null?void 0:ae.model]},"Filter providers"),ke=Or(o.authMode||((ze=g==null?void 0:g.config)==null?void 0:ze.auth_mode)),me=t&&["working","starting","running","stopping","busy"].includes(t.status),_e=X=>{var xt,Ut,rt,Xe,$e,Nt,Zt,rn;c.current=!0;const Re=o.selectionKey??o.id??"";l.current[Re]={apiKey:u,configText:p};const{connections:ae,...Le}=o,Oe={...ae,[Re]:Le},et=(X==null?void 0:X.id)||"",It=Oe[et]||(X?{modelEntry:"catalog",dirty:!1,authMode:Or((xt=X.config)==null?void 0:xt.auth_mode),credentialMode:(Ut=X.credential)!=null&&Ut.hasStoredKey||!X.credential&&X.credentialsConfigured?"private":"environment",envVar:((rt=X.credential)==null?void 0:rt.envVar)||"",id:X.id,module:X.module,source:X.source||"",config:ni(X.config||{}),model:((Xe=X.config)==null?void 0:Xe.default_model)||(($e=X.config)==null?void 0:$e.model)||"",effort:((Nt=X.config)==null?void 0:Nt.reasoning_effort)||""}:{modelEntry:"catalog",dirty:!1,id:"",module:"",source:"",config:"{}",model:"",effort:"",credentialMode:"environment",envVar:""});d(((Zt=l.current[et])==null?void 0:Zt.apiKey)||""),m(((rn=l.current[et])==null?void 0:rn.configText)??It.config),i({...It,connections:Oe,selectionKey:et,detailOpen:!0,order:null})};v.useEffect(()=>{var Re,ae,Le,Oe,et,st;if(E.current||!f.length||!h.providersLoadedAt||h.providersLoadedAtIt.id===o.id)||(!o.id&&!o.module?f[0]:null);X&&!o.dirty&&i({id:X.id,selectionKey:X.id,module:X.module,source:X.source||"",config:ni(X.config||{}),model:((Re=X.config)==null?void 0:Re.default_model)||((ae=X.config)==null?void 0:ae.model)||"",effort:((Le=X.config)==null?void 0:Le.reasoning_effort)||"",authMode:Or((Oe=X.config)==null?void 0:Oe.auth_mode),credentialMode:(et=X.credential)!=null&&et.hasStoredKey||!X.credential&&X.credentialsConfigured?"private":"environment",envVar:((st=X.credential)==null?void 0:st.envVar)||"",dirty:!1})},[h.providersLoadedAt]);const Je=v.useRef("");v.useEffect(()=>{var X;if(!((G==null?void 0:G.status)!=="completed"||G.loginId===Je.current||!g)){Je.current=G.loginId;try{const Re={...tr(p)};for(const Le of["auth_mode","token_file_path","host_file_path","login_on_mount"])Le in(g.config||{})&&(Re[Le]=g.config[Le]);const ae=ni(Re);m(ae),i({config:ae,authMode:Or((X=g.config)==null?void 0:X.auth_mode)})}catch{}}},[G==null?void 0:G.loginId,G==null?void 0:G.status,(Ye=g==null?void 0:g.config)==null?void 0:Ye.auth_mode]);const De=w("providers.remove");v.useEffect(()=>{(De==null?void 0:De.phase)==="ready"&&De.updatedAt>=y.current&&(delete l.current[o.id],d(""),m("{}"),i({id:"",module:"",config:"{}",model:"",dirty:!1,detailOpen:!1,connections:{...o.connections,[o.id]:void 0}}))},[De==null?void 0:De.updatedAt]);const ue=w("providers.save");v.useEffect(()=>{(ue==null?void 0:ue.phase)==="ready"&&ue.updatedAt>=y.current&&(d(""),l.current[o.selectionKey??o.id]={apiKey:"",configText:p},s({dirty:!1,connections:{...o.connections,[o.selectionKey??o.id]:void 0}}))},[ue==null?void 0:ue.updatedAt]),v.useEffect(()=>{var X;((X=w("providers.reorder",""))==null?void 0:X.phase)==="ready"&&o.order&&i({order:null})},[(ht=w("providers.reorder",""))==null?void 0:ht.updatedAt]);const ye=(X,Re={})=>x(X,{id:o.id,...Re}),M=yp(_,{...ne,default_model:o.model,model:o.model}).filter(X=>o.module!=="provider-openai-chatgpt"||X.id!=="auth_mode"),Y=(X,Re)=>{const ae={...ne};Re===""?delete ae[X]:ae[X]=Re,m(ni(ae)),s({config:ni(ae),dirty:!0,...X==="reasoning_effort"?{effort:Re}:{}})},se=async()=>{await x("providers.save",{...o.id?{id:o.id}:{},module:o.module.trim(),...o.source.trim()?{source:o.source.trim()}:{},config:{...ne,...o.model?{default_model:o.model}:{}},scope:o.scope,...te&&H==="environment"&&O?{apiKeyEnv:O}:u&&H==="private"?{apiKey:u}:{}})},Fe=!!u||p!==o.config||Object.values(l.current).some(X=>X.apiKey),je=!!o.dirty||Fe||Object.values(o.connections||{}).some(X=>X==null?void 0:X.dirty);return Gw("providers",{label:"Provider configuration",dirty:je,review:()=>{r("providers");const X=Object.entries(o.connections||{}).find(([,Re])=>Re==null?void 0:Re.dirty);!o.dirty&&!Fe&&X?_e(f.find(Re=>Re.id===X[0])||null):i({detailOpen:!0})},discard:()=>{l.current={},d(""),m("{}"),i({id:"",selectionKey:"",module:"",source:"",config:"{}",model:"",effort:"",dirty:!1,connections:{},detailOpen:!1})}}),n.createElement("section",{className:"a-settings-section","data-part":"provider-settings"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Model providers"),n.createElement("p",null,"Connect a provider and choose models for your conversations.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh providers","data-operation-pending":N(U)||void 0,"aria-busy":N(U)||void 0,"data-action":"providers.list",disabled:N(U),onClick:()=>x("providers.list")},n.createElement(Mt,null))),N(U)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading your saved providers…"),(U==null?void 0:U.error)&&n.createElement("p",{className:"a-danger",role:"alert"},U.error),!f.length&&!N(U)&&n.createElement("p",{className:"a-caption"},"No saved providers yet. Add a connection below."),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,f.length," saved connections"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>_e(null)},n.createElement(Ln,null),"Add provider"),n.createElement("button",{className:"a-soft",disabled:f.length<2||j,"data-action":"view.update",onClick:()=>i({orderOpen:!0,order:o.order||{ids:f.map(X=>X.id),expectedIds:f.map(X=>X.id),scope:o.scope}})},"Preference order")),o.order&&o.orderOpen!==!1?n.createElement(xp,{title:"Provider preference order",description:"Provider priority breaks ties after routing matches a model. Saving for "+({global:"all workspaces",project:"this project",local:"this workspace"}[o.order.scope]||o.order.scope)+". Routing profile choices stay separate.",items:f.map(X=>({id:X.id,label:X.id,description:X.module})),ids:o.order.ids,onChange:X=>i({order:{...o.order,ids:X}}),onCancel:()=>i({order:null}),busy:N(w("providers.reorder","")),error:(bt=w("providers.reorder",""))==null?void 0:bt.error,action:"providers.reorder",onSave:()=>x("providers.reorder",{...o.order})}):n.createElement(Co,{label:"providers",detailOpen:!!o.detailOpen,onBack:()=>i({detailOpen:!1}),list:n.createElement(n.Fragment,null,ie,n.createElement(Xt,{name:"provider-list",busy:N(U)},Z.map(X=>{var Re,ae;return n.createElement(Va,{key:X.id,id:X.id,label:X.id,description:(((Re=X.config)==null?void 0:Re.default_model)||((ae=X.config)==null?void 0:ae.model)||X.module)+" · "+(X.credentialsConfigured?"credentials ready":X.keySource||"credentials not configured"),selected:X.id===(o.selectionKey??o.id),onSelect:()=>_e(X)})})))},n.createElement("div",{className:"a-settings-provider-detail"},n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"provider-id"},"Provider instance name"),n.createElement("input",{id:"provider-id",value:o.id,"data-action":"view.update",onChange:X=>s({id:X.target.value}),placeholder:"openai"})),n.createElement("div",null,n.createElement("label",{htmlFor:"provider-scope"},"Save for"),n.createElement("select",{id:"provider-scope",value:o.scope,"data-action":"view.update",onChange:X=>s({scope:X.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project (shareable)"),n.createElement("option",{value:"local"},"This workspace (private)")))),n.createElement(Xt,{name:"provider-models",busy:N(I)},n.createElement("label",{htmlFor:"provider-model"},"Default model"),n.createElement(wp,{editable:!0,catalogKey:o.id,id:"provider-model",label:"Default model",value:o.model,entry:(ft=h.providerCatalogs)==null?void 0:ft[o.id],models:P,state:e,act:a,onChange:X=>s({model:X})})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!g||N(I),"data-operation-pending":N(I)||void 0,"aria-busy":N(I)||void 0,"data-action":"providers.models",onClick:()=>ye("providers.models",{refresh:!0})},n.createElement(Mt,null),N(I)?"Discovering models…":"Refresh models"),n.createElement("button",{className:"a-soft",disabled:!g||N(z),"data-operation-pending":N(z)||void 0,"aria-busy":N(z)||void 0,"data-action":"providers.test",onClick:()=>ye("providers.test")},n.createElement(Pt,null),N(z)?"Testing provider…":"Test connection"),n.createElement("button",{className:"a-soft",disabled:!g||j,"data-action":"providers.login",onClick:()=>ye("providers.login",{authMode:ke,scope:o.scope})},n.createElement(Kk,null),g!=null&&g.accountConnected?"Reconnect account":"Provider sign-in")),n.createElement(nt,{phase:I==null?void 0:I.phase,message:N(I)?"Discovering available models…":(I==null?void 0:I.error)||((I==null?void 0:I.phase)==="ready"?`${P.length?`Found ${P.length} models. Choose one above.`:"This provider returned no models. Enter a model ID manually."}`:"")}),n.createElement(nt,{phase:z!=null&&z.error?"error":N(z)?"working":((Ce=h.test)==null?void 0:Ce.reachable)===!1?"error":"ready",message:N(z)?"Testing provider connection…":(z==null?void 0:z.error)||((z==null?void 0:z.phase)==="ready"||((gt=h.test)==null?void 0:gt.providerId)===o.id?((Et=h.test)==null?void 0:Et.reachable)!==!1?"Provider check passed":"Provider check failed":""),detail:!N(z)&&!(z!=null&&z.error)&&((vt=h.test)==null?void 0:vt.providerId)===o.id?`${h.test.modelCount??0} models returned. This checks the provider’s model catalog; no chat request was sent.`:void 0}),n.createElement("p",{className:"a-caption"},"Checks use saved provider settings. Save changes before testing."),n.createElement(Zw,{key:o.id,state:e,id:o.id,sessionId:t==null?void 0:t.id,act:a,disabled:!g||j}),o.module==="provider-openai-chatgpt"&&n.createElement(n.Fragment,null,n.createElement(Ep,{account:g==null?void 0:g.account}),n.createElement(Kw,{mode:ke,onChange:X=>i({authMode:X}),disabled:j||["starting","waiting"].includes(W)})),G&&(o.module==="provider-openai-chatgpt"?n.createElement(Au,{login:G,busy:j,onCancel:()=>ye("providers.loginCancel"),onRetry:()=>ye("providers.login",{authMode:ke,scope:o.scope}),onEnablePlan:()=>ye("providers.login",{authMode:"chatgpt_plan",scope:o.scope,enablePlan:!0}),welcomeDismissed:o.welcomedLoginId===G.loginId,onWelcomeDismiss:()=>i({welcomedLoginId:G.loginId})}):n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"Provider sign-in · ",W),(G.instructions||[]).map((X,Re)=>n.createElement("p",{key:Re},X)),D&&n.createElement("a",{href:D,target:"_blank",rel:"noopener noreferrer","data-action":"providers.login",className:"a-link"},"Open secure provider sign-in"),G.error&&n.createElement("p",{className:"a-danger"},G.error),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"providers.loginStatus",onClick:()=>a("providers.loginStatus",{id:o.id})},"Check sign-in status"),["starting","waiting"].includes(W)&&n.createElement("button",{className:"a-soft","data-action":"providers.loginCancel",onClick:()=>a("providers.loginCancel",{id:o.id})},"Cancel sign-in")))),n.createElement(Xt,{name:"provider-options",busy:N(F),className:"a-provider-options"},n.createElement("h4",null,"Provider options"),N(F)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading options from this provider…"),(F==null?void 0:F.error)&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-danger"},F.error," You can still edit advanced configuration."),n.createElement("button",{className:"a-link","data-action":"providers.schema",onClick:()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}})},"Retry loading options")),M.map(X=>{var Le;const Re=(ne==null?void 0:ne[X.id])??"",ae="provider-option-"+X.id;return n.createElement("div",{key:X.id},n.createElement("label",{htmlFor:ae},X.display_name||X.id),(Le=X.choices)!=null&&Le.length?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(X.id,Oe.target.value)},n.createElement("option",{value:""},"Provider default",X.default!=null?` (${X.default})`:""),Re!==""&&!X.choices.includes(String(Re))&&n.createElement("option",{value:String(Re)},String(Re)," (saved)"),X.choices.map(Oe=>n.createElement("option",{key:Oe,value:Oe},Oe))):X.field_type==="boolean"?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(X.id,Oe.target.value===""?"":Oe.target.value==="true")},n.createElement("option",{value:""},"Provider default",X.default!=null?` (${X.default})`:""),n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):n.createElement("input",{id:ae,value:Re,"data-action":"view.update",placeholder:X.default||"Provider default",onChange:Oe=>Y(X.id,Oe.target.value)}),n.createElement("p",{className:"a-caption"},X.prompt))}),_&&!M.length&&n.createElement("p",{className:"a-caption"},"This provider has no additional options for the selected model.")),g&&n.createElement(n.Fragment,null,n.createElement(Tu,{credential:g.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:N(U),onClick:()=>x("providers.list")},n.createElement(Mt,null),"Refresh credentials")),n.createElement("details",{className:"a-provider-access",open:o.accessOpen??!(g!=null&&g.credentialsConfigured)},n.createElement("summary",{"data-action":"view.update",onClick:X=>{X.preventDefault(),i({accessOpen:!(o.accessOpen??!(g!=null&&g.credentialsConfigured))})}},"Provider & access · ",g!=null&&g.accountConnected?"Account connected":g!=null&&g.credentialsConfigured?"Credentials configured":"Setup needed")," ",n.createElement("label",{htmlFor:"provider-preset"},"Provider"),n.createElement("select",{id:"provider-preset",value:Ic.some(X=>X.module===o.module)?o.module:"custom","data-action":"view.update",onChange:X=>{const Re=X.target.value==="custom"?"":X.target.value;d(""),s({module:Re,envVar:"",credentialMode:["provider-chat-completions","provider-ollama","provider-vllm"].includes(Re)?"private":"environment",...!o.id&&Re?{id:Re.replace("provider-","")}:{}})}},n.createElement("option",{value:"custom"},"Custom provider module"),Ic.map(X=>n.createElement("option",{key:X.module,value:X.module},X.name))),!Ic.some(X=>X.module===o.module)&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-module"},"Provider module"),n.createElement("input",{id:"provider-module",value:o.module,"data-action":"view.update",onChange:X=>s({module:X.target.value}),placeholder:"provider-custom"})),te?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key-source"},"API key source"),n.createElement("select",{id:"provider-key-source",value:H,"data-action":"view.update",onChange:X=>{d(""),s({credentialMode:X.target.value})}},n.createElement("option",{value:"environment"},"Environment variable"),n.createElement("option",{value:"private"},"Private saved key")),H==="environment"?n.createElement(Xt,{name:"provider-credentials",busy:N(T)},n.createElement("label",{htmlFor:"provider-key-env"},"Environment variable name"),n.createElement("input",{id:"provider-key-env",value:O,"data-action":"view.update",onChange:X=>s({envVar:X.target.value}),placeholder:(C==null?void 0:C.defaultEnvVar)||"MY_PROVIDER_API_KEY",spellCheck:!1,autoComplete:"off"}),(C==null?void 0:C.defaultEnvVar)&&n.createElement("p",{className:"a-caption"},"Default: ",n.createElement("code",null,C.defaultEnvVar),!!((at=C.alternatives)!=null&&at.length)&&n.createElement(n.Fragment,null," · Also supported: ",C.alternatives.join(", "))),n.createElement(nt,{phase:N(T)?"working":T!=null&&T.error||A&&!(C!=null&&C.available)?"error":"ready",message:N(T)?"Checking environment variable…":(T==null?void 0:T.error)||(A||!o.envVar&&C?C!=null&&C.available?"Found — this variable will supply the key.":"Not found in the app environment. Set it before launching the app, then restart.":""),detail:A!=null&&A.checkedAt&&!N(T)?`Checked ${new Date(A.checkedAt*1e3).toLocaleTimeString()}`:void 0}),n.createElement("button",{className:"a-link","data-action":"providers.credentials",disabled:N(T)||!o.module||!!o.envVar&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(o.envVar),onClick:()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}})},N(T)?"Checking…":"Check variable"),n.createElement("p",{className:"a-caption"},"Reads the backend’s launch environment and private key file. Only the variable name is saved. Key previews show only the beginning and end of longer keys.")):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key"},"API key"),n.createElement("input",{id:"provider-key",type:"password",autoComplete:"new-password","data-private":"true","data-action":"providers.save",value:u,onChange:X=>{d(X.target.value),i({dirty:!0})},placeholder:g!=null&&g.credentialsConfigured?"Leave blank to keep current credentials":"Stored privately on this computer"}),n.createElement("p",{className:"a-caption"},"The full key stays private on this computer; only a masked preview is shown."))):n.createElement("p",{className:"a-caption"},"This provider uses account sign-in rather than an API key.")),n.createElement("button",{className:"a-link","aria-expanded":o.advanced,"data-action":"view.update",onClick:()=>i({advanced:!o.advanced})},o.advanced?"Hide":"Show"," advanced configuration"),o.advanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-source"},"Module source (optional)"),n.createElement(Ma,{id:"provider-source",value:o.source,onChange:X=>s({source:X}),state:e,act:a,placeholder:"git+https://… or a local module folder"}),n.createElement("label",{htmlFor:"provider-config"},"Provider configuration (JSON)"),n.createElement("textarea",{id:"provider-config",className:"a-json-editor",value:p,spellCheck:!1,"data-private":"true","data-action":"providers.save",onChange:X=>{const Re=X.target.value;m(Re);try{tr(Re),s({config:Re})}catch{}}})),q&&n.createElement("p",{className:"a-danger"},q),["providers.save","providers.remove"].map(X=>{const Re=w(X);return Re&&n.createElement("p",{className:Re.error?"a-danger":"a-caption",role:"status",key:X},Re.error||(N(Re)?"Saving provider settings…":X==="providers.save"?"Provider saved. New conversations will use these settings.":"Provider removed."))}),n.createElement(Rn,{active:!!o.detailOpen},n.createElement("button",{className:"a-primary",disabled:!o.module.trim()||!!q||j||te&&H==="environment"&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(O),"data-operation-pending":N(ue)||void 0,"aria-busy":N(ue)||void 0,"data-action":"providers.save",onClick:se},n.createElement(Pt,null),"Save provider"),n.createElement("button",{className:"a-soft a-danger",disabled:!g||j,"data-operation-pending":N(w("providers.remove"))||void 0,"aria-busy":N(w("providers.remove"))||void 0,"data-action":"providers.remove",onClick:()=>x("providers.remove",{id:o.id,scope:o.scope})},n.createElement(ea,null),"Remove")),t&&g&&n.createElement("div",{className:"a-provider-session"},n.createElement("button",{className:"a-soft",disabled:!o.model||me||j,"data-action":"runtime.control",onClick:()=>a("runtime.control",{sessionId:t.id,operation:"provider.select",args:{instance:o.id,model:o.model,...ne!=null&&ne.reasoning_effort?{effort:ne.reasoning_effort}:{}}})},"Use model in this conversation"),n.createElement("p",{className:"a-caption"},"Current-session selection requires the provider to be mounted by its bundle.")))))}const yD={open:!1,tab:"modules",scope:"global",section:"tools",id:"",module:"",source:"",config:"{}",enabled:!0,sourceKind:"module",sourceName:"",sourceUri:"",sourceSection:"tools",behavioral:!1,behaviorResultsExpanded:!1},Df=[["tools","Tools"],["hooks","Hooks"],["providers","Providers"],["orchestrator","Orchestrator"],["context","Context manager"]];function ED({state:e,act:t}){var O,k,T,I,F,z,U,H,te,j,_,P,G,W,D,ne,q;const a=(O=e.view)==null?void 0:O.registryDraft,[r,o]=v.useState({...yD,...a});v.useEffect(()=>{a&&o(Z=>({...Z,...a}))},[a]);const i=Z=>{const ie={...r,...Z};o(ie),t("view.update",{patch:{registryDraft:ie}})},[s,l]=v.useState(r.config);v.useEffect(()=>{l(r.config)},[r.config]);const c=e.registry||{},u=((k=e.management)==null?void 0:k.phase)==="working",d=["queued","working"].includes((I=(T=e.actionStatus)==null?void 0:T["modules.validate"])==null?void 0:I.phase)&&((U=(z=(F=e.actionStatus)==null?void 0:F["modules.validate"])==null?void 0:z.target)==null?void 0:U.id)===r.id,p=c.modules||[],m=c.sources||[],h=((H=c.validation)==null?void 0:H.id)===r.id?c.validation:null,[f,g]=xa(e,t,"registry-modules",p,Z=>[Z.id,Z.module,Z.section,Z.source],"Filter registered modules"),[y,E]=xa(e,t,"registry-sources",m,Z=>[Z.name,Z.kind,Z.source],"Filter source overrides");let b={},S="";try{b=tr(s)}catch(Z){S=Z.message}const w=((te=c.sourceValidation)==null?void 0:te.kind)===r.sourceKind&&((j=c.sourceValidation)==null?void 0:j.name)===r.sourceName.trim()&&((_=c.sourceValidation)==null?void 0:_.submittedSource)===r.sourceUri.trim()&&((P=c.sourceValidation)==null?void 0:P.scope)===r.scope&&((G=c.sourceValidation)==null?void 0:G.section)===r.sourceSection?c.sourceValidation:null,N={kind:r.sourceKind,name:r.sourceName.trim(),source:r.sourceUri.trim(),scope:r.scope,...r.sourceKind==="module"?{section:r.sourceSection}:{}},x=["sources.validate","sources.save"].some(Z=>{var ie,ke;return["queued","working"].includes((ke=(ie=e.actionStatus)==null?void 0:ie[Z])==null?void 0:ke.phase)}),A=Z=>{const ie=JSON.stringify(Z.config||{},null,2);l(ie),i({section:Z.section,id:Z.id,module:Z.module,source:Z.source||"",config:ie,enabled:Z.enabled!==!1})},C=()=>t(r.tab==="modules"?"modules.list":"sources.list",{scope:r.scope});return n.createElement(Pa,{id:"registries",title:"Advanced module & source registries",summary:"Register modules and override their sources",state:e,act:t},n.createElement("section",{className:"a-settings-section a-registry","data-part":"registries"},n.createElement("div",{className:"a-maintenance-content"},n.createElement("p",null,"Register individual modules or override where named modules and bundles are loaded from. Most setups can use community bundles above."),n.createElement("nav",{className:"a-settings-nav","aria-label":"Registry sections"},[["modules","Modules"],["sources","Source overrides"]].map(([Z,ie])=>n.createElement("button",{key:Z,className:r.tab===Z?"selected":"","data-action":"view.update",onClick:()=>i({tab:Z})},ie))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-scope"},"Configuration scope"),n.createElement("select",{id:"registry-scope",value:r.scope,"data-action":"view.update",onChange:Z=>i({scope:Z.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace (private)"))),n.createElement("button",{className:"a-soft",disabled:u,"data-action":r.tab==="modules"?"modules.list":"sources.list",onClick:C},n.createElement(Mt,null),"Load registry")),r.tab==="modules"?n.createElement(n.Fragment,null,g,n.createElement("div",{className:"a-provider-list"},f.map(Z=>n.createElement("button",{key:Z.section+":"+Z.id,className:r.id===Z.id&&r.section===Z.section?"selected":"","data-action":"view.update",onClick:()=>A(Z)},n.createElement("strong",null,Z.id),n.createElement("small",null,Z.section," · ",Z.enabled===!1?"disabled":"enabled"," · ",Z.scope||r.scope))),n.createElement("button",{"data-action":"view.update",onClick:()=>{l("{}"),i({id:"",module:"",source:"",config:"{}",enabled:!0})}},n.createElement(Ln,null),"Add module")),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-section"},"Module type"),n.createElement("select",{id:"registry-section",value:r.section,"data-action":"view.update",onChange:Z=>i({section:Z.target.value})},Df.map(([Z,ie])=>n.createElement("option",{key:Z,value:Z},ie)))),n.createElement("div",null,n.createElement("label",{htmlFor:"registry-id"},"Instance name (optional)"),n.createElement("input",{id:"registry-id",value:r.id,"data-action":"view.update",onChange:Z=>i({id:Z.target.value})}))),n.createElement("label",{htmlFor:"registry-module"},"Module name"),n.createElement("input",{id:"registry-module",value:r.module,"data-action":"view.update",onChange:Z=>i({module:Z.target.value}),placeholder:"tool-example"}),n.createElement("label",{htmlFor:"registry-source"},"Source (optional)"),n.createElement(Ma,{id:"registry-source",state:e,act:t,value:r.source,onChange:Z=>i({source:Z}),placeholder:"git+https://… or /local/path"}),n.createElement("label",{htmlFor:"registry-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"registry-config",className:"a-json-editor",value:s,"data-action":"modules.save","data-private":"true",spellCheck:!1,onChange:Z=>{const ie=Z.target.value;l(ie);try{tr(ie),i({config:ie})}catch{}}}),S&&n.createElement("p",{className:"a-danger"},S),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.enabled,"data-action":"view.update",onChange:Z=>i({enabled:Z.target.checked})}),"Enabled"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.behavioral,"data-action":"view.update",onChange:Z=>i({behavioral:Z.target.checked})}),"Also run module behavior tests"),n.createElement("p",{className:"a-caption"},"Behavior tests run the module’s code in an isolated process."),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||!!S||!r.module.trim(),"data-action":"modules.save",onClick:()=>t("modules.save",{section:r.section,module:r.module.trim(),...r.id?{id:r.id}:{},...r.source?{source:r.source}:{},config:b,enabled:r.enabled,scope:r.scope})},n.createElement(Pt,null),"Save module")),n.createElement("button",{className:"a-soft",disabled:u||!r.id,"data-operation-pending":d||void 0,"aria-busy":d||void 0,"data-action":"modules.validate",onClick:()=>t("modules.validate",{section:r.section,id:r.id,scope:r.scope,behavioral:r.behavioral})},"Validate core contract"),n.createElement("button",{className:"a-soft a-danger",disabled:u||!r.id,"data-action":"modules.remove",onClick:()=>t("modules.remove",{section:r.section,id:r.id,scope:r.scope})},n.createElement(ea,null),"Remove")),n.createElement(Xt,{name:"module-validation",busy:d},((ne=(D=(W=e.actionStatus)==null?void 0:W["modules.validate"])==null?void 0:D.target)==null?void 0:ne.id)===r.id&&n.createElement(nt,{phase:e.actionStatus["modules.validate"].phase==="ready"&&(h==null?void 0:h.passed)===!1?"error":e.actionStatus["modules.validate"].phase,message:e.actionStatus["modules.validate"].error||(e.actionStatus["modules.validate"].phase==="ready"?h!=null&&h.passed?"Module validation passed":"Module validation failed":"Validating module…")}),h&&n.createElement("div",{className:"a-selection-card"},n.createElement("strong",null,h.id,": ",h.passed?"validation passed":"validation needs attention"),n.createElement("ul",{className:"a-catalog-list"},(h.checks||[]).map((Z,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:Z.passed?"ready":"error",message:Z.name,detail:Z.message})))),h.behavioral&&n.createElement("div",null,n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.behaviorResultsExpanded,onClick:()=>i({behaviorResultsExpanded:!r.behaviorResultsExpanded})},h.behavioral.passed?"Behavior tests passed":"Behavior tests need attention"," · ",(h.behavioral.tests||[]).length," tests · ",r.behaviorResultsExpanded?"Hide":"Show"," results"),r.behaviorResultsExpanded&&n.createElement("ul",{className:"a-catalog-list"},(h.behavioral.tests||[]).map((Z,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:Z.status==="failed"?"error":Z.status==="skipped"?"neutral":"ready",message:Z.name,detail:Z.status})))))))):n.createElement(n.Fragment,null,E,n.createElement("div",{className:"a-routing-profiles"},y.map(Z=>n.createElement("div",{key:Z.kind+":"+Z.name},n.createElement("span",null,n.createElement("strong",null,Z.name),n.createElement("small",null,Z.kind," · ",Z.source)),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i({sourceKind:Z.kind,sourceName:Z.name,sourceUri:Z.source})},"Edit"),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove source ${Z.name}`,disabled:u,"data-action":"sources.remove",onClick:()=>t("sources.remove",{kind:Z.kind,name:Z.name,scope:r.scope})},n.createElement(ea,null))))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"source-kind"},"Source type"),n.createElement("select",{id:"source-kind",value:r.sourceKind,"data-action":"view.update",onChange:Z=>i({sourceKind:Z.target.value})},n.createElement("option",{value:"module"},"Module"),n.createElement("option",{value:"bundle"},"Bundle"))),n.createElement("div",null,n.createElement("label",{htmlFor:"source-name"},"Registered name"),n.createElement("input",{id:"source-name",value:r.sourceName,"data-action":"view.update",onChange:Z=>i({sourceName:Z.target.value}),placeholder:"tool-example"}))),n.createElement("label",{htmlFor:"source-uri"},"Repository URL or local path"),n.createElement(Ma,{id:"source-uri",state:e,act:t,value:r.sourceUri,onChange:Z=>i({sourceUri:Z}),placeholder:"git+https://… or /local/path"}),r.sourceKind==="module"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"source-section"},"Module type to validate"),n.createElement("select",{id:"source-section",value:r.sourceSection,"data-action":"view.update",onChange:Z=>i({sourceSection:Z.target.value})},Df.map(([Z,ie])=>n.createElement("option",{key:Z,value:Z},ie))),n.createElement("p",{className:"a-caption"},"Check the candidate before replacing the saved source. Validation checks the module contract; it does not start a conversation.")),n.createElement("div",{className:"a-dialog-actions"},r.sourceKind==="module"&&n.createElement("button",{className:"a-soft",disabled:u||x||!N.name||!N.source,"data-action":"sources.validate",onClick:()=>t("sources.validate",N)},"Validate without saving"),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||x||!N.name||!N.source,"data-action":"sources.save",onClick:()=>t("sources.save",{...N,...r.sourceKind==="module"?{validate:!0}:{}})},n.createElement(Pt,null),r.sourceKind==="module"?"Validate & save source":"Save source override"))),n.createElement(Xt,{name:"source-validation",busy:x},x&&n.createElement(nt,{phase:"working",message:"Validating candidate source…"}),!x&&w&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:w.passed?"ready":"error",message:w.saved?"Candidate validated and saved":w.passed?"Candidate validated; nothing saved":"Validation failed; saved source unchanged"}),(q=w.checks)==null?void 0:q.map((Z,ie)=>n.createElement(nt,{key:ie,phase:Z.passed?"ready":"error",message:Z.name,detail:Z.message}))))),n.createElement("p",{className:"a-caption"},"Saved configuration applies when sessions are prepared again. Use environment references for credentials; configure provider keys under Setup."))))}function Sp(e){var a;const t=[];for(const r of["providers","tools","hooks"])for(const[o,i]of(Array.isArray(e==null?void 0:e[r])?e[r]:[]).entries())t.push({key:`${r}:${o}`,section:r,index:o,module:i.module||"Unnamed module",id:i.instance_id||i.id||i.module,enabled:i.enabled!==!1,source:i.source,config:i.config||{},entry:i});for(const r of["orchestrator","context"]){const o=(a=e==null?void 0:e.session)==null?void 0:a[r];o&&t.push({key:`session:${r}`,section:r,index:r,module:typeof o=="string"?o:o.module,id:o.id||o.module||o,enabled:o.enabled!==!1,source:o.source,config:o.config||{},entry:o,required:!0})}return t}function Ff(e,t,a){const r=structuredClone(e),o=Sp(r).find(l=>l.key===t);if(!o)throw new Error("Select a module to edit.");const s={...typeof o.entry=="string"?{module:o.entry}:o.entry,...a};if(o.required){if(a.enabled===!1)throw new Error("The session requires an orchestrator and a context module.");r.session[o.section]=s}else r[o.section][o.index]=s;return r}function wD(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Configuration must be a JSON object.");return t}const ur=e=>JSON.stringify(e,null,2),kD={source:"",selectedUri:"",alias:"",role:"behavior",exportName:"my-amplifier",exportDescription:""};function Xw(e,t,a,r){const[o,i]=v.useState({...t,...e});v.useEffect(()=>{e&&i(l=>({...l,...e}))},[e]);function s(l){const c={...o,...l};i(c),r("view.update",{patch:{[a]:c}})}return[o,s]}function xD({state:e,session:t,act:a}){var x,A,C,O;const[r,o]=Xw((x=e.view)==null?void 0:x.bundleManager,kD,"bundleManager",a),i=Array.isArray(e.bundles)?e.bundles:((A=e.bundles)==null?void 0:A.entries)||[],[s,l]=v.useState({});v.useEffect(()=>{l(k=>Object.fromEntries(Object.entries(k).filter(([T,I])=>i.some(F=>F.id===T&&F.enabled!==I))))},[e.bundles]);const c=(C=e.actionStatus)==null?void 0:C["bundles.toggle"];v.useEffect(()=>{(c==null?void 0:c.phase)==="error"&&l(k=>{var I;const T={...k};return delete T[(I=c.target)==null?void 0:I.id],T})},[c]);const u=async(k,T)=>{l(I=>({...I,[k]:T}));try{if(!await a("bundles.toggle",{id:k,enabled:T}))throw new Error("Request not sent")}catch{l(I=>{const F={...I};return delete F[k],F})}},d=i.find(k=>k.id===r.entryId)||i[0],p=i.filter(k=>k.role!=="standalone"&&k.enabled!==!1),m=(O=e.actionStatus)==null?void 0:O["bundles.reorder"];v.useEffect(()=>{(m==null?void 0:m.phase)==="ready"&&r.order&&o({order:null})},[m==null?void 0:m.commandId,m==null?void 0:m.phase]);const h=e.bundleDiscovery||{},f=h.candidates||[],[g,y]=xa(e,a,"bundle-discovery",f,k=>[k.display_name,k.name,k.path,k.uri,k.kind,k.description],"Filter discovered bundles"),[E,b]=xa(e,a,"app-bundles",i,k=>[k.name,k.uri,k.role],"Filter app bundles"),S=f.find(k=>k.uri===r.selectedUri),w=e.management||{},N=Object.entries(e.actionStatus||{}).some(([k,T])=>k.startsWith("bundle")&&["queued","running","pending","working","discovering","applying"].includes(T.phase));return v.useEffect(()=>{a("bundles.list",{})},[]),n.createElement("div",{className:"a-bundle-pane"},n.createElement(Pa,{id:"add-bundles",title:"Add capabilities",summary:"Browse community bundle repositories",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(qr,null),n.createElement("div",null,n.createElement("h3",null,"Build your Amplifier"),n.createElement("p",null,"Add capabilities from community repositories, then shape the modules they compose into."))),w.error&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,w.error)),N&&n.createElement("div",{className:"a-management-status",role:"status"},n.createElement(Mt,{className:"a-progress-spinner"}),w.detail||"Updating your configuration…"),!N&&w.detail&&n.createElement("p",{className:"a-caption",role:"status"},w.detail),n.createElement("label",{htmlFor:"bundle-source"},"Repository or bundle URL"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"bundle-source",type:"url",value:r.source,placeholder:"https://github.com/owner/amplifier-bundle","data-action":"view.update",onChange:k=>o({source:k.target.value})}),n.createElement("button",{className:"a-primary",disabled:!r.source.trim()||N,"data-action":"bundle.discover",onClick:()=>a("bundle.discover",{url:r.source.trim()})},n.createElement(To,null),"Browse")),n.createElement("p",{className:"a-caption"},"Browse a repository’s YAML and Markdown bundles before choosing what to add."),f.length>0&&n.createElement("div",{className:"a-discovery","aria-label":"Discovered bundles"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,f.length," ",f.length===1?"bundle found":"bundles found"),h.revision&&n.createElement("code",null,h.revision.slice(0,9))),y,n.createElement("div",{className:"a-candidates"},g.map(k=>n.createElement("label",{className:`a-candidate ${(S==null?void 0:S.uri)===k.uri?"selected":""}`,key:k.uri},n.createElement("input",{type:"radio",name:"bundle-candidate",checked:(S==null?void 0:S.uri)===k.uri,"data-action":"view.update",onChange:()=>o({selectedUri:k.uri,alias:k.name||"",role:k.kind==="standalone"?"standalone":"behavior"})}),n.createElement("span",null,n.createElement("strong",null,k.display_name||k.name||k.path),n.createElement("small",null,k.path||k.uri),k.description&&n.createElement("p",null,k.description)),n.createElement("span",{className:"a-kind-tag"},k.kind||"bundle")))),n.createElement("p",{className:"a-caption"},"Type suggestions are based on file contents. Choose how you want to use the bundle below.")),(S||r.selectedUri)&&n.createElement("div",{className:"a-selection-card"},n.createElement("label",{htmlFor:"bundle-add-role"},"Use this bundle as"),n.createElement("select",{id:"bundle-add-role",value:r.role,"data-action":"view.update",onChange:k=>o({role:k.target.value})},n.createElement("option",{value:"behavior"},"An app capability — compose into sessions"),n.createElement("option",{value:"standalone"},"A standalone bundle — register an alias")),n.createElement("label",{htmlFor:"bundle-alias"},r.role==="standalone"?"Bundle alias":"Display name"),n.createElement("input",{id:"bundle-alias",value:r.alias,"data-action":"view.update",onChange:k=>o({alias:k.target.value}),placeholder:"my-capabilities"}),n.createElement("p",{className:"a-caption a-wrap"},r.selectedUri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:N||!r.selectedUri||r.role==="standalone"&&!r.alias.trim(),"data-action":"bundles.add",onClick:()=>a("bundles.add",{uri:r.selectedUri,...S!=null&&S.reviewId?{reviewId:S.reviewId}:{},name:r.alias.trim()||void 0,role:r.role})},n.createElement(Ln,null),r.role==="standalone"?"Register bundle":"Add capability"))))),n.createElement(Pa,{id:"app-bundles",title:"App bundles",summary:`${i.length} configured · inspect capabilities and aliases`,state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Your app bundles"),n.createElement("p",null,"Capabilities extend your conversations. Standalone aliases are available when starting a conversation.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh app bundles","data-action":"bundles.list",onClick:()=>a("bundles.list")},n.createElement(Mt,null))),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,i.length," configured · ",p.length," enabled capabilities"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:p.length<2||N,onClick:()=>o({orderOpen:!0,order:r.order||{ids:p.map(k=>k.id),expectedIds:p.map(k=>k.id)}})},"Composition order")),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:"Bundle composition order",description:"Capabilities compose from top to bottom. Later settings can override earlier ones. Disabled entries and standalone aliases are outside this chain.",items:p.map(k=>({id:k.id,label:k.name||k.uri,description:"App capability"})),ids:r.order.ids,onChange:k=>o({order:{...r.order,ids:k}}),onCancel:()=>o({order:null}),busy:["queued","working"].includes(m==null?void 0:m.phase),error:m==null?void 0:m.error,action:"bundles.reorder",onSave:()=>a("bundles.reorder",r.order)}):i.length?n.createElement(Co,{label:"bundles",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,b,E.map(k=>n.createElement(Va,{key:k.id,id:k.id,label:k.name||k.uri,description:k.role==="standalone"?"Standalone alias":"App capability",checked:s[k.id]??k.enabled!==!1,disabled:N,checkLabel:`Enable ${k.name||k.uri}`,checkAction:"bundles.toggle",onCheck:T=>u(k.id,T),selected:k.id===(d==null?void 0:d.id),onSelect:()=>o({entryId:k.id,detailOpen:!0})})))},d&&n.createElement(n.Fragment,null,n.createElement("h4",null,d.name||"Bundle"),n.createElement("p",null,d.role==="standalone"?"Standalone alias · choose it when starting a conversation.":"App capability · composes into prepared conversations."),n.createElement("p",{className:"a-caption"},d.enabled===!1?"Disabled":d.role==="standalone"?"Available as "+d.name:"Position "+(p.findIndex(k=>k.id===d.id)+1)+" of "+p.length+" in composition"),n.createElement("h5",null,"Source"),n.createElement("p",{className:"a-caption a-wrap"},d.uri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft a-danger","aria-label":`Remove ${d.name||"bundle"}`,disabled:N,"data-action":"bundles.remove",onClick:()=>a("bundles.remove",{id:d.id})},n.createElement(ea,null),"Remove bundle")),n.createElement("p",{className:"a-caption"},"Changes apply to future conversation preparation. Inspect conversation modules to change a loaded session."))):n.createElement("div",{className:"a-settings-empty"},n.createElement(ax,null),n.createElement("span",null,"Your app has no additional bundles yet. Browse a repository to add one.")))),n.createElement(Pa,{id:"loaded-modules",title:"Loaded session modules",summary:t?`Inspect and edit the running mount plan for ${t.title}`:"Select a conversation to inspect its mount plan",state:e,act:a},n.createElement(SD,{state:e,session:t,act:a})),n.createElement(ED,{state:e,act:a}),n.createElement(Pa,{id:"share-bundle",title:"Save and share",summary:"Export this session as a reusable bundle",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(wa,null),n.createElement("div",null,n.createElement("h3",null,"Share your setup"),n.createElement("p",null,"Export the current session’s bundle and applied configuration for others to load with Amplifier Foundation."))),n.createElement("label",{htmlFor:"bundle-export-name"},"Bundle name"),n.createElement("input",{id:"bundle-export-name",value:r.exportName,"data-action":"view.update",onChange:k=>o({exportName:k.target.value})}),n.createElement("label",{htmlFor:"bundle-export-description"},"Description"),n.createElement("input",{id:"bundle-export-description",value:r.exportDescription,"data-action":"view.update",onChange:k=>o({exportDescription:k.target.value})}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!t||N||!r.exportName.trim(),"data-action":"bundle.export",onClick:()=>a("bundle.export",{sessionId:t.id,name:r.exportName.trim(),description:r.exportDescription})},n.createElement(wa,null),"Export app bundle")),n.createElement("p",{className:"a-caption"},"Exports include bundle references and configuration. Provider credentials stay on this machine."))))}function SD({state:e,session:t,act:a}){var w,N,x,A;const[r,o]=Xw((w=e.view)==null?void 0:w.moduleEditor,{sessionId:"",text:"",selectedKey:"",configText:"",name:"my-amplifier",description:"",showRaw:!1,configAdvanced:!1},"moduleEditor",a),i=(t==null?void 0:t.configuration)||(((N=e.configuration)==null?void 0:N.sessionId)===(t==null?void 0:t.id)?e.configuration:null),s=i==null?void 0:i.plan;e.management;const l=(x=e.actionStatus)==null?void 0:x["configuration.apply"],c=(A=e.actionStatus)==null?void 0:A["configuration.inspect"],u=!!(t!=null&&t.configurationBusy)||["queued","working"].includes(c==null?void 0:c.phase)||["queued","working"].includes(l==null?void 0:l.phase),d=!!t&&["working","running","busy","starting","stopping"].includes(t.status);v.useEffect(()=>{t&&a("configuration.inspect",{id:t.id})},[t==null?void 0:t.id]),v.useEffect(()=>{var C,O,k;s&&t&&(r.sessionId!==t.id||!r.text||((C=t.pendingConfiguration)==null?void 0:C.phase)==="ready"&&r.appliedAt!==((O=t.pendingConfiguration)==null?void 0:O.appliedAt))&&o({sessionId:t.id,text:ur(s),selectedKey:"",configText:"",appliedAt:(k=t.pendingConfiguration)==null?void 0:k.appliedAt})},[t==null?void 0:t.id,s]);let p=null,m="";try{r.sessionId===(t==null?void 0:t.id)&&r.text&&(p=wD(r.text))}catch(C){m=C.message}const h=Sp(p),f=h.find(C=>C.key===r.selectedKey),[g,y]=xa(e,a,"loaded-modules",h,C=>[C.id,C.module,C.section,C.source],"Filter loaded modules"),E=!!p&&ur(p)!==ur(s);function b(C,O){try{const k=Ff(p,C,O);o({text:ur(k),...C===r.selectedKey&&O.config?{configText:ur(O.config)}:{}})}catch(k){o({parseError:k.message})}}function S(C){o({selectedKey:C.key,detailOpen:!0,configText:ur(C.config),parseError:""})}return n.createElement("section",{className:"a-settings-section a-module-settings"},n.createElement("div",{className:"a-settings-heading"},n.createElement(Os,null),n.createElement("div",null,n.createElement("h3",null,"Running mount plan"),n.createElement("p",null,t?`Inspect the loaded configuration behind “${t.title}”.`:"Start or select a conversation to inspect its composed configuration."))),t&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:c==null?void 0:c.phase,message:(c==null?void 0:c.error)||(["queued","working"].includes(c==null?void 0:c.phase)?"Reading the loaded AmplifierSession mount plan…":"")}),n.createElement("div",{className:"a-settings-row"},n.createElement("span",{className:"a-caption a-wrap"},t.bundle),n.createElement("button",{className:"a-soft",disabled:u,"data-action":"configuration.inspect",onClick:()=>a("configuration.inspect",{id:t.id})},n.createElement(Mt,null),s?"Refresh configuration":"Load configuration")),s&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"The fully composed plan includes your root bundle and app capabilities. Edits below apply to this conversation’s mounted configuration. Apply changes to reload modules and preserve the conversation history."),n.createElement(Co,{label:"modules",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,y,g.map(C=>n.createElement(Va,{key:C.key,id:C.key,label:C.id,description:C.section+(C.required?" · required":""),checked:C.enabled,disabled:C.required,checkLabel:`Enable ${C.id}`,onCheck:O=>b(C.key,{enabled:O}),selected:C.key===r.selectedKey,onSelect:()=>S(C)})))},f?n.createElement(n.Fragment,null,n.createElement("h4",null,f.module),f.source&&n.createElement("p",{className:"a-caption a-wrap"},f.source),n.createElement("div",{className:"a-module-fields"},Object.entries(f.config).map(([C,O])=>{const k=/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(C),T="module-field-"+C;return n.createElement("div",{key:C},n.createElement("label",{htmlFor:T},C.replaceAll("_"," ")),k?n.createElement("p",{className:"a-caption"},"Credential preserved. Manage keys in Model providers."):typeof O=="boolean"?n.createElement("select",{id:T,value:String(O),"data-action":"view.update",onChange:I=>b(f.key,{config:{...f.config,[C]:I.target.value==="true"}})},n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):O===null||typeof O=="object"?n.createElement("p",{className:"a-caption"},Array.isArray(O)?`${O.length} items`:"Structured value"," · edit in advanced configuration below."):n.createElement("input",{id:T,type:typeof O=="number"?"number":"text",value:O,"data-action":"view.update",onChange:I=>{typeof O=="number"&&!I.target.value||b(f.key,{config:{...f.config,[C]:typeof O=="number"?Number(I.target.value):I.target.value}})}}))})),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.configAdvanced,onClick:()=>o({configAdvanced:!r.configAdvanced})},r.configAdvanced?"Hide":"Edit"," advanced configuration"),r.configAdvanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"module-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"module-config",className:"a-json-editor",value:r.configText,spellCheck:!1,"data-action":"view.update",onChange:C=>{try{tr(C.target.value),o({configText:C.target.value,parseError:""})}catch(O){O.message.includes("private API key")?o({parseError:O.message}):o({configText:C.target.value,parseError:""})}}}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const C=tr(r.configText);o({text:ur(Ff(p,f.key,{config:C})),parseError:""})}catch(C){o({parseError:C.message})}}},n.createElement(Pt,null),"Update draft"))):n.createElement("div",{className:"a-settings-empty"},n.createElement(Os,null),n.createElement("span",null,"Select a module to edit its configuration."))),(m||r.parseError)&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,m||r.parseError)),n.createElement("div",{className:"a-module-plan-options"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>o({showRaw:!r.showRaw})},r.showRaw?"Hide":"Edit"," full configuration JSON"),r.showRaw&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"full-module-plan"},"Full composed plan"),n.createElement("textarea",{id:"full-module-plan",className:"a-json-editor a-full-plan",spellCheck:!1,value:r.text,"data-action":"view.update",onChange:C=>o({text:C.target.value,parseError:""})})),d&&n.createElement("p",{className:"a-caption"},"Work is active. Apply when idle will queue these changes until this turn and its worker lanes finish.")),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:!p||!!m||u||!E,"data-action":"configuration.apply",onClick:()=>a("configuration.apply",{id:t.id,config:p,whenIdle:!0})},n.createElement(Pt,null),d?"Apply when idle":"Apply to loaded session"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:!E&&!r.parseError&&!m,onClick:()=>o({text:ur(s),selectedKey:"",configText:"",parseError:""})},"Revert draft"),n.createElement("span",{className:"a-caption"},E?"Unapplied changes":"Saved configuration")),t.pendingConfiguration&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:t.pendingConfiguration.phase==="queued"?"pending":t.pendingConfiguration.phase==="applying"?"working":t.pendingConfiguration.phase,message:t.pendingConfiguration.error||t.pendingConfiguration.detail||"Applying mount-plan changes…"}),t.pendingConfiguration.phase==="queued"&&n.createElement("button",{className:"a-soft","data-action":"configuration.cancel",onClick:()=>a("configuration.cancel",{id:t.id})},"Cancel queued changes")),n.createElement("div",{className:"a-custom-bundle"},n.createElement("h4",null,"Keep this as a custom bundle"),n.createElement("p",null,"Save the applied configuration under your own name. Use Export below to share it. Apply any pending changes first."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-name"},"Name"),n.createElement("input",{id:"custom-bundle-name",value:r.name,"data-action":"view.update",onChange:C=>o({name:C.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-description"},"Description"),n.createElement("input",{id:"custom-bundle-description",value:r.description,"data-action":"view.update",onChange:C=>o({description:C.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!p||!!m||E||!r.name.trim()||u,"data-action":"bundle.save",onClick:()=>a("bundle.save",{sessionId:t.id,name:r.name.trim(),description:r.description})},n.createElement(wa,null),"Save custom bundle"))))))}function ek(e,t){const[a,r]=v.useState({visibility:"hidden"});return v.useLayoutEffect(()=>{var c,u;if(!e)return;const o=(c=t.current)==null?void 0:c.querySelector(".a-compact-popover"),i=(u=t.current)==null?void 0:u.querySelector("button");if(!o||!i)return;const s=()=>{const d=i.getBoundingClientRect(),p=Math.min(340,window.innerWidth-24),m=o.getBoundingClientRect().height;r({width:p,left:Math.max(12,Math.min(d.left,window.innerWidth-p-12)),top:Math.max(12,Math.min(d.top-m-10,window.innerHeight-m-12)),visibility:"visible"})};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{l.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[e,t]),a}const _i=(e,t)=>{var a,r;return((r=(a=e.registeredBundles)==null?void 0:a.find(o=>o.value===t))==null?void 0:r.label)||t||"Bundle"},Cp={};function tk(e){return e.compact?n.createElement(CD,{...e}):n.createElement(ND,{...e})}function CD({state:e,session:t,act:a,working:r}){var A,C,O,k,T;const o=Ja(e),i=Ag(e),s=((A=e.view)==null?void 0:A.composerBundle)||Cp,[l,c]=v.useState(s),[u,d]=v.useState(!1),[p,m]=v.useState(""),h=v.useRef(!1);v.useEffect(()=>c(s),[s]);const f=I=>{const F={...l,...I};c(F),a("view.update",{patch:{composerBundle:F}})},g=(t==null?void 0:t.bundle)||o.bundle||i.bundle||(((C=e.bundleDefaults)==null?void 0:C.workspacePath)===o.workspace?e.bundleDefaults.effective:""),y=l.open&&l.sessionId===((t==null?void 0:t.id)||null),E=v.useRef(null),b=ek(y,E);il(y,E,()=>f({open:!1})),v.useEffect(()=>{var I;(I=e.registeredBundles)!=null&&I.length||a("bundles.list",{})},[]);const S=e.registeredBundles||[],w=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1;async function N(I,F=!1){if(!h.current){h.current=!0,d(!0),m(""),f({bundle:I});try{await a(t?"bundle.switch":"view.update",t?{sessionId:t.id,bundle:I,resetModel:F}:{patch:{newSessionDraft:{...o,bundle:I}}})}catch(z){m(z.message)}finally{h.current=!1,d(!1)}}}const x=(t==null?void 0:t.bundlePreview)&&t.bundlePreview.bundle===l.bundle&&t.bundlePreview.modelCompatible===!1&&((O=t==null?void 0:t.bundleChange)==null?void 0:O.phase)!=="ready";return n.createElement("div",{className:"a-model-control a-bundle-control",ref:E},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle",disabled:!!w,"aria-expanded":!!y,"data-action":"view.update",onClick:()=>f({open:!y,sessionId:(t==null?void 0:t.id)||null,bundle:g})},n.createElement(qr,null),n.createElement("span",null,g?_i(e,g):i.phase==="error"?"Bundle unavailable":"Loading bundle…"),n.createElement(el,null)),y&&n.createElement("section",{className:"a-model-popover a-compact-popover",style:b,"aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>f({open:!1})},n.createElement(nn,null))),n.createElement("select",{"aria-label":"Registered root bundles",value:g||"",disabled:r||u||(t==null?void 0:t.configurationBusy),"data-action":t?"bundle.switch":"view.update",onChange:I=>N(I.target.value)},!g&&n.createElement("option",{value:"",disabled:!0},"Loading bundles…"),g&&!S.some(I=>I.value===g)&&n.createElement("option",{value:g},_i(e,g)),S.map(I=>n.createElement("option",{key:I.value,value:I.value},I.label||I.value))),((k=S.find(I=>I.value===g))==null?void 0:k.description)&&n.createElement("p",{className:"a-caption a-composer-bundle-description"},S.find(I=>I.value===g).description),x&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("button",{type:"button",className:"a-soft",disabled:u||r,onClick:()=>N(l.bundle,!0)},"Use the new bundle’s model")),(p||((T=t==null?void 0:t.bundleChange)==null?void 0:T.phase)==="error")&&n.createElement("small",{className:"a-danger",role:"status"},p||t.bundleChange.error)))}function ND({state:e,session:t,act:a,working:r}){var O,k,T,I,F;const o=((O=e.view)==null?void 0:O.composerBundle)||Cp,[i,s]=v.useState(o),[l,c]=v.useState(null),u=v.useRef(!1);v.useEffect(()=>s(o),[o]);const d=z=>{const U={...i,...z};s(U),a("view.update",{patch:{composerBundle:U}})},p=Ja(e),m=(t==null?void 0:t.bundle)||p.bundle||((k=e.bundleDefaults)==null?void 0:k.effective)||((T=e.settings)==null?void 0:T.bundle)||"work",h=i.open&&i.sessionId===((t==null?void 0:t.id)||null),f=v.useRef(null);il(h,f,()=>d({open:!1}));const g=t==null?void 0:t.bundleChange,y=t==null?void 0:t.bundlePreview,E=!!l||!!(t!=null&&t.configurationBusy)||(g==null?void 0:g.phase)==="working",b=(y==null?void 0:y.bundle)===i.bundle&&(y==null?void 0:y.previewId),S=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1,w=r||E||S||!((I=i.bundle)!=null&&I.trim()),N=b&&!y.modelCompatible&&!i.resetModel,x=l||(g==null?void 0:g.action),A=x==="bundle.preview"?"Previewing bundle changes…":x==="bundle.fork"?"Creating a conversation with this bundle…":"Switching bundle…";async function C(z){if(!u.current){u.current=!0,c(z);try{await a(z,z==="view.update"?{patch:{newSessionDraft:{...Ja(e),bundle:i.bundle},composerBundle:{},panel:null}}:{sessionId:t.id,bundle:i.bundle,...z!=="bundle.preview"?{...b?{previewId:y.previewId}:{},resetModel:!!i.resetModel}:{}})}finally{u.current=!1,c(null)}}}return n.createElement("div",{className:"a-model-control a-bundle-control",ref:f},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle","aria-expanded":!!h,"data-action":"view.update",onClick:()=>d({open:!h,sessionId:(t==null?void 0:t.id)||null,bundle:m,resetModel:!1})},n.createElement(qr,null),n.createElement("span",null,!t&&!p.bundle?"Workspace default":_i(e,m)),n.createElement(el,null)),h&&n.createElement("section",{className:"a-model-popover a-bundle-popover","aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>d({open:!1})},n.createElement(nn,null))),n.createElement("p",null,"Choose the tools, agents, and instructions for this conversation."),n.createElement(Ng,{id:"conversation-bundle",value:i.bundle||m,onChange:z=>d({bundle:z,resetModel:!1}),state:e,act:a}),t?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Switch directly, or preview the changes first. Switching keeps history and compatible model choices, and resets previous module edits, modes, and budget overrides."),b&&n.createElement("div",{className:"a-bundle-changes","aria-label":"Bundle changes"},Object.entries(y.changes||{}).map(([z,U])=>{var H,te,j,_;return n.createElement("div",{key:z},n.createElement("strong",null,z[0].toUpperCase()+z.slice(1)),"after"in U?n.createElement("p",null,U.before||"None"," → ",U.after||"None"):n.createElement(n.Fragment,null,((H=U.added)==null?void 0:H.length)>0&&n.createElement("p",null,"Add: ",U.added.join(", ")),((te=U.removed)==null?void 0:te.length)>0&&n.createElement("p",null,"Remove: ",U.removed.join(", ")),!((j=U.added)!=null&&j.length)&&!((_=U.removed)!=null&&_.length)&&n.createElement("p",null,"Same set; settings may change.")))}),n.createElement("p",null,"Instructions are replaced. Enabled app capabilities and shared settings still apply."),((F=y.appCapabilities)==null?void 0:F.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Added app capabilities (",y.appCapabilities.length,")"),n.createElement("ul",null,y.appCapabilities.map(z=>n.createElement("li",{key:z,className:"a-wrap"},z)))),!y.modelCompatible&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:!!i.resetModel,"data-action":"view.update",onChange:z=>d({resetModel:z.target.checked})})," Use the new bundle’s model"))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w||N||i.bundle===m,"data-action":"bundle.switch",onClick:()=>C("bundle.switch")},"Switch bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"bundle.preview",onClick:()=>C("bundle.preview")},"Preview changes"),n.createElement("button",{type:"button",className:"a-soft",disabled:w||N,"data-action":"bundle.fork",onClick:()=>C("bundle.fork")},"Fork with this bundle")),r&&n.createElement("p",null,"Finish this turn and its workers to preview or switch bundles."),(E||g)&&n.createElement(nt,{phase:E?"working":g.phase,message:E?A:g.error||(g.phase==="ready"?g.action==="bundle.preview"?"Preview ready":g.action==="bundle.fork"?"Fork created":"Bundle switched":"")})):n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"view.update",onClick:()=>C("view.update")},"Use bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:E||!p.bundle,"data-action":"view.update",onClick:()=>a("view.update",{patch:{newSessionDraft:{...p,bundle:""},composerBundle:{}}})},"Use workspace default"))))}function RD({state:e,act:t}){var h,f;const a=e.bundleDefaults||{},r=((h=e.view)==null?void 0:h.bundleDefaultsDraft)||Cp,[o,i]=v.useState(r),[s,l]=v.useState(!1),c=v.useRef(!1);v.useEffect(()=>i(r),[r]);const u=o.scope||"app",d=o.bundle??a[u]??"",p=g=>{const y={...o,...g};i(y),t("view.update",{patch:{bundleDefaultsDraft:y}})};async function m(g){var y;if(!c.current){c.current=!0,l(!0);try{await t("bundle.default",{scope:u,bundle:g,workspace:a.workspacePath||((y=e.settings)==null?void 0:y.workspace)})}finally{c.current=!1,l(!1)}}}return n.createElement("div",null,n.createElement("label",{htmlFor:"bundle-default-scope"},"Default applies to"),n.createElement("select",{id:"bundle-default-scope",value:u,"data-action":"view.update",onChange:g=>p({scope:g.target.value,bundle:a[g.target.value]||""})},n.createElement("option",{value:"app"},"This Unified app"),n.createElement("option",{value:"workspace"},"This workspace on this computer"),n.createElement("option",{value:"shared"},"Shared Amplifier settings (including CLI)")),n.createElement("label",{htmlFor:"default-bundle"},"Default bundle for new conversations"),n.createElement(Ng,{id:"default-bundle",value:d,state:e,act:t,onChange:g=>p({bundle:g})}),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:s||!d.trim(),"data-action":"bundle.default",onClick:()=>m(d.trim())},"Save default"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"bundle.default",onClick:async()=>{await m(null),p({bundle:""})}},"Use inherited default")),n.createElement("p",{className:"a-caption"},"New conversations here use ",n.createElement("strong",null,_i(e,a.effective||((f=e.settings)==null?void 0:f.bundle)))," from ",{workspace:"workspace settings",app:"this Unified app",shared:"shared Amplifier settings"}[a.source]||"shared Amplifier settings",". Workspace settings take priority over this app, then shared settings. Existing conversations keep their selected bundles."),u==="workspace"&&a.workspaceInherited&&n.createElement("p",{className:"a-caption"},"Clearing this computer’s override inherits the project’s ",_i(e,a.workspaceInherited)," default."))}const ao={page:"home",serverId:"",toolName:"",repository:"",ref:"",path:"",extras:"",connection:{id:"",name:"",transport:"stdio",command:"",args:"",env:"",cwd:"",url:"",headers:"",auth:"environment",installationId:""},values:{},raw:!1,json:"{}"},jt=e=>["running","working","queued","pending","connecting","installing"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase)),eo=e=>{var t;return["failed","error","interrupted"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase))||!!(e!=null&&e.error)||((t=e==null?void 0:e.result)==null?void 0:t.isError)===!0},Za=e=>JSON.stringify(e,null,2),ai=e=>Array.isArray(e)?e:Object.values(e||{}),Pi=e=>e.replace(/[_.-]+/g," ").replace(/^./,t=>t.toUpperCase()),Ta=e=>(e==null?void 0:e.repository)||(e==null?void 0:e.repo)||(e==null?void 0:e.url)||"",TD=e=>jt(e)?"working":eo(e)?"error":"ready",ID={"smartTools.catalog":"Catalog refreshed","smartTools.inspect":"Source inspected","smartTools.install":"Installation complete","smartTools.configure":"Connection saved","smartTools.connect":"Connected","smartTools.disconnect":"Disconnected","smartTools.remove":"Connection removed","smartTools.call":"Tool finished","smartTools.open":"Opened in canvas","smartTools.reconnect":"Reconnected","smartTools.schemas":"Tool fields loaded","smartTools.discover":"Tool definitions found","smartTools.uninstall":"Package uninstalled","smartTools.authStart":"Sign-in started","smartTools.authCancel":"Sign-in cancelled","smartTools.authForget":"Local sign-in removed","smartTools.accountAccept":"Account change accepted; reconnect explicitly"};function AD({value:e}){return typeof e=="string"?n.createElement("p",null,e):!Array.isArray(e)||e.some(t=>typeof t!="string"&&typeof(t==null?void 0:t.name)!="string")?n.createElement("pre",null,Za(e)):n.createElement("ul",{className:"a-smart-setup-requirements"},e.map((t,a)=>typeof t=="string"?n.createElement("li",{key:a},t):n.createElement("li",{key:a},n.createElement("strong",null,t.name),t.optional&&n.createElement("small",null," · Optional"),typeof t.purpose=="string"&&n.createElement("p",null,t.purpose),typeof t.install=="string"&&(/^https?:\/\//.test(t.install)?n.createElement("a",{href:t.install,target:"_blank",rel:"noreferrer"},"Setup instructions",n.createElement(sa,null)):n.createElement("p",null,t.install)),Object.keys(t).some(r=>!["name","optional","purpose","install"].includes(r))&&n.createElement("details",null,n.createElement("summary",null,"More requirement details"),n.createElement("pre",null,Za(t))))))}function _D(e,t){var l;const a=(l=e.view)==null?void 0:l.smartToolsEditor,[r,o]=v.useState({...ao,...a}),i=v.useRef(r);return v.useLayoutEffect(()=>{a&&(i.current={...ao,...a},o(i.current))},[a]),[r,c=>{const u={...i.current,...c};i.current=u,o(u),t("view.update",{patch:{smartToolsEditor:u}})}]}function PD(e,t,a={}){return[...e].reverse().find(r=>r.action===t&&Object.entries(a).every(([o,i])=>{var l,c;const s=((l=r.target)==null?void 0:l[o])??((c=r.args)==null?void 0:c[o])??(o==="id"?r.serverId:o==="name"?r.tool||r.name:r[o]);return r.target||r.args?(s??"")===(i??""):s==null||s===i}))}function ga({operation:e,busyMessage:t}){var r;if(!e)return null;const a=e.error||((r=e.result)!=null&&r.isError?"The tool reported an error. See its result below.":jt(e)?t||"Working…":ID[e.action]||"Finished");return n.createElement(nt,{phase:TD(e),message:typeof a=="string"?a:Za(a),detail:e.status==="interrupted"?"The previous app run ended before this request finished. Review the tool state before retrying.":void 0})}function OD({operation:e}){if(!e||jt(e)||e.result==null)return null;const t=e.result,a=!!(t&&typeof t=="object"&&t.$resource),r=a?t.summary??t.preview??null:t,o=typeof r=="string"?r:r==null?"":Za(r);return n.createElement("div",{className:"a-smart-result"},n.createElement("h4",null,"Result"),o&&n.createElement("pre",{tabIndex:0},o.slice(0,24e3)),a?n.createElement("p",{className:"a-caption"},"The full result is saved",typeof t.bytes=="number"?` (${Math.ceil(t.bytes/1024).toLocaleString()} KB)`:"",". Ask your agent to inspect it or show the details you need."):o.length>24e3&&n.createElement("p",{className:"a-caption"},"Showing the first 24,000 characters. The full result is saved and available for your agent to inspect."))}function MD(e){const t=e.split(` +`;var Pf={version:"0.20.45",id:"b48fe668835544e3"};const Ru=typeof Pf>"u"?{version:"dev",id:"dev"}:Pf,Ei=new Map;let jw="unknown";function ti(e){jw=["connecting","open","reconnecting","closed"].includes(e)?e:"unknown"}function VL(){const e=Symbol();return Ei.set(e,Date.now()),()=>Ei.delete(e)}function $w(e,t=globalThis){var l,c,u,d,p,m,h;const a=t.navigator||{},r=a.userAgent||"",o=r.match(/(Edg)\/([0-9.]+)/)||r.match(/(Firefox)\/([0-9.]+)/)||r.match(/(Chrome)\/([0-9.]+)/)||r.match(/(Version)\/([0-9.]+)/),i=!!((l=t.matchMedia)!=null&&l.call(t,"(prefers-color-scheme: dark)").matches),s=["light","dark","system"].includes((c=e==null?void 0:e.view)==null?void 0:c.scheme)?e.view.scheme:"system";return{frontendVersion:Ru.version,frontendBuild:Ru.id,browser:o?{Edg:"Edge",Firefox:"Firefox",Chrome:"Chrome",Version:"Safari"}[o[1]]:"Other",browserVersion:(o==null?void 0:o[2])||"",deviceOS:/Android/.test(r)?"Android":/iPhone|iPad|iPod/.test(r)?"iOS":/Windows/.test(r)?"Windows":/Macintosh/.test(r)?"macOS":/Linux/.test(r)?"Linux":"Other",width:Math.min(32768,t.innerWidth||0),height:Math.min(32768,t.innerHeight||0),pixelRatio:Math.min(16,t.devicePixelRatio||1),colorPreference:i?"dark":"light",appearance:s,resolvedAppearance:s==="system"?i?"dark":"light":s,standalone:!!((u=t.matchMedia)!=null&&u.call(t,"(display-mode: standalone)").matches||a.standalone),secureContext:!!t.isSecureContext,online:a.onLine!==!1,eventStream:jw,serviceWorkerControlled:!!((d=a.serviceWorker)!=null&&d.controller),reducedMotion:!!((p=t.matchMedia)!=null&&p.call(t,"(prefers-reduced-motion: reduce)").matches),visible:((m=t.document)==null?void 0:m.visibilityState)!=="hidden",pageAgeSeconds:Math.min(31536e3,Math.floor((((h=t.performance)==null?void 0:h.now())||0)/1e3)),pendingActions:Ei.size,oldestPendingMs:Ei.size?Date.now()-Math.min(...Ei.values()):0}}function WL(e,t){const a=r=>typeof r=="string"&&/^[a-f0-9]{12,64}$/.test(r);return a(e==null?void 0:e.id)&&a(t==null?void 0:t.id)&&(e.id!==t.id||e.version!==t.version)}async function ZL({prepare:e,reload:t}){await e(),t()}const Bw=v.createContext(null);function JL({enabled:e,blocked:t,prepare:a}){const[r,o]=v.useState(null),[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(a);d.current=a,v.useEffect(()=>{if(!e)return;let m=!0,h=!1;const f=new AbortController,g=async()=>{if(!(h||document.hidden)){h=!0;try{const y=await fetch("/build.json",{cache:"no-store",credentials:"same-origin",signal:f.signal});if(y.ok){const b=await y.json();m&&o(WL(Ru,b)?b:null)}}catch{}finally{h=!1}}};g();const E=setInterval(g,6e4);return window.addEventListener("focus",g),window.addEventListener("amplifier-reconnected",g),document.addEventListener("visibilitychange",g),()=>{m=!1,f.abort(),clearInterval(E),window.removeEventListener("focus",g),window.removeEventListener("amplifier-reconnected",g),document.removeEventListener("visibilitychange",g)}},[e]);const p=async()=>{if(!(!r||t||u.current)){u.current=!0,s(!0),c("");try{await ZL({prepare:()=>d.current(),reload:()=>window.location.reload()})}catch(m){c(m.message||"Your changes could not be saved. Try again when connected."),u.current=!1,s(!1)}}};return{available:!!r,version:r==null?void 0:r.version,busy:i,blocked:t,error:l,reload:p}}function Hw(){const e=v.useContext(Bw);return e!=null&&e.available?n.createElement("aside",{className:"a-reload-notice","data-part":"app-reload","aria-label":"App update ready"},n.createElement(Mt,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,"Update ready—reload to finish"),n.createElement("p",null,e.blocked||"Load the updated app in this tab. Your chats and saved settings stay in place."),e.error&&n.createElement("p",{role:"alert"},e.error)),n.createElement("button",{type:"button",className:"a-primary",disabled:e.busy||!!e.blocked,onClick:e.reload},e.busy?"Saving before reload…":"Reload now")):null}const Kr=v.createContext({compact:!1,active:!0,footer:null});function Rn({children:e,active:t=!0,className:a=""}){const r=v.useContext(Kr);if(r.compact&&!t)return null;const o=n.createElement("div",{className:"a-dialog-actions "+a},e);return r.compact&&r.active&&r.footer&&t?Mi.createPortal(o,r.footer):o}function KL(e){const[t,a]=v.useState(()=>typeof window<"u"&&window.matchMedia("(max-width:959px)").matches);return v.useLayoutEffect(()=>{var s;const r=((s=e.current)==null?void 0:s.closest(".a-overlay"))||e.current;if(!r)return;const o=()=>a(r.clientWidth<960);o();const i=new ResizeObserver(o);return i.observe(r),()=>i.disconnect()},[]),t}function YL(e,t){v.useEffect(()=>{var l;const a=(l=e.current)==null?void 0:l.closest(".a-overlay"),r=window.visualViewport;if(!t||!a||!r)return;let o;const i=()=>{r.scale===1&&(a.style.setProperty("--a-settings-viewport-top",r.offsetTop+"px"),a.style.setProperty("--a-settings-viewport-height",r.height+"px"),cancelAnimationFrame(o),o=requestAnimationFrame(()=>{var m;const c=document.activeElement;if(!((m=e.current)!=null&&m.contains(c))||!c.matches("input,textarea,select"))return;const u=c.closest(".a-settings-content");if(!u)return;const d=c.getBoundingClientRect(),p=u.getBoundingClientRect();d.bottom>p.bottom-16?u.scrollTop+=d.bottom-p.bottom+16:d.top{cancelAnimationFrame(o),r.removeEventListener("resize",i),r.removeEventListener("scroll",i),s.removeEventListener("focusin",i),a.style.removeProperty("--a-settings-viewport-top"),a.style.removeProperty("--a-settings-viewport-height")}},[t])}function GL({compact:e,trail:t,view:a,act:r,close:o,body:i,navigationRef:s,confirmClose:l=()=>Promise.resolve(!0),hasUnsaved:c=()=>!1}){const u=v.useRef(null),d=v.useRef(null),p=v.useRef(new Map),m=v.useRef(null),h=v.useRef(!1),[f,g]=v.useState(!1),E=v.useRef(!1);u.current={trail:t,view:a,act:r,close:o,confirmClose:l};const y=t.at(-1),b=y.key,S=v.useRef(a.settingsRootVisit);v.useEffect(()=>{const A=S.current!==a.settingsRootVisit;S.current=a.settingsRootVisit,m.current=b,h.current=!0;const C=requestAnimationFrame(()=>{i.current&&(i.current.scrollTop=A?0:p.current.get(b)||0),h.current=!1});return()=>cancelAnimationFrame(C)},[b,a.settingsRootVisit]);const w=()=>{i.current&&!h.current&&p.current.set(m.current,i.current.scrollTop)};v.useLayoutEffect(()=>{var z;if(!e||typeof window>"u")return;const A=(z=history.state)==null?void 0:z.amplifierSettings,C=typeof(A==null?void 0:A.token)=="string"&&A.token.startsWith("settings-")&&Number.isInteger(A.index)&&A.index>0&&A.index<10?A:null,O=(C==null?void 0:C.token)||"settings-"+crypto.randomUUID(),k={...history.state};delete k.amplifierSettings;const T={token:O,entries:C?[...u.current.trail]:[],index:(C==null?void 0:C.index)||0,closing:!1};d.current=T;const I=q=>{T.entries.splice(T.index),T.entries.push(q),T.index=T.entries.length,history.pushState({...k,amplifierSettings:{token:O,index:T.index}},"")};C||u.current.trail.forEach(I);const F=async q=>{var P,G;const W=(P=q.state)==null?void 0:P.amplifierSettings;if((W==null?void 0:W.token)!==O){if(T.confirming)return;if(T.closing){u.current.close();return}T.confirming=!0,g(!0);const Z=await u.current.confirmClose();if(T.confirming=!1,Z)T.closing=!0,u.current.close();else for(let D=1;D<=T.index;D++)history.pushState({...k,amplifierSettings:{token:O,index:D}},"");g(!1);return}T.index=W.index;const X=T.entries[T.index-1];if(!X)return;const U=Object.keys(X.navigation).find(Z=>{var D;return((D=X.navigation[Z])==null?void 0:D.orderOpen)===!0});if(U&&!((G=u.current.view[U])!=null&&G.order)){history.back();return}const _={...X.navigation};for(const Z of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])_[Z]&&(_[Z]={...u.current.view[Z],..._[Z]});u.current.act("view.update",{patch:_})};return window.addEventListener("popstate",F),()=>{var q,W;window.removeEventListener("popstate",F),d.current=null,((W=(q=history.state)==null?void 0:q.amplifierSettings)==null?void 0:W.token)===O&&!T.closing&&history.go(-T.index)}},[e]),v.useLayoutEffect(()=>{const A=d.current;if(!e||!A||A.closing||A.confirming)return;const C=A.entries[A.index-1];if(t.forEach((O,k)=>{A.entries[k]=O}),A.index>t.length){history.go(t.length-A.index);return}if(A.index===t.length){(C==null?void 0:C.key)!==b&&history.replaceState({...history.state,amplifierSettings:{token:A.token,index:A.index}},"");return}for(;A.index{const A=d.current;if(A&&A.index>1)w(),history.back();else if(t.length>1){const C=t.at(-2),O={...C.navigation};for(const k of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])O[k]&&(O[k]={...a[k],...O[k]});r("view.update",{patch:O})}else x()},x=async()=>{if(E.current)return;E.current=!0;const A=d.current;A&&(A.confirming=!0),g(!0);const C=await u.current.confirmClose();A&&(A.confirming=!1),C&&(A&&!A.closing?(A.closing=!0,history.go(-A.index)):o()),E.current=!1,g(!1)};return v.useEffect(()=>(s&&(s.current={close:x,confirmClose:l,hasUnsaved:c}),()=>{s&&(s.current=null)})),{back:N,dismiss:x,rememberScroll:w}}function QL(e){const[t,a]=v.useState(()=>typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches);return v.useEffect(()=>{const r=matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e==="dark"||e==="system"&&t?"dark":"light"}function XL({root:e,state:t,shell:a,scheme:r,mode:o,preview:i,css:s}){var l,c;v.useLayoutEffect(()=>{var h,f,g,E,y;if(!e.current||!a.ready||i||(h=t==null?void 0:t.view)!=null&&h.themePreview||(f=a.data)!=null&&f.preview)return;const u=getComputedStyle(e.current),d={};try{Object.assign(d,(g=JSON.parse(sessionStorage.getItem("amplifier.appearance")||"null"))==null?void 0:g.colors)}catch{}d[o]={background:u.backgroundColor,foreground:u.color};const p=(y=(E=t==null?void 0:t.theme)==null?void 0:E.definition)==null?void 0:y.palette;if(p)for(const b of["light","dark"])d[b]={background:p[b].bg,foreground:p[b].ink};const m={version:1,scheme:["light","dark","system"].includes(r)?r:"light",colors:d};try{sessionStorage.setItem("amplifier.appearance",JSON.stringify(m))}catch{}document.documentElement.style.colorScheme=o,document.documentElement.style.setProperty("--boot-bg",d[o].background),document.documentElement.style.setProperty("--boot-ink",d[o].foreground)},[e,a.ready,(l=a.data)==null?void 0:l.preview,(c=t==null?void 0:t.view)==null?void 0:c.themePreview,t==null?void 0:t.theme,r,o,i,s])}function eD({shell:e,onError:t}){const a=e.composition.presentation.decorations!==!1,[r,o]=v.useState(!1),[i,s]=v.useState(a);v.useEffect(()=>{r||s(a)},[a,r]);async function l(c){const u=c.target.checked;s(u),o(!0);try{await e.setPresentation({decorations:u})}catch(d){s(a),t(d.message)}finally{o(!1)}}return n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:i,disabled:r,"data-action":"shell.changes.apply",onChange:l}),"Show decorative theme background")}const tD={bg:"#e9ecf5",surface:"#ffffff",ink:"#23304d",accent:"#6353c7",line:"#d7ddec"};function nD({item:e}){const t={...tD,...e.palette};return n.createElement("div",{className:"a-appearance-swatch","aria-hidden":"true",style:{"--sw-bg":t.bg,"--sw-surface":t.surface,"--sw-ink":t.ink,"--sw-accent":t.accent,"--sw-line":t.line,"--sw-radius":e.radius||"12px",backgroundImage:e.background||"none",fontFamily:e.heading||"inherit",backgroundSize:e.id==="builtin:graphite"?"16px 16px":"cover"}},n.createElement("div",{className:"a-swatch-header"},n.createElement("span",null,"◉ Amplifier"),n.createElement("span",null,"•••")),n.createElement("div",{className:"a-swatch-body"},n.createElement("div",{className:"a-swatch-nav"},n.createElement("i",null),n.createElement("i",null),n.createElement("i",null)),n.createElement("div",{className:"a-swatch-chat"},n.createElement("strong",null,"Room for ideas."),n.createElement("span",{className:"a-swatch-line"}),n.createElement("span",{className:"a-swatch-line short"}),n.createElement("div",{className:"a-swatch-prompt"},n.createElement("span",null,"Ask anything…"),n.createElement("b",null,"↑")))))}function aD({state:e,shell:t,act:a,name:r,css:o,preview:i,setName:s,setCss:l,setPreview:c,defaultSkin:u,simple:d=!1,advancedOnly:p=!1,onAdvanced:m}){var Ee,me,_e,Je,De;const{active:h}=v.useContext(Kr),[f,g]=v.useState(""),[E,y]=v.useState({items:[],errors:[],directory:""}),[b,S]=v.useState(null),[w,N]=v.useState(!1),[x,A]=v.useState(""),[C,O]=v.useState(""),[k,T]=v.useState(!1),I=v.useRef(a),F=v.useRef(!0),z=v.useRef(0),q=v.useRef(i);I.current=a,q.current=i;const W=t.composition.presentation,X=W.scheme||((Ee=e.view)==null?void 0:Ee.scheme)||"system";async function U(){var ye;const ue=await I.current("theme.list",{});if(!Array.isArray((ye=ue.result)==null?void 0:ye.items))throw Error("The appearance library is unavailable. Try reopening Settings.");F.current&&(y(ue.result),g(""))}v.useEffect(()=>{if(!h)return;F.current=!0,U().catch(ye=>g(ye.message));const ue=setInterval(()=>U().catch(()=>{}),5e3);return()=>{F.current=!1,z.current++,clearInterval(ue),q.current&&(c(!1),I.current("view.update",{patch:{themePreview:!1}}).catch(()=>{}))}},[h]);async function _(ue){N(!0),A(""),O("");try{await ue()}catch(ye){F.current&&A(ye.message)}finally{F.current&&N(!1)}}async function P(ue){const ye=++z.current;await _(async()=>{const{result:M}=await I.current("theme.read",{id:ue.id});if(!F.current||ye!==z.current)return;S(ue.id),s(M.name),l(M.css);const Y=await I.current(d?"theme.apply":"theme.preview",{name:M.name,css:M.css});if((Y==null?void 0:Y.accepted)===!1)throw Error(Y.error||"Could not save appearance.");c(!d),d&&O(M.name+" saved.")})}async function G(){await _(async()=>{await I.current("theme.apply",{name:r,css:o}),c(!1),O(r+" applied.")})}async function Z(){await _(async()=>{var ue,ye;i&&await I.current("theme.revert",{}),c(!1),s(((ue=e.theme)==null?void 0:ue.name)||"Amplifier Unified"),l(((ye=e.theme)==null?void 0:ye.css)||u),S(null)})}async function D(ue){"name"in ue&&s(ue.name),"css"in ue&&l(ue.css),S(null),c(!1),await I.current("view.update",{patch:{themeDraft:ue.css??o,themeDraftName:ue.name??r,themePreview:!1}})}async function ne(){await _(async()=>{const{result:ue}=await I.current("theme.save",{name:r,css:o});S(ue.id),await U(),O("Saved to your appearance library.")})}async function H(ue){if(!ue)return;if(ue.size>99e4)throw Error("Choose a CSS appearance smaller than 1 MB.");const ye=await ue.text(),M=ue.name.replace(/\.amplifier\.css$|\.css$/i,"").slice(0,100),{result:Y}=await I.current("theme.save",{name:M,css:ye});return await U(),O(M+" added to your library. Select it to preview."),Y}const j=b||(((me=e.theme)==null?void 0:me.name)==="Amplifier Unified"?"builtin:default":(_e=E.items.find(ue=>{var ye;return ue.name===((ye=e.theme)==null?void 0:ye.name)}))==null?void 0:_e.id),ie=ue=>_(()=>t.setPresentation(ue));return n.createElement("div",{className:"a-appearance-settings","data-appearance-simple":d,"data-appearance-advanced":p},n.createElement("div",{className:"a-appearance-intro"},n.createElement("div",null,d?n.createElement("p",null,"Choose a look. Your choice is saved automatically."):n.createElement(n.Fragment,null,n.createElement("p",null,"Make this space yours."),n.createElement("small",null,"Choose an appearance to try it. Apply when it feels right."))),!d&&n.createElement("span",{className:"a-appearance-current"},n.createElement(Bc,{size:14}),i?"Previewing "+r:((Je=e.theme)==null?void 0:Je.name)||"Amplifier")),d&&n.createElement("h4",{className:"a-appearance-label"},"Look & feel"),n.createElement("div",{className:"a-appearance-gallery","aria-label":"Appearance library"},E.items.map(ue=>n.createElement("button",{type:"button",key:ue.id,className:"a-appearance-card","aria-label":(d?"Use ":"Preview ")+ue.name,"aria-pressed":j===ue.id,disabled:w,"data-action":d?"theme.apply":"theme.preview",onClick:()=>P(ue)},n.createElement(nD,{item:ue}),n.createElement("div",{className:"a-appearance-card-caption"},n.createElement("div",null,n.createElement("strong",null,ue.name),!d&&n.createElement("small",null,ue.tag)),j===ue.id?n.createElement(Pt,null):n.createElement(Bc,null)),!d&&n.createElement("p",null,ue.description))),!E.items.length&&!f&&n.createElement("p",{role:"status"},"Loading appearances…")),i&&n.createElement("div",{className:"a-appearance-preview",role:"status"},n.createElement("span",null,i?"Previewing "+r:"Current appearance"),n.createElement("div",null,i&&n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:Z},"Cancel preview"),n.createElement("button",{type:"button",className:"a-primary",disabled:w||!i,"data-action":"theme.apply",onClick:G},n.createElement(Pt,null),d?"Apply appearance":"Use "+r))),(x||f)&&n.createElement("p",{role:"alert",className:"a-danger"},x||f),C&&n.createElement("p",{role:"status",className:"a-appearance-notice"},n.createElement(Pt,{size:15}),C),n.createElement("section",{className:"a-appearance-options"},d?n.createElement("div",{className:"a-appearance-color"},n.createElement("label",{htmlFor:"appearance-color-mode"},"Color mode"),n.createElement("select",{id:"appearance-color-mode",value:X,disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({scheme:ue.target.value})},n.createElement("option",{value:"system"},"Device"),n.createElement("option",{value:"light"},"Light"),n.createElement("option",{value:"dark"},"Dark"))):n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Color mode"),n.createElement("p",null,"Keep a favorite look throughout the day.")),n.createElement("div",{className:"a-appearance-modes",role:"group","aria-label":"Color mode"},[["light","Light",gx],["dark","Dark",nx],["system","Device",Lu]].map(([ue,ye,M])=>n.createElement("button",{type:"button",key:ue,disabled:w,"aria-pressed":X===ue,"data-action":"shell.changes.apply",onClick:()=>ie({scheme:ue})},n.createElement(M,null),ye)))),n.createElement("fieldset",{className:"a-detail-level"},n.createElement("legend",null,"How much would you like to see?"),n.createElement("p",null,"Choose a calmer workspace or keep more information at hand. You can always open details."),n.createElement("div",{className:"a-detail-choices"},[["minimal","Focused","Quiet lists and simple work summaries. Extra information stays in details."],["standard","Balanced","Useful context and work totals, with deeper details one click away."],["detailed","Everything","Work activity opens automatically. Counts and list actions stay visible."]].map(([ue,ye,M])=>n.createElement("label",{key:ue,"data-selected":(W.interfaceDetail||W.executionDetail||"standard")===ue},n.createElement("input",{type:"radio",name:"interface-detail",value:ue,checked:(W.interfaceDetail||W.executionDetail||"standard")===ue,disabled:w,"data-action":"shell.changes.apply",onChange:()=>ie({interfaceDetail:ue,executionDetail:ue})}),n.createElement("span",null,n.createElement("strong",null,ye),n.createElement("small",null,M)))))),n.createElement("details",{className:"a-everyday-disclosure",open:!d||void 0},n.createElement("summary",null,"Layout & background"),n.createElement("div",null,n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Background"),n.createElement("p",null,"Decorative artwork stays behind your content.")),n.createElement(eD,{shell:t,onError:A})),n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("label",{htmlFor:"layout"},"Layout"),n.createElement("p",null,"Choose where the conversation and Canvas sit.")),n.createElement("select",{id:"layout",value:W.layout||((De=e.view)==null?void 0:De.layout)||"balanced",disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({layout:ue.target.value})},n.createElement("option",{value:"balanced"},"Canvas on the right"),n.createElement("option",{value:"conversation"},"More room for conversation"),n.createElement("option",{value:"work"},"Canvas on the left")))))),!d&&n.createElement("section",{className:"a-appearance-import"},n.createElement("div",null,n.createElement("h3",null,n.createElement(mg,null),"Your appearance library"),n.createElement("p",null,"Upload a CSS appearance once. It will stay here across restarts and be available to every connected device.")),n.createElement(Cg,{id:"theme-import",accept:".css,text/css",action:"theme.save",label:"Upload appearance",hint:"Drop a CSS file here · up to 1 MB",onFile:H}),E.errors.map(ue=>n.createElement("p",{className:"a-danger",key:ue.name},ue.name,": ",ue.message)),n.createElement("details",{className:"a-appearance-folder"},n.createElement("summary",null,n.createElement(nr,null),"Theme folder"),n.createElement("p",null,"CSS files placed here appear in the library automatically."),n.createElement("code",null,E.directory))),!d&&n.createElement("details",{className:"a-appearance-advanced",open:k,onToggle:ue=>T(ue.currentTarget.open)},n.createElement("summary",null,"Advanced customization"),n.createElement("p",null,"Edit or export a complete, portable CSS appearance. Embedded images and fonts travel with it."),n.createElement("label",{htmlFor:"theme-name"},"Appearance name"),n.createElement("input",{id:"theme-name",value:r,"data-action":"view.update",onChange:ue=>D({name:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("label",{htmlFor:"theme-css"},"CSS"),n.createElement("textarea",{id:"theme-css",spellCheck:!1,className:"a-css-editor",value:o,"data-action":"view.update",onChange:ue=>D({css:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"theme.save",onClick:ne},"Save to library"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.preview",onClick:()=>_(async()=>{await I.current("theme.preview",{name:r,css:o}),c(!0)})},"Preview"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.apply",onClick:G},"Apply skin"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:Z},"Revert edits"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.export",onClick:()=>_(()=>I.current("theme.export",{}))},n.createElement(wa,null),"Export current appearance"))),d&&n.createElement("div",{className:"a-everyday-footer"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:m},"Custom themes & CSS")),!d&&n.createElement("button",{type:"button",className:"a-link a-appearance-reset",disabled:w,"data-action":"theme.reset",onClick:()=>_(async()=>{await I.current("theme.reset",{}),c(!1),S(null)})},n.createElement(Mt,null),"Restore original appearance"))}const Zi=[{id:"ai",title:"AI connections",scope:"Across workspaces on this Amplifier host",pages:[["ai-connections","AI connections"],["overview","AI connections"]]},{id:"smart-tools",title:"Smart Tools",scope:"This Amplifier host",pages:[["smart-tools","Smart Tools"]]},{id:"appearance",title:"Appearance",scope:"This interface",pages:[["appearance","Appearance"]]},{id:"voice",title:"Voice",scope:"Future voice connections",pages:[["voice","Voice"]]},{id:"notifications",title:"Notifications",scope:"This app",pages:[["notifications","Notifications"]]},{id:"privacy",title:"Privacy & files",scope:"Your work and access choices",pages:[["privacy","Privacy & files"],["workspaces","Files & folders"],["recall","Memory & past work"],["permissions","File access"],["desktop","Screen & computer access"],["diagnostics","App diagnostic capture"],["history","Saved work"]]},{id:"updates",title:"Updates",scope:"This Amplifier host",pages:[["updates","Updates"]]},{id:"advanced",title:"Advanced",scope:"Full configuration",pages:[["advanced","Advanced"],["providers","Provider configuration"],["routing","Model rules"],["app-bundles","Configured bundles"],["add-bundles","Discover bundles"],["defaults","Conversation defaults"],["loaded-modules","Conversation modules"],["share-bundle","Save & share a bundle"],["registries","Module & source registries"],["tool-connections","Tool connections"],["custom-appearance","Custom appearance"],["conversation","Current conversation"],["outputs","Outputs & review"],["publishing","Publishing"],["repair","Backup & repair"],["reset","Advanced recovery"],["ready-conversations","Ready conversations"],["automation","Terminal & automation"],["install-app","Install app"],["runtime","Session controls"]]}],Of={setup:["overview","ai-connections","advanced","appearance","voice","providers","routing","defaults","conversation","install-app","runtime","custom-appearance"],capabilities:["smart-tools","tool-connections","app-bundles","add-bundles","loaded-modules","registries","share-bundle"],maintenance:["privacy","ready-conversations","updates","diagnostics","history","recall","outputs","publishing","permissions","notifications","automation","repair","reset"]};function Vw(e={},t=Zi){var o,i;const a=new Set(t.flatMap(s=>s.pages.map(([l])=>l))),r=e.panel==="appearance"?"appearance":((i=(o=e.settingsExpanded)==null?void 0:o.find)==null?void 0:i.call(o,s=>a.has(s)))||{capabilities:"app-bundles",maintenance:"updates"}[e.settingsSection]||"ai-connections";return{page:r,section:t.find(s=>s.pages.some(([l])=>l===r))}}function Ww(e,t=Zi){if(!t.some(a=>a.pages.some(([r])=>r===e)))throw new Error("Unknown settings page");return{panel:"settings",settingsSection:Object.keys(Of).find(a=>Of[a].includes(e))||"setup",settingsExpanded:[e]}}function rD(e,t){return t.pages.reduce((a,[r])=>{var o,i;return a+(((i=(o=e.attention)==null?void 0:o.pages)==null?void 0:i[r])||0)},0)}function bp(e,t=Zi){var a;return((a=t.flatMap(r=>r.pages).find(([r])=>r===e))==null?void 0:a[1])||"Settings"}function Is(e,t=Zi){const a=t.find(r=>r.pages.some(([o])=>o===e));return["privacy","advanced"].includes(a==null?void 0:a.id)&&e!==a.id?a.id:null}function Zw({state:e,id:t,sessionId:a,act:r,disabled:o=!1}){var E,y,b,S,w,N,x,A;const[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(null),p=(y=(E=e.setup)==null?void 0:E.operations)==null?void 0:y["providers.testMessage:"+t],m=(S=(b=e.setup)==null?void 0:b.messageTests)==null?void 0:S[t],h=(N=(w=e.setup)==null?void 0:w.providers)==null?void 0:N.find(C=>C.id===t),f=(h==null?void 0:h.module)==="provider-openai-chatgpt"&&(((x=h.account)==null?void 0:x.authMode)||((A=h.config)==null?void 0:A.auth_mode))==="chatgpt_plan";v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[p==null?void 0:p.commandId,p==null?void 0:p.phase]);async function g(){if(!(u.current||f)){u.current=!0,s(!0),c("");try{const C=await r("providers.testMessage",{id:t,...a?{sessionId:a}:{}});if(!(C!=null&&C.accepted)||!C.operationId)throw Error((C==null?void 0:C.error)||"The test could not be started.");d.current=C.operationId,s(C.operationId)}catch(C){u.current=!1,s(!1),c(C.message)}}}return v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[i]),n.createElement("div",{"data-part":"provider-message-test"},n.createElement("button",{type:"button",className:"a-soft","data-action":"providers.testMessage",disabled:!t||o||f||!!i,onClick:g},i?"Sending test message…":"Send test message"),n.createElement("p",{className:"a-caption"},f?"ChatGPT plan does not support this test's output limit. Use Test connection to check the model catalog; no test message is sent.":"Sends a small message using the saved model and credentials. Provider charges may apply. No chat is created."),l&&n.createElement("p",{role:"alert"},l),!i&&m&&n.createElement("div",{role:"status"},n.createElement("p",null,n.createElement("strong",null,m.supported===!1?"Test message unavailable":m.reachable?"Test message succeeded":"Test message failed")," · ",m.model," · ",(m.elapsedMs/1e3).toFixed(1)," s",m.statusCode?` · HTTP ${m.statusCode}`:""),n.createElement("p",null,m.reachable?m.response:m.error)))}function Tu({credential:e}){const t=e==null?void 0:e.preview;if(!t)return null;const a=t.source==="key-file"?"Private keys file (keys.env)":t.source==="environment"?"Service environment":t.source==="configuration"?"Provider configuration":"Provider managed";return n.createElement("div",{className:"a-provider-key-preview","data-part":"provider-key-preview"},n.createElement("p",null,"Service API key: ",n.createElement("strong",null,t.status==="available"?n.createElement("code",null,t.masked):t.status==="missing"?"Not available":"Preview unavailable")),n.createElement("p",{className:"a-caption"},a,t.envVar&&n.createElement(n.Fragment,null," · ",n.createElement("code",null,t.envVar))),n.createElement("p",{className:"a-caption"},"For new connections from this running service. Existing chats may still use an earlier key. A changed shell environment does not update a running service."))}function tr(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Provider configuration must be a JSON object.");function a(r){if(!(!r||typeof r!="object"))for(const[o,i]of Object.entries(r)){if(/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(o)&&typeof i=="string"&&!/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(i)&&!/^\[redacted\]$/i.test(i))throw new Error("Enter credentials in the private API key field, or use an environment reference in configuration.");a(i)}}return a(t),t}function zl(e){return(Array.isArray(e)?e:(e==null?void 0:e.models)||[]).map(a=>typeof a=="string"?{id:a,name:a}:{id:a.id||a.name||a.model,name:a.display_name||a.displayName||a.name||a.id||a.model}).filter(a=>a.id)}function Pr(e,t,a){var r;return{...e,roles:{...e==null?void 0:e.roles,[t]:{...(r=e==null?void 0:e.roles)==null?void 0:r[t],...a}}}}function oD(e,t,a,r){var i,s;const o=[...((s=(i=e==null?void 0:e.roles)==null?void 0:i[t])==null?void 0:s.candidates)||[]];return o[a]={...o[a],...r},Pr(e,t,{candidates:o})}function Mf(e="my-routing"){return{name:e,roles:{general:{description:"General conversation and work",candidates:[{provider:"",model:""}]},fast:{description:"Quick and lightweight work",candidates:[{provider:"",model:""}]}}}}function Jw(e){try{const t=new URL(e);if(t.protocol!=="https:"||t.username||t.password||t.hash)return null;for(const a of t.searchParams.keys())if(/^(id_token_hint|access_token|refresh_token|id_token|code|client_secret)$/i.test(a))return null;return t.href}catch{return null}}function yp(e,t={}){var r,o;return(((r=e==null?void 0:e.configSchema)==null?void 0:r.fields)||((o=e==null?void 0:e.info)==null?void 0:o.config_fields)||[]).filter(i=>i.id&&i.field_type!=="secret"&&!/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(i.id)&&!["model","default_model"].includes(i.id)).filter(i=>i.requires_model&&!t.default_model&&!t.model?!1:Object.entries(i.show_when||{}).every(([s,l])=>{const c=String(t[s]??"").toLowerCase(),u=String(l).toLowerCase();if(u.startsWith("matches:"))try{return new RegExp(String(l).slice(8),"i").test(c)}catch{return!1}for(const[d,p]of[["not_contains:",m=>!c.includes(m)],["contains:",m=>c.includes(m)],["not_startswith:",m=>!c.startsWith(m)],["startswith:",m=>c.startsWith(m)]])if(u.startsWith(d))return p(u.slice(d.length));return c===u}))}function Iu(e,t,a){return!!a&&a.role===t&&a.source===JSON.stringify(e)&&Array.isArray(a.ids)&&a.ids.length===e.length&&new Set(a.ids).size===e.length&&a.ids.every(r=>e.some((o,i)=>String(i)===r))}function Tc(e,t,a){return Iu(e,t,a)?a:{role:t,ids:e.map((r,o)=>String(o)),source:JSON.stringify(e),notice:(a==null?void 0:a.role)===t?"The choices changed. Review the current order before saving.":""}}const Or=e=>!e||e==="legacy_codex"?"chatgpt_codex":e,iD="https://chatgpt.com/settings/usage";function Ep({account:e}){return e?n.createElement("div",{className:"a-ai-hint"},n.createElement("p",null,e.authMode==="chatgpt_plan"?e.planEnabled?"Using ChatGPT plan":e.connected?"Signed in. Permission to use your ChatGPT plan is still needed.":"Sign in to use your ChatGPT plan.":"This connection uses ChatGPT Codex with device sign-in.",e.email&&n.createElement(n.Fragment,null," · ",e.email)),e.authMode==="chatgpt_plan"&&n.createElement("a",{className:"a-link",href:iD,target:"_blank",rel:"noopener noreferrer"},"Manage usage")):null}function Kw({mode:e,onChange:t,disabled:a=!1}){const r=v.useId();return n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:r},"ChatGPT connection"),n.createElement("select",{id:r,value:Or(e),disabled:a,onChange:o=>t(o.target.value)},n.createElement("option",{value:"chatgpt_codex"},"ChatGPT Codex · device sign-in"),n.createElement("option",{value:"chatgpt_plan"},"ChatGPT plan · browser sign-in")),e==="chatgpt_plan"?n.createElement(n.Fragment,null,n.createElement("p",null,"Continue with ChatGPT to authorize Amplifier Unified to use your plan. Use a browser on the computer running Amplifier."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Using a remote host, such as Spark?"),n.createElement("p",null,"Browser sign-in returns to the computer where the browser is open. For a remote host, sign in locally with the ChatGPT provider, transfer the credentials over SSH, and import them on the remote host. Keep its host identity separate; let the remote host own subsequent refreshes."),n.createElement("p",null,"ChatGPT Codex device sign-in is the default for Unified."),n.createElement("a",{href:"https://developers.openai.com/siwc/token-sharing-open-source/self-hosted-vms",target:"_blank",rel:"noopener noreferrer"},"Remote-host sign-in guide"),n.createElement("p",null,n.createElement("a",{href:"https://github.com/microsoft/amplifier-module-provider-openai-chatgpt/blob/main/docs/CHATGPT_PLAN_SIGN_IN.md#self-hosted-server",target:"_blank",rel:"noopener noreferrer"},"Amplifier setup commands")))):n.createElement("p",null,"Sign in with a one-time code. This is the default ChatGPT connection for Amplifier Unified."))}function Au({login:e,onCancel:t,onRetry:a,busy:r=!1,chooseModel:o=!1,onEnablePlan:i,onWelcomeDismiss:s,welcomeDismissed:l=!1}){var N,x,A;const{active:c}=v.useContext(Kr),u=v.useId(),d=v.useRef(null),p=v.useRef(""),[m,h]=v.useState(!1),[f,g]=v.useState(!1),E=e.authMode==="chatgpt_plan",y=e.deviceCode||"",b=Jw(e.url),S=["starting","waiting"].includes(e.status);async function w(){var C;try{if(!((C=navigator.clipboard)!=null&&C.writeText))throw Error();await navigator.clipboard.writeText(y),h(!0),g(!1)}catch{h(!1),g(!0)}}return v.useEffect(()=>{c&&y&&p.current!==y&&(p.current=y,w())},[y,c]),e.status==="completed"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-signin-success",role:"status"},n.createElement(Pt,null),E&&!((N=e.account)!=null&&N.planEnabled)?"Signed in. Plan access needs permission.":o?"Signed in. Choose your model below.":"Signed in successfully."),E&&n.createElement(Ep,{account:e.account})," ",E&&((x=e.account)==null?void 0:x.connected)&&!((A=e.account)!=null&&A.planEnabled)&&i&&n.createElement("button",{className:"a-primary",disabled:r,onClick:i},"Enable ChatGPT plan access"),e.showPlanWelcome&&!l&&n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"You’re using your ChatGPT plan"),n.createElement("p",null,"Usage from this connection counts toward your ChatGPT plan."),s&&n.createElement("button",{className:"a-soft",onClick:s},"Got it"))):n.createElement("div",{className:"a-device-signin"},S?n.createElement(n.Fragment,null,E?n.createElement(n.Fragment,null,n.createElement("p",{role:"status"},b?"Finish signing in on this host’s browser.":"Preparing secure sign-in…"),b&&n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Continue with ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption"},"Waiting for sign-in. This page will continue automatically.")):y?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:u},"1. Copy your sign-in code"),n.createElement("div",{className:"a-device-code"},n.createElement("input",{id:u,ref:d,readOnly:!0,value:y,spellCheck:!1,onFocus:C=>C.target.select(),onClick:C=>C.currentTarget.select()}),n.createElement("button",{className:"a-soft",type:"button","aria-label":"Copy sign-in code",onClick:w},m?n.createElement(Pt,null):n.createElement(rr,null),m?"Copied":"Copy")),n.createElement("p",{className:"a-caption",role:"status"},m?"Copied to your clipboard.":f?"Select the code to copy it, or use the Copy button.":"Keep this code ready for the next step.")):n.createElement("p",{role:"status"},"Getting your sign-in code…"),y&&b&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-device-step"},"2. Open ChatGPT and paste the code"),n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Open ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption",role:"status"},"Waiting for sign-in. This page will continue automatically.")),n.createElement("button",{className:"a-link",type:"button",disabled:r,"data-action":"providers.loginCancel",onClick:t},"Cancel sign-in")):n.createElement(n.Fragment,null,n.createElement("p",{role:e.error?"alert":"status"},e.error||"Sign-in was cancelled. You can try again."),n.createElement("button",{className:"a-primary",disabled:r,"data-action":"providers.login",onClick:a},"Try sign-in again")))}function gr({title:e,description:t,onClick:a,Icon:r=Dr,page:o,count:i,disabled:s=!1}){return n.createElement("button",{type:"button",className:"a-everyday-row",disabled:s,"data-action":"view.update","data-settings-destination":o,onClick:a},r!==Dr&&n.createElement(r,{"aria-hidden":"true"}),n.createElement("span",null,n.createElement("strong",null,e),t&&n.createElement("small",null,t)),n.createElement(Da,{count:i}),n.createElement(en,{"aria-hidden":"true"}))}function sD({navigate:e,state:t}){var r,o,i,s;const a=[["recall","Memory & past work","Choose what is saved and reused. Review and correct memories.",Lk],["workspaces","Files & folders","Choose where new workspaces are created.",nr],["permissions","File access","Review additional allowed and blocked folders.",px],["desktop","Screen & computer access","Check the host, browser, and permission status.",Lu],["history","Saved work","Import, export, and review cleanup.",wi],["diagnostics","App diagnostic capture","Review recorded data and forwarding destinations.",mo]];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Your saved work, memory, and access choices."),n.createElement("div",{className:"a-everyday-list"},a.filter(l=>l[0]!=="diagnostics").map(([l,c,u,d])=>{var p,m;return n.createElement(gr,{key:l,count:(m=(p=t.attention)==null?void 0:p.pages)==null?void 0:m[l],page:l,title:c,description:u,Icon:d,onClick:()=>e(l)})})),n.createElement("h4",null,"Diagnostics"),n.createElement("div",{className:"a-everyday-list"},n.createElement(gr,{page:"diagnostics",count:(o=(r=t.attention)==null?void 0:r.pages)==null?void 0:o.diagnostics,title:"App diagnostic capture",description:"Review collected records and forwarding.",Icon:mo,onClick:()=>e("diagnostics")})),n.createElement("div",{className:"a-everyday-footer"},n.createElement(gr,{page:"repair",count:(s=(i=t.attention)==null?void 0:i.pages)==null?void 0:s.repair,title:"Backups & recovery",description:"Create a private backup or troubleshoot this app.",onClick:()=>e("repair")})))}function lD({sections:e,navigate:t,state:a}){const r=e.flatMap(i=>i.pages).filter(([i])=>i.startsWith("shell:")),o=[{title:"Model rules",description:"Routing profiles, roles, and model preference.",page:"routing"},{title:"Provider configuration",description:"Instance names, credentials, and custom providers.",page:"providers"},{title:"Bundles & modules",description:"Composition, discovery, defaults, registries, and loaded modules.",pages:["app-bundles","add-bundles","defaults","loaded-modules","share-bundle","registries"]},{title:"Tool connections",description:"MCP connections, installation sources, and authentication.",page:"tool-connections"},{title:"Custom appearance",description:"Import, export, theme folders, and custom CSS.",page:"custom-appearance"},{title:"Conversation & work",description:"Current conversation, outputs, review, and publishing.",pages:["conversation","outputs","publishing"]},{title:"Performance & runtime",description:"Ready conversations, session controls, and terminal access.",pages:["ready-conversations","runtime","automation","install-app"]},{title:"Troubleshooting & recovery",description:"Diagnostics, backups, repair, and reset options.",pages:["diagnostics","repair","reset"]}];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"The full configuration, when you need it."),n.createElement("div",{className:"a-everyday-list"},o.map(i=>{var s,l;return i.page?n.createElement(gr,{key:i.title,title:i.title,description:i.description,page:i.page,count:(l=(s=a.attention)==null?void 0:s.pages)==null?void 0:l[i.page],onClick:()=>t(i.page)}):n.createElement("details",{className:"a-advanced-group",key:i.title},n.createElement("summary",null,n.createElement("span",null,n.createElement("strong",null,i.title),n.createElement("small",null,i.description)),n.createElement(Da,{count:i.pages.reduce((c,u)=>{var d,p;return c+(((p=(d=a.attention)==null?void 0:d.pages)==null?void 0:p[u])||0)},0)}),n.createElement(en,null)),n.createElement("div",null,i.pages.map(c=>{var u,d;return n.createElement(gr,{key:c,page:c,count:(d=(u=a.attention)==null?void 0:u.pages)==null?void 0:d[c],title:bp(c,e),onClick:()=>t(c)})})))})),r.length>0&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Extension settings"),n.createElement("div",{className:"a-everyday-list"},r.map(([i,s])=>{var l,c;return n.createElement(gr,{key:i,page:i,count:(c=(l=a.attention)==null?void 0:l.pages)==null?void 0:c[i],title:s,Icon:qr,onClick:()=>t(i)})}))))}const Yw=v.createContext(null);function Gw(e,t){const a=v.useContext(Yw);v.useEffect(()=>{a==null||a.register(e,t)}),v.useEffect(()=>()=>a==null?void 0:a.remove(e),[a,e])}function cD(){const e=v.useRef(new Map),t=v.useRef(null),[a,r]=v.useState(0),[o,i]=v.useState(null),s=v.useCallback(()=>r([...e.current.values()].filter(f=>f.dirty).length),[]),l=v.useCallback((f,g)=>{var y;const E=!!((y=e.current.get(f))!=null&&y.dirty)!=!!g.dirty;e.current.set(f,g),E&&s()},[s]),c=v.useCallback(f=>{e.current.delete(f)&&s()},[s]),u=v.useMemo(()=>({register:l,remove:c}),[l,c]),d=v.useCallback(()=>[...e.current.values()].some(f=>f.dirty),[]),p=v.useCallback(()=>{const f=[...e.current.values()].filter(y=>y.dirty);if(!f.length)return Promise.resolve(!0);if(t.current)return t.current.promise;let g;const E=new Promise(y=>{g=y});return t.current={promise:E,resolve:g},i(f),E},[]),m=f=>{const g=t.current;t.current=null,i(null),g==null||g.resolve(f)};v.useEffect(()=>{if(!a)return;const f=g=>{g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[a]),v.useEffect(()=>()=>{var f;(f=t.current)==null||f.resolve(!1)},[]);const h=o&&n.createElement("div",{className:"a-settings-draft-overlay"},n.createElement("div",{className:"a-settings-draft-confirm",role:"alertdialog","aria-modal":"true","aria-labelledby":"settings-unsaved-title",onKeyDown:f=>{var g;if(f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),m(!1)),f.key==="Tab"){const E=[...f.currentTarget.querySelectorAll("button")],y=E.indexOf(document.activeElement);f.preventDefault(),(g=E[(y+(f.shiftKey?-1:1)+E.length)%E.length])==null||g.focus()}}},n.createElement("h3",{id:"settings-unsaved-title"},"Unsaved connection changes"),n.createElement("p",null,"Your changes have not been saved. Review them before closing Settings, or discard them."),n.createElement("ul",null,o.map(f=>n.createElement("li",{key:f.label},f.label))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",autoFocus:!0,onClick:()=>{o[0].review(),m(!1)}},"Review and save"),n.createElement("button",{type:"button",className:"a-soft a-danger",onClick:()=>{o.forEach(f=>f.discard()),m(!0)}},"Discard changes"),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>m(!1)},"Keep settings open"))));return{context:u,confirmClose:p,hasUnsaved:d,count:a,dialog:h}}function uD({value:e,children:t}){return n.createElement(Yw.Provider,{value:e},t)}function dD(e,t,a){const[r,o]=v.useState(e),i=v.useRef(a);return i.current=a,v.useEffect(()=>{if(e===r)return;const s=u=>u==="settings"||u==="appearance",l=t.current;if(!s(r)||s(e)||!(l!=null&&l.hasUnsaved())){o(e);return}let c=!0;return l.confirmClose().then(u=>{c&&(u?o(e):i.current(r))}),()=>{c=!1}},[e,r,t]),r}function xa(e,t,a,r,o,i,{simple:s=!1}={}){var h,f;const l=((f=(h=e.view)==null?void 0:h.settingsFilters)==null?void 0:f[a])||"",[c,u]=v.useState(l);v.useEffect(()=>u(l),[l]);const d=nl(r,c,o),p=g=>{var E;u(g),t("view.update",{patch:{settingsFilters:{...(E=e.view)==null?void 0:E.settingsFilters,[a]:g}}})},m=n.createElement("div",{className:"a-list-filter"},n.createElement("label",{htmlFor:"filter-"+a},n.createElement(To,null),i),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"filter-"+a,type:"search",value:c,placeholder:s?i:"Search or pattern, e.g. *openai*","data-action":"view.update",onChange:g=>p(g.target.value)}),c&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Clear "+i.toLowerCase(),"data-action":"view.update",onClick:()=>p("")},n.createElement(nn,null))),n.createElement("small",{role:"status"},d.length," of ",r.length,c&&!d.length?" · No matches":"",!s&&n.createElement(n.Fragment,null," · Text search or wildcards: * ? [abc] [!abc]")));return[d,m,c]}function wp({id:e,label:t="Model",value:a="",onChange:r,onCommit:o,entry:i,models:s,state:l,act:c,disabled:u=!1,placeholder:d="Enter a model ID",catalogKey:p=e,editable:m=!1}){var S;const h=(i==null?void 0:i.phase)==="working"||(i==null?void 0:i.phase)==="queued",f=v.useRef(null),g=v.useRef(null);let E=zl((i==null?void 0:i.models)??s??[]);!m&&(h||(i==null?void 0:i.phase)==="error")&&!E.length&&((S=f.current)==null?void 0:S.key)===p&&(E=f.current.models),!h&&(i==null?void 0:i.phase)!=="error"&&(f.current={key:p,models:E}),Zu(g,h);const[y,b]=xa(l,c,"model-picker-"+e,E,w=>[w.id,w.name],"Filter "+t.toLowerCase());return m?n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},n.createElement("input",{list:E.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),E.length>0&&n.createElement(n.Fragment,null,n.createElement("datalist",{id:e+"-options"},E.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))),E.length>12&&b,n.createElement("select",{id:e+"-catalog","aria-label":"Choose "+t.toLowerCase()+" from catalog",value:E.some(w=>w.id===a)?a:"",disabled:u,"data-action":"view.update",onChange:w=>{w.target.value&&(r(w.target.value),o==null||o(w.target.value))}},n.createElement("option",{value:""},"Choose from ",E.length," cached models…"),y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),h&&n.createElement("small",{role:"status"},E.length?"Refreshing in the background. Saved models are available.":"Discovering models. You can enter a model ID now."),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.loadedAt)&&n.createElement("small",null,"Catalog checked ",new Date(i.loadedAt*1e3).toLocaleString()),(i==null?void 0:i.phase)==="ready"&&!E.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID.")):n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},E.length>12&&b,(i==null?void 0:i.phase)!=="error"&&(E.length||h)?n.createElement("select",{id:e,"aria-label":t,value:a,disabled:u||h&&!E.length,"data-action":"view.update",onChange:w=>{r(w.target.value),o==null||o(w.target.value)}},n.createElement("option",{value:""},h?"Loading provider models…":"Choose a model…"),a&&!y.some(w=>w.id===a)&&n.createElement("option",{value:a},a," (selected)"),y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))):n.createElement(n.Fragment,null,n.createElement("input",{list:E.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),E.length>0&&n.createElement("datalist",{id:e+"-options"},y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.phase)==="ready"&&!E.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID."))}function Qw(e){const t=r=>{var o;return((o=r.info)==null?void 0:o.id)||r.module||r.id},a=new Map;for(const r of e)a.set(t(r),(a.get(t(r))||0)+1);return e.map(r=>{var o;return{id:r.id,label:(((o=r.info)==null?void 0:o.display_name)||t(r))+(a.get(t(r))>1?` (${r.id})`:"")}}).sort((r,o)=>r.label.localeCompare(o.label,void 0,{sensitivity:"base"}))}const zf={"provider-anthropic":"git+https://github.com/microsoft/amplifier-module-provider-anthropic@main","provider-azure-openai":"git+https://github.com/microsoft/amplifier-module-provider-azure-openai@main","provider-chat-completions":"git+https://github.com/microsoft/amplifier-module-provider-chat-completions@main","provider-gemini":"git+https://github.com/microsoft/amplifier-module-provider-gemini@main","provider-github-copilot":"git+https://github.com/microsoft/amplifier-module-provider-github-copilot@main","provider-ollama":"git+https://github.com/microsoft/amplifier-module-provider-ollama@main","provider-openai":"git+https://github.com/microsoft/amplifier-module-provider-openai@main","provider-openai-chatgpt":"git+https://github.com/microsoft/amplifier-module-provider-openai-chatgpt@main","provider-vllm":"git+https://github.com/microsoft/amplifier-module-provider-vllm@main"},kp=[{module:"provider-github-copilot",name:"GitHub Copilot Subscription",description:"Use your GitHub Copilot subscription.",auth:"token"},{module:"provider-openai-chatgpt",name:"ChatGPT Subscription",description:"Sign in with your ChatGPT account.",auth:"signin"},{module:"provider-openai",name:"OpenAI API",description:"Use an API key. API billing is separate from ChatGPT.",auth:"key"},{module:"provider-anthropic",name:"Anthropic API",description:"Connect with your Anthropic API key.",auth:"key"},{module:"provider-gemini",name:"Google Gemini API",description:"Connect with your Gemini API key.",auth:"key"},{module:"provider-chat-completions",name:"OpenAI Compatible API",description:"Connect a local model or another compatible service.",auth:"optional-key"}],pD=[...kp,{module:"provider-azure-openai",name:"Azure OpenAI"},{module:"provider-ollama",name:"Ollama"},{module:"provider-vllm",name:"vLLM"}],Ic=Object.keys(zf).map(e=>({...pD.find(t=>t.module===e),module:e,source:zf[e]}));function Ac(e){return kp.find(t=>t.module===e)||{module:e,name:(e==null?void 0:e.replace(/^provider-/,""))||"AI service",auth:"key"}}function mD(e,t,a){var r,o;return(o=(r=e.setup)==null?void 0:r.operations)==null?void 0:o[t+":"+a]}function Lf(e){return["working","pending","queued"].includes(e==null?void 0:e.phase)}function hD(e,t){if(!t)return null;const a=mD(e,t.action,t.id);return(a==null?void 0:a.commandId)===t.commandId?a:null}function fD({state:e,session:t,act:a,navigate:r}){var j,ie,Ee,me,_e,Je,De,ue,ye,M,Y,se,Fe,je;const o=v.useContext(Kr),i=e.setup||{},s=(i.providers||[]).filter(oe=>oe.enabled!==!1),l=new Map(Qw(s.map(oe=>({...oe,info:{id:oe.module,display_name:Ac(oe.module).name}}))).map(oe=>[oe.id,oe.label])),c=((j=e.view)==null?void 0:j.aiConnectionEditor)||{},u=c.step||"list",d=Ac(c.module),p=s.find(oe=>oe.id===c.id),m=Or(c.authMode||((ie=p==null?void 0:p.config)==null?void 0:ie.auth_mode)),h={id:c.id,authMode:m,scope:c.scope||"global"},[f,g]=v.useState(""),[E,y]=v.useState(""),[b,S]=v.useState(""),[w,N]=v.useState(null),x=v.useRef(!1),A=v.useRef(t==null?void 0:t.workspace),C=v.useRef(0),O=v.useRef(!0),k=oe=>a("view.update",{patch:{aiConnectionEditor:{...c,...oe}}});v.useEffect(()=>(O.current=!0,()=>{O.current=!1,C.current++}),[]),v.useEffect(()=>{A.current!==(t==null?void 0:t.workspace)&&(C.current++,A.current=t==null?void 0:t.workspace,g(""),N(null),x.current=!1,k({step:"list",id:"",model:""})),a("providers.list",t?{sessionId:t.id}:{}),a("routing.list")},[t==null?void 0:t.workspace]);async function T(oe,Ze={},it=""){if(x.current)return;x.current=!0;const zt=++C.current;y(""),S(""),N({action:oe,id:Ze.id||Ze.module||"",commandId:null,next:it});try{const ct=await a(oe,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(oe)?{sessionId:t.id}:{},...Ze});if(!O.current||zt!==C.current)return;if(!(ct!=null&&ct.accepted)||!ct.operationId)throw Error((ct==null?void 0:ct.error)||"The request could not be confirmed. Please try again.");N({action:oe,id:Ze.id||Ze.module||"",commandId:ct.operationId,next:it})}catch(ct){O.current&&zt===C.current&&(y(ct.message),N(null),x.current=!1)}}const I=hD(e,w),F=!!w;v.useEffect(()=>{var it;if(!I||Lf(I))return;const oe=w.next,Ze=w.action;if(N(null),x.current=!1,I.phase==="error"){y(I.error||"The request did not finish. Your choices are kept.");return}I.phase==="ready"&&(Ze==="providers.save"?(g(""),k({saved:!0,...oe==="models"?{step:"model"}:{}}),oe==="signin"?T("providers.login",h):oe==="models"&&T("providers.models",{id:c.id})):Ze==="providers.remove"?(g(""),k({step:"list",id:"",saved:!1}),S("Connection removed. Chats that used it will need a replacement connection when resumed.")):Ze==="providers.finishSetup"?(k({step:"list",saved:!1}),S((it=i.setupCompletion)!=null&&it.routingSelected?"Connection saved. Balanced model rules are ready for new conversations.":"Model saved. Existing model rules are unchanged.")):Ze==="providers.models"&&S("Model list checked. No chat request was sent."))},[I==null?void 0:I.commandId,I==null?void 0:I.phase]);const z=((Ee=i.login)==null?void 0:Ee.providerId)===c.id?i.login:null;v.useEffect(()=>{var oe;o.active&&u==="connect"&&c.saved&&(z==null?void 0:z.status)==="completed"&&(z.authMode!=="chatgpt_plan"||(oe=z.account)!=null&&oe.planEnabled)&&z.loginId!==c.previousLoginId&&!F&&(k({step:"model"}),T("providers.models",{id:c.id}))},[u,c.saved,z==null?void 0:z.status,z==null?void 0:z.loginId,F,o.active]);const q=(me=i.providerCatalogs)==null?void 0:me[c.id],W=zl((q==null?void 0:q.models)||((_e=i.modelCatalogs)==null?void 0:_e[c.id])||[]),X=Lf((Je=i.operations)==null?void 0:Je["providers.models:"+c.id])||(q==null?void 0:q.phase)==="working",U=((De=i.credentialCheck)==null?void 0:De.module)===c.module?i.credentialCheck:null,_=c.credentialMode==="auto"?U!=null&&U.githubCliAvailable?"github-cli":U!=null&&U.available?"environment":"private":c.credentialMode||"private",P=oe=>{Ac(oe).auth!=="signin"&&T("providers.credentials",{module:oe})},G=oe=>{x.current||(g(""),y(""),S(""),k({step:"connect",module:oe.module,id:oe.module.replace("provider-","")+"-"+crypto.randomUUID().slice(0,8),model:"",baseUrl:"",previousLoginId:null,scope:"global",authMode:"chatgpt_codex",saved:!1,credentialMode:"auto",initializeRouting:s.length===0}),P(oe.module))},Z=()=>{var oe;return T("providers.save",{id:c.id,module:c.module,config:{...p==null?void 0:p.config,...d.auth==="optional-key"?{base_url:(oe=c.baseUrl)==null?void 0:oe.trim()}:{}},scope:c.scope||"global",...d.auth==="signin"?{}:_==="environment"?{apiKeyEnv:U==null?void 0:U.envVar}:_==="github-cli"?{useGitHubCli:!0}:{apiKey:f}},d.auth==="signin"?"signin":"models")},D=()=>{y(""),k({step:u==="services"||u==="detail"?"list":u==="model"?"detail":"services"})},ne=()=>r("providers"),H=!!f||u==="connect"&&!!c.baseUrl&&c.baseUrl!==(((ue=p==null?void 0:p.config)==null?void 0:ue.base_url)||"")||u==="model"&&!!c.model&&c.model!==(((ye=p==null?void 0:p.config)==null?void 0:ye.default_model)||((M=p==null?void 0:p.config)==null?void 0:M.model)||"");return Gw("ai-connections",{label:"AI connection setup",dirty:H,review:()=>{r("ai-connections"),k({step:u})},discard:()=>{g(""),y(""),k({step:"list",id:"",module:"",model:"",baseUrl:"",saved:!1})}}),n.createElement("section",{"data-part":"ai-connections",className:"a-ai-form"},u==="list"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Connect the AI services Amplifier can use for your work."),s.length?n.createElement(n.Fragment,null,n.createElement("div",{className:"a-everyday-list"},s.map(oe=>{var Ze,it,zt,ct;return n.createElement(gr,{key:oe.id,disabled:F,title:l.get(oe.id),description:(((Ze=oe.config)==null?void 0:Ze.default_model)||((it=oe.config)==null?void 0:it.model)||"Choose a model")+" · "+(oe.accountConnected?"Account connected":oe.credentialsConfigured?"Credentials available":oe.keySource==="provider-managed"?"Account sign-in":"Connection needs setup")+((ct=(zt=oe.credential)==null?void 0:zt.preview)!=null&&ct.masked?" · Key "+oe.credential.preview.masked:""),onClick:()=>{var qt,le,fe,xe,ze;y(""),S(""),k({step:"detail",id:oe.id,module:oe.module,authMode:Or((qt=oe.config)==null?void 0:qt.auth_mode),model:((le=oe.config)==null?void 0:le.default_model)||((fe=oe.config)==null?void 0:fe.model)||"",scope:"global",baseUrl:((xe=oe.config)==null?void 0:xe.base_url)||"",previousLoginId:(ze=i.login)==null?void 0:ze.loginId,saved:!0,initializeRouting:!1})}})})),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect another service")):n.createElement("div",{className:"a-ai-welcome"},n.createElement(hx,{"aria-hidden":"true"}),n.createElement("h4",null,"Start with one connection"),n.createElement("p",null,"Choose a service, connect your account, and choose a model. You can add more later."),n.createElement("button",{className:"a-primary","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect AI")),i.active&&s.length>0&&n.createElement("div",{className:"a-ai-hint"},"Your model rules are saved. ",n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>r("routing")},"Advanced model rules")),n.createElement("div",{className:"a-everyday-footer"},n.createElement("p",{className:"a-caption"},"Connections are stored on the Amplifier host. Existing conversations keep their settings."),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Advanced connection settings",n.createElement(sa,null)))):n.createElement(n.Fragment,null,n.createElement("button",{className:"a-link","data-action":"view.update",disabled:F,onClick:D},n.createElement(Sa,null),"Back"),u==="services"?n.createElement(n.Fragment,null,n.createElement("h4",null,"Which service would you like to use?"),n.createElement("div",{className:"a-everyday-list"},kp.map(oe=>n.createElement(gr,{key:oe.module,disabled:F,title:oe.name,description:oe.description,onClick:()=>G(oe)}))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Other provider or custom endpoint")):n.createElement(n.Fragment,null,n.createElement("p",{className:"a-ai-step"},u==="connect"?"1 · Connect":u==="model"?"2 · Choose a model":"Saved connection"),n.createElement("h4",null,l.get(c.id)||d.name),u==="detail"?n.createElement(n.Fragment,null,d.auth==="signin"&&n.createElement(Ep,{account:p==null?void 0:p.account}),n.createElement("p",null,p!=null&&p.accountConnected?"Your ChatGPT account is connected.":p!=null&&p.credentialsConfigured?"This connection has credentials available on the Amplifier host.":"This connection needs credentials before it can be used."),n.createElement("p",null,"Model: ",n.createElement("strong",null,((Y=p==null?void 0:p.config)==null?void 0:Y.default_model)||((se=p==null?void 0:p.config)==null?void 0:se.model)||"Not selected")),n.createElement(Tu,{credential:p==null?void 0:p.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:F,onClick:()=>T("providers.list")},n.createElement(Mt,null),"Refresh credentials"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"providers.models",disabled:F,onClick:()=>{k({step:"model"}),T("providers.models",{id:c.id})}},"Choose model"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>{k({step:"connect",previousLoginId:z==null?void 0:z.loginId,credentialMode:"private"}),P(c.module)}},d.auth==="signin"?p!=null&&p.accountConnected?"Reconnect account":"Sign in":"Change credentials"),n.createElement("button",{className:"a-soft","data-action":"providers.test",disabled:F,onClick:()=>T("providers.test",{id:c.id})},"Check connection")),n.createElement("p",{className:"a-caption"},"Checking verifies the model catalog, without sending a chat request."),n.createElement(Zw,{key:c.id,state:e,id:c.id,sessionId:t==null?void 0:t.id,act:a,disabled:F}),n.createElement("div",{className:"a-dialog-actions a-connection-secondary-actions"},n.createElement("button",{className:"a-soft a-danger","data-action":"providers.remove",disabled:F,onClick:()=>T("providers.remove",{id:c.id,scope:c.scope||"global"})},n.createElement(ea,null),"Remove connection"),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full connection settings"))):u==="connect"?n.createElement(n.Fragment,null,d.auth==="signin"?n.createElement(n.Fragment,null,z&&z.loginId!==c.previousLoginId?n.createElement(Au,{login:z,busy:F,onCancel:()=>T("providers.loginCancel",{id:c.id}),onRetry:()=>T("providers.login",h),onEnablePlan:()=>T("providers.login",{...h,enablePlan:!0})}):n.createElement(n.Fragment,null,n.createElement(Kw,{mode:m,onChange:oe=>k({authMode:oe}),disabled:F}),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":p?"providers.login":"providers.save",disabled:F,onClick:()=>p?T("providers.login",h):Z()},F?"Getting ready…":m==="chatgpt_plan"?"Continue with ChatGPT":"Get sign-in code")))):n.createElement(n.Fragment,null,d.auth==="optional-key"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-base-url"},"API base URL"),n.createElement("input",{id:"ai-base-url",type:"url",placeholder:"http://localhost:1234/v1",value:c.baseUrl||"",disabled:F,onChange:oe=>k({baseUrl:oe.target.value})}),n.createElement("p",{className:"a-caption"},"Use an address reachable from the computer running Amplifier. Include /v1 if your service requires it.")),((U==null?void 0:U.available)||(U==null?void 0:U.githubCliAvailable))&&n.createElement("fieldset",{className:"a-credential-options"},n.createElement("legend",null,"How would you like to connect?"),U.available&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="environment",onChange:()=>{g(""),k({credentialMode:"environment"})}}),n.createElement("span",null,n.createElement("strong",null,"Use the key already on this host"),n.createElement("small",null,"Found ",U.envVar,". Only its name is saved; the key stays in the environment."))),U.githubCliAvailable&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="github-cli",onChange:()=>{g(""),k({credentialMode:"github-cli"})}}),n.createElement("span",null,n.createElement("strong",null,"Use GitHub CLI sign-in"),n.createElement("small",null,"Use the host’s signed-in GitHub account. Its token is saved privately for this connection."))),n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="private",onChange:()=>k({credentialMode:"private"})}),n.createElement("span",null,n.createElement("strong",null,"Use a different key"),n.createElement("small",null,"Connect another account or enter a key yourself.")))),_==="environment"&&n.createElement(Tu,{credential:U}),_==="private"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-private-key"},d.auth==="token"?"GitHub token":d.auth==="optional-key"?"API key (optional)":"API key"),n.createElement("input",{id:"ai-private-key",type:"password",autoComplete:"off",spellCheck:!1,value:f,onChange:oe=>g(oe.target.value),disabled:F}),n.createElement("p",{className:"a-caption"},d.auth==="optional-key"?"Leave blank if your local service does not need a key.":"Stored privately for this connection. Other accounts keep their own keys.")),d.auth==="token"&&!(U!=null&&U.githubCliAvailable)&&!(U!=null&&U.available)&&n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Help connecting GitHub Copilot"),n.createElement("div",null,n.createElement("p",null,"Sign in to GitHub CLI on the computer running Amplifier, then check again. Or use a GitHub token for an account with Copilot access."),n.createElement("a",{href:"https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli",target:"_blank",rel:"noreferrer"},"GitHub setup guide"),n.createElement("button",{className:"a-link",disabled:F,onClick:()=>P(c.module)},"Check host sign-in again"))),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"providers.save",disabled:F||d.auth==="optional-key"&&!/^https?:\/\/[^\s]+$/.test(c.baseUrl||"")||(_==="environment"?!(U!=null&&U.available):_==="github-cli"?!(U!=null&&U.githubCliAvailable):d.auth!=="optional-key"&&!f.trim()),onClick:Z},F?"Connecting…":"Save and check connection")))):u==="model"?n.createElement(n.Fragment,null,(z==null?void 0:z.status)==="completed"&&n.createElement(Au,{login:z,chooseModel:!0,welcomeDismissed:c.welcomedLoginId===z.loginId,onWelcomeDismiss:()=>k({welcomedLoginId:z.loginId})}),n.createElement("p",null,"Choose from the models available through this connection."),W.length>0?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model"},"Model"),n.createElement(wp,{id:"ai-model",label:"Model",value:c.model||"",catalogKey:c.id,entry:{...q,models:W,phase:"ready"},state:e,act:a,onChange:oe=>k({model:oe})})):n.createElement("p",{role:"status"},X?"Loading models…":"No model list is available yet. Retry or enter a model ID under More options."),X&&W.length>0&&n.createElement("p",{className:"a-caption",role:"status"},"Refreshing in the background. Saved models remain available."),(q==null?void 0:q.phase)==="error"&&n.createElement(nt,{phase:"error",message:q.error||"Could not refresh the model list. Saved choices are kept."}),n.createElement("button",{className:"a-link","data-action":"providers.models",disabled:F||X,onClick:()=>T("providers.models",{id:c.id,refresh:!0})},n.createElement(Mt,null),"Refresh models"),n.createElement("div",{className:"a-ai-hint"},c.initializeRouting?"Balanced model rules choose suitable models for each task. This connection’s default is used when no rule applies.":"This changes the connection’s default model. Existing model rules may choose a different model."),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:F||!((Fe=c.model)!=null&&Fe.trim()),"data-action":"providers.finishSetup",onClick:()=>T("providers.finishSetup",{id:c.id,model:c.model,scope:c.scope||"global",initializeRouting:!!c.initializeRouting})},F?"Saving…":"Finish setup"))):null,n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"More options"),n.createElement("div",null,n.createElement("label",{htmlFor:"ai-scope"},"Save for"),n.createElement("select",{id:"ai-scope",value:c.scope||"global",disabled:F,"data-action":"view.update",onChange:oe=>k({scope:oe.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"local"},"This workspace on this host"),n.createElement("option",{value:"project"},"This project (shareable configuration)")),u==="model"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model-manual"},"Model ID"),n.createElement("input",{id:"ai-model-manual",value:c.model||"",disabled:F,"data-action":"view.update",onChange:oe=>k({model:oe.target.value})})),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full provider configuration"))))),E&&n.createElement(nt,{phase:"error",message:E}),b&&n.createElement(nt,{phase:"ready",message:b}),F&&n.createElement(nt,{phase:"working",message:"Working on this connection…"}),!F&&((je=i.test)==null?void 0:je.providerId)===c.id&&u==="detail"&&n.createElement(nt,{phase:i.test.reachable===!1?"error":"ready",message:i.test.reachable===!1?"Connection check failed.":"Model catalog check passed."}))}function Va({id:e,label:t,description:a,selected:r,onSelect:o,checked:i,onCheck:s,disabled:l,badge:c,checkLabel:u,checkAction:d="view.update"}){return n.createElement("div",{className:"a-collection-row"+(r?" selected":""),"data-collection-id":e},s&&n.createElement("label",{className:"a-collection-check"},n.createElement("input",{type:"checkbox","aria-label":u||"Select "+t,checked:!!i,disabled:l,"data-action":d,onChange:p=>s(p.target.checked)})),n.createElement("button",{type:"button","aria-current":r?"true":void 0,"data-action":"view.update",onClick:o},n.createElement("span",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a)),c&&n.createElement("small",{className:"a-collection-badge"},c),n.createElement(en,{"aria-hidden":"true"})))}function Co({list:e,children:t,detailOpen:a=!0,onBack:r,label:o="items"}){const i=v.useRef(null),s=v.useRef(null),l=v.useContext(Kr);v.useEffect(()=>{var u;a&&l.compact&&((u=s.current)==null||u.focus({preventScroll:!0}))},[a,l.compact]);const c=()=>{r==null||r(),requestAnimationFrame(()=>{var u,d;return(d=(u=i.current)==null?void 0:u.querySelector("button[aria-current=true],button"))==null?void 0:d.focus({preventScroll:!0})})};return n.createElement("div",{className:"a-collection"+(a?" detail-open":"")},n.createElement("div",{className:"a-collection-list",ref:i},e),n.createElement("div",{className:"a-collection-detail",ref:s,tabIndex:-1},r&&!l.compact&&n.createElement("button",{type:"button",className:"a-link a-collection-back","data-action":"view.update",onClick:c},n.createElement(Sa,null),"Back to ",o),t))}function xp({title:e,description:t,items:a,ids:r,onChange:o,onSave:i,onCancel:s,busy:l=!1,error:c,notice:u,action:d="view.update"}){const[p,m]=v.useState(!1);return n.createElement("section",{className:"a-order-editor"},n.createElement("h4",null,e),u&&n.createElement("p",{role:"status"},u),n.createElement("p",null,t),n.createElement("p",{className:"a-caption"},"Drag the handle or choose a position. Changes apply when you save."),n.createElement(kg,{items:a,ids:r,onChange:o,onDraggingChange:m,busy:l,className:"a-order-list",rowClassName:"a-order-item",floatingClassName:"a-order-item",savedHint:"Save order to apply.",renderItem:(h,{handle:f,index:g,move:E})=>n.createElement(n.Fragment,null,f,n.createElement("span",{className:"a-order-copy"},n.createElement("strong",null,h.label),n.createElement("small",null,h.description)),n.createElement("span",{className:"a-order-arrows"},n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===0,"aria-label":"Move "+h.label+" up","data-action":"view.update",onClick:()=>E(g-1)},n.createElement(Li,null)),n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===r.length-1,"aria-label":"Move "+h.label+" down","data-action":"view.update",onClick:()=>E(g+1)},n.createElement(sg,null))),n.createElement("select",{"aria-label":"Position of "+h.label,value:g,disabled:l,"data-action":"view.update",onChange:y=>E(Number(y.target.value))},r.map((y,b)=>n.createElement("option",{key:b,value:b},b+1))))}),c&&n.createElement("p",{role:"alert",className:"a-danger"},c),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:l||p,"data-action":d,onClick:i},l?"Saving order…":"Save order"),n.createElement("button",{type:"button",className:"a-soft",disabled:l,"data-action":"view.update",onClick:s},"Cancel")))}const cr=e=>JSON.stringify(e,null,2),ms=e=>["queued","working","pending","running"].includes(e==null?void 0:e.phase);function gD({state:e,act:t}){var _,P,G,Z,D,ne,H,j,ie,Ee,me,_e,Je,De,ue,ye;v.useContext(Kr);const a=(_=e.view)==null?void 0:_.routingEditor,[r,o]=v.useState({name:"my-routing",scope:"global",matrix:null,newRole:"",...a}),i=v.useRef(r),[s,l]=v.useState({});v.useEffect(()=>{a&&(i.current=a,o(a))},[a]);const c=M=>{const Y={...i.current,...M};i.current=Y,o(Y),t("view.update",{patch:{routingEditor:Y}})},u=e.setup||{},d=u.providers||[],p=u.matrices||[],[m,h]=xa(e,t,"routing-profiles",p,M=>[M.name,M.description,M.source],"Filter routing profiles"),f=M=>{var Y;return s[M]||((Y=e.actionStatus)==null?void 0:Y[M])},g=async(M,Y={})=>{l(se=>({...se,[M]:{phase:"pending"}}));try{const se=await t(M,Y);return l(Fe=>({...Fe,[M]:se?null:{phase:"error",error:"Request could not be sent. Try again."}})),se}catch(se){l(Fe=>({...Fe,[M]:{phase:"error",error:se.message}}))}};v.useEffect(()=>{g("routing.list"),i.current.requested&&g("routing.show",{name:i.current.requested})},[]);const E=()=>({...r.profiles,...r.matrix?{[r.profileKey||r.name]:{matrix:r.matrix,name:r.name,role:r.role,candidate:r.candidate,rawText:r.rawText,raw:r.raw}}:{}}),y=M=>{const Y=E(),se=Y[M];se?c({...se,profileKey:M,requested:null,profiles:Y,order:null,error:"",detailOpen:!1,candidateOpen:!1}):(c({profileKey:M,requested:M,profiles:Y,order:null,error:""}),g("routing.show",{name:M}))};v.useEffect(()=>{if(u.matrix&&u.matrix.name===i.current.requested){const M=u.matrix;c({matrix:M,name:M.name,profileKey:M.name,requested:null,rawText:cr(M),raw:!1,role:Object.keys(M.roles||{})[0],candidate:0,detailOpen:!1,candidateOpen:!1,error:""})}},[u.matrix,r.requested]),v.useEffect(()=>{!i.current.matrix&&!i.current.requested&&p.length&&y(u.active||p[0].name)},[p]);const b=r.matrix||Mf(r.name),S=Object.entries(b.roles||{}),w=(P=b.roles)!=null&&P[r.role]?r.role:(G=S[0])==null?void 0:G[0],N=(Z=b.roles)==null?void 0:Z[w],x=(N==null?void 0:N.candidates)||[],A=Math.min(r.candidate||0,Math.max(0,x.length-1)),C=x[A],[O,k]=xa(e,t,"routing-roles",S,([M,Y])=>[M,Y.description,...(Y.candidates||[]).flatMap(se=>[se.provider,se.model])],"Filter task roles");v.useEffect(()=>{r.order&&r.orderOpen!==!1&&!Iu(x,w,r.order)&&c({order:Tc(x,w,r.order)})},[r.order,r.orderOpen,w,x]);const T=M=>c({matrix:M,rawText:cr(M),error:""}),I=M=>T(oD(b,w,A,M)),F=C?d.filter(M=>M.id===C.provider||M.module==="provider-"+C.provider||M.module===C.provider):[],z=F.find(M=>M.id===(C==null?void 0:C.provider)),q=z?[z]:F,W=[...new Map(q.flatMap(M=>{var Y;return(((Y=u.modelCatalogs)==null?void 0:Y[M.id])||[]).map(se=>[typeof se=="string"?se:se.id,se])}).filter(([M])=>M)).values()],X=z?(D=u.providerCatalogs)==null?void 0:D[z.id]:void 0;v.useEffect(()=>{var Y,se;const M=(Y=e.actionStatus)==null?void 0:Y["routing.save"];(M==null?void 0:M.phase)==="ready"&&((se=M.target)==null?void 0:se.name)===i.current.name&&c({profileKey:i.current.name})},[(H=(ne=e.actionStatus)==null?void 0:ne["routing.save"])==null?void 0:H.updatedAt]);const U=ms(f("routing.save"))||ms(f("routing.use"));return n.createElement("section",{className:"a-settings-section","data-part":"routing-settings","data-candidate-open":!!r.candidateOpen},n.createElement("div",{className:"a-settings-row"},n.createElement("p",null,"Choose models for each role. Routing uses the first resolvable choice."),n.createElement("button",{className:"a-icon","aria-label":"Refresh routing profiles","data-action":"routing.list",disabled:ms(f("routing.list")),onClick:()=>g("routing.list")},n.createElement(Mt,null))),u.routingCatalogError&&n.createElement(nt,{phase:"error",message:u.routingCatalogError}),n.createElement("div",{className:"a-routing-profile-picker"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-profile"},"Routing profile"),n.createElement("select",{id:"routing-profile",value:r.profileKey||"","data-action":"routing.show",onChange:M=>y(M.target.value)},n.createElement("option",{value:"",disabled:!0},"Choose a profile"),m.map(M=>n.createElement("option",{key:M.name,value:M.name},M.name,M.active||u.active===M.name?" · active":"")),r.profileKey&&!m.some(M=>M.name===r.profileKey)&&n.createElement("option",{value:r.profileKey},r.name," · draft"))),n.createElement("button",{className:"a-soft",disabled:!p.some(M=>M.name===r.profileKey)||u.active===r.profileKey||U||!!r.requested,"data-action":"routing.use",onClick:()=>g("routing.use",{name:r.profileKey,scope:r.scope})},"Use profile"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{const M=Mf();c({profiles:E(),matrix:M,name:M.name,profileKey:"new:"+Date.now(),requested:null,role:"general",candidate:0,rawText:cr(M),order:null,detailOpen:!1,candidateOpen:!1})}},n.createElement(Ln,null),"New profile")),r.requested&&n.createElement(nt,{phase:((j=f("routing.show"))==null?void 0:j.phase)==="error"?"error":"working",message:((ie=f("routing.show"))==null?void 0:ie.error)||"Opening "+r.requested+"…"}),r.requested&&((Ee=f("routing.show"))==null?void 0:Ee.phase)==="error"&&n.createElement("button",{className:"a-soft","data-action":"routing.show",onClick:()=>g("routing.show",{name:r.requested})},"Retry opening profile"),["routing.list","routing.use"].map(M=>{var Y;return((Y=f(M))==null?void 0:Y.phase)==="error"&&n.createElement(nt,{key:M,phase:"error",message:f(M).error})}),r.matrix&&n.createElement(n.Fragment,null,n.createElement("details",{className:"a-routing-profile-options",open:!!r.profileDetails},n.createElement("summary",{"data-action":"view.update",onClick:M=>{M.preventDefault(),c({profileDetails:!r.profileDetails})}},"Profile settings"),h,n.createElement("p",{className:"a-caption"},(me=p.find(M=>M.name===r.profileKey))==null?void 0:me.description),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-name"},"Custom profile name"),n.createElement("input",{id:"routing-name",value:r.name,"data-action":"view.update",onChange:M=>c({name:M.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"routing-scope"},"Save for"),n.createElement("select",{id:"routing-scope",value:r.scope,"data-action":"view.update",onChange:M=>c({scope:M.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace"))))),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:w+" preference order",notice:r.order.notice,description:"Place your preferred choice first. Routing selects the first resolvable match; this is not a retry chain for failed API calls.",items:x.map((M,Y)=>({id:String(Y),label:M.model||"Choose a model",description:M.provider||"Choose a provider"})),ids:r.order.ids,onChange:M=>c({order:{...r.order,ids:M}}),onCancel:()=>c({order:null}),onSave:()=>{if(!Iu(x,w,r.order)){c({order:Tc(x,w,r.order)});return}const M=Pr(b,w,{candidates:r.order.ids.map(Y=>x[Number(Y)])});c({order:null,matrix:M,rawText:cr(M),candidate:0})}}):n.createElement(Co,{label:"roles",detailOpen:!!r.detailOpen,onBack:()=>c({detailOpen:!1,candidateOpen:!1}),list:n.createElement(n.Fragment,null,k,O.map(([M,Y])=>{var se;return n.createElement(Va,{key:M,id:M,label:M,description:Y.description||`${((se=Y.candidates)==null?void 0:se.length)||0} choices`,selected:M===w,onSelect:()=>c({role:M,candidate:0,detailOpen:!0,candidateOpen:!1,candidateRaw:!1})})}))},N&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,w),n.createElement("button",{className:"a-icon a-danger","aria-label":"Remove role "+w,disabled:["general","fast"].includes(w),"data-action":"view.update",onClick:()=>{const M={...b,roles:{...b.roles}};delete M.roles[w],T(M)}},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-description"},"Role description"),n.createElement("input",{id:"routing-description","aria-label":w+" description",value:N.description||"",placeholder:"Describe this role","data-action":"view.update",onChange:M=>T(Pr(b,w,{description:M.target.value}))}),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,x.length," ordered choices"),n.createElement("button",{className:"a-soft",disabled:x.length<2,"data-action":"view.update",onClick:()=>c({orderOpen:!0,order:Tc(x,w,r.order)})},"Preference order")),n.createElement("div",{className:"a-routing-candidates"},x.map((M,Y)=>n.createElement(Va,{key:Y,id:String(Y),label:`${Y+1}. ${M.model||"Choose a model"}`,description:M.provider||"Choose a provider",selected:Y===A,onSelect:()=>c({candidate:Y,candidateOpen:!0,candidateRaw:!1})}))),C&&n.createElement("div",{className:"a-routing-selected"},n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,"Choice ",A+1),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove ${w} candidate ${A+1}`,"data-action":"view.update",onClick:()=>T(Pr(b,w,{candidates:x.filter((M,Y)=>Y!==A)}))},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-candidate-provider"},"Provider or connection name"),n.createElement("input",{id:"routing-candidate-provider","aria-label":`${w} provider ${A+1}`,list:"routing-provider-options",value:C.provider||"",placeholder:"For example, anthropic or opus","data-action":"view.update",onChange:M=>I({provider:M.target.value})}),n.createElement("datalist",{id:"routing-provider-options"},[...new Set(d.flatMap(M=>[M.id,M.module.replace(/^provider-/,"")]))].map(M=>n.createElement("option",{key:M,value:M}))),n.createElement("p",{className:"a-caption"},"Use a provider family for a portable profile, or a connection name for a specific account and configuration."),n.createElement("label",{htmlFor:`routing-${w}-${A}`},"Model ID or pattern"),n.createElement(wp,{editable:!0,catalogKey:C.provider,id:`routing-${w}-${A}`,label:`${w} model ${A+1}`,value:C.model||"",entry:X,models:W,state:e,act:t,placeholder:"Model ID or pattern, e.g. claude-sonnet-*",onChange:M=>I({model:M})}),n.createElement("p",{className:"a-caption"},"Patterns are resolved by the routing module. Model lists are suggestions and do not limit what you can enter.",q.length>0?" Suggestions from "+q.map(M=>M.id).join(", ")+".":""),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":!!r.candidateRaw,onClick:()=>c({candidateRaw:!r.candidateRaw,candidateText:cr(C)})},"Edit choice configuration"),r.candidateRaw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Choice configuration JSON",className:"a-json-editor",value:r.candidateText,"data-action":"view.update",onChange:M=>c({candidateText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.candidateText);if(!M.provider||!M.model)throw new Error("Include a provider and model.");const Y=[...x];Y[A]=M,T(Pr(b,w,{candidates:Y}))}catch(M){c({error:M.message})}}},"Apply choice configuration"))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>{const M=Pr(b,w,{candidates:[...x,{provider:"",model:""}]});c({matrix:M,rawText:cr(M),candidate:x.length,candidateOpen:!0,candidateRaw:!1})}},n.createElement(Ln,null),"Add fallback model"))),n.createElement("div",{className:"a-routing-add"},n.createElement("input",{"aria-label":"New routing role",list:"routing-role-options",value:r.newRole||"",placeholder:"Add a role","data-action":"view.update",onChange:M=>c({newRole:M.target.value})}),n.createElement("datalist",{id:"routing-role-options"},(u.roles||[]).map(M=>n.createElement("option",{value:M,key:M}))),n.createElement("button",{className:"a-soft",disabled:!((_e=r.newRole)!=null&&_e.trim())||!!((Je=b.roles)!=null&&Je[r.newRole.trim()]),"data-action":"view.update",onClick:()=>{const M=r.newRole.trim(),Y=Pr(b,M,{description:"",candidates:[{provider:"",model:""}]});c({matrix:Y,rawText:cr(Y),newRole:"",role:M,candidate:0,detailOpen:!0,candidateOpen:!0})}},n.createElement(Ln,null),"Add role")),n.createElement("div",{className:"a-routing-advanced"},n.createElement("button",{className:"a-link","aria-expanded":!!r.raw,"data-action":"view.update",onClick:()=>c({raw:!r.raw,rawText:cr(b)})},r.raw?"Hide":"Show"," full profile JSON"),r.raw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Routing matrix JSON",className:"a-json-editor",spellCheck:!1,value:r.rawText,"data-action":"view.update",onChange:M=>c({rawText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.rawText);if(!M.roles||typeof M.roles!="object"||Array.isArray(M.roles))throw new Error("A profile needs a roles object.");T(M)}catch(M){c({error:M.message})}}},"Update draft from JSON"))),r.error&&n.createElement("p",{className:"a-danger",role:"alert"},r.error),n.createElement(Rn,{active:!r.order||r.orderOpen===!1},n.createElement("button",{className:"a-primary",disabled:U||!!r.requested||!!r.order&&r.orderOpen!==!1||!r.name.trim()||!S.length||S.some(([,M])=>{var Y;return!((Y=M.candidates)!=null&&Y.length)||M.candidates.some(se=>!se.provider||!se.model)}),"data-action":"routing.save",onClick:()=>g("routing.save",{name:r.name.trim(),matrix:{...b,name:r.name.trim()},scope:r.scope,activate:!0})},n.createElement($c,null),u.active===r.name?"Save active profile":"Save and use profile")),n.createElement("p",{className:"a-caption"},"General and fast roles are required. Saving applies to future conversation preparation."),n.createElement(nt,{phase:(De=f("routing.save"))==null?void 0:De.phase,message:((ue=f("routing.save"))==null?void 0:ue.error)||(ms(f("routing.save"))?"Saving routing profile…":((ye=f("routing.save"))==null?void 0:ye.phase)==="ready"?"Routing profile saved and selected.":"")})))}const ni=e=>JSON.stringify(e,null,2);function vD(e,t,a,r){var c;const o=(c=e.view)==null?void 0:c[t],[i,s]=v.useState({...a,...o});return v.useEffect(()=>{o&&s(u=>({...u,...o}))},[o]),[i,u=>{const d={...i,...u};s(d),r("view.update",{patch:{[t]:d}})}]}function bD({state:e,session:t,act:a,navigate:r=()=>{}}){var oe,Ze,it,zt,ct,qt,le,fe,xe,ze,Ye,ht,bt,ft,Ce,gt,Et,vt,at;const[o,i]=vD(e,"providerEditor",{id:"",module:"",source:"",config:"{}",scope:"global",model:"",effort:"",advanced:!1,credentialMode:(Ze=(oe=e.view)==null?void 0:oe.providerEditor)!=null&&Ze.id?"private":"environment",envVar:""},a),s=ee=>i({dirty:!0,...ee}),l=v.useRef({}),c=v.useRef(!1),[u,d]=v.useState(""),[p,m]=v.useState(o.config);v.useEffect(()=>{var ee;m(c.current?((ee=l.current[o.selectionKey??o.id])==null?void 0:ee.configText)??o.config:o.config),c.current=!1},[o.config,o.selectionKey]);const h=e.setup||{},f=(h.providers||[]).filter(ee=>ee.enabled!==!1),g=f.find(ee=>ee.id===o.id),E=v.useRef(Date.now()/1e3),y=v.useRef(!1),[b,S]=v.useState({}),w=(ee,Re=o.id)=>{var et;const ae=ee+":"+Re,Le=(et=h.operations)==null?void 0:et[ae],Oe=b[ae];return Oe&&(!Le||Le.commandId!==Oe.commandId)?Oe:Le},N=ee=>["queued","working","pending"].includes(ee==null?void 0:ee.phase),x=async(ee,Re={})=>{const ae=ee+":"+(["providers.credentials","providers.schema"].includes(ee)?Re.module:Re.id||""),Le={phase:"pending",commandId:"local-"+Date.now(),envVar:Re.envVar||""};S(Oe=>({...Oe,[ae]:Le}));try{const Oe=await a(ee,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(ee)?{sessionId:t.id}:{},...Re});return S(et=>({...et,[ae]:Oe?null:{phase:"error",error:"The request could not be sent. Please retry."}})),Oe}catch(Oe){S(et=>({...et,[ae]:{phase:"error",error:Oe.message}}))}};v.useEffect(()=>{y.current=!1,E.current=h.providersLoadedAt||Date.now()/1e3,x("providers.list")},[t==null?void 0:t.workspace]);const A=((it=h.credentialCheck)==null?void 0:it.module)===o.module&&(o.envVar?h.credentialCheck.envVar===o.envVar:!h.credentialCheck.requestedEnvVar)?h.credentialCheck:null,C=A||((g==null?void 0:g.module)===o.module?g.credential:null),O=o.envVar||(C==null?void 0:C.envVar)||"",k=w("providers.credentials",o.module),T=k&&k.envVar===(o.envVar||"")?k:null,I=w("providers.models"),F=w("providers.schema",o.module),z=w("providers.test"),q=w("providers.list",""),W=o.credentialMode||"environment",X=o.module!=="provider-openai-chatgpt";v.useEffect(()=>{if(!o.module||W!=="environment"||!X)return;const ee=setTimeout(()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}}),250);return()=>clearTimeout(ee)},[o.module,o.envVar,W]);const U=["providers.save","providers.remove","providers.login","providers.move","providers.reorder"].some(ee=>N(w(ee))),_=((ct=(zt=h.providerCatalogs)==null?void 0:zt[o.id])==null?void 0:ct.metadata)||((qt=h.metadata)==null?void 0:qt[o.module])||(((le=h.providerMetadata)==null?void 0:le.module)===o.module?h.providerMetadata:null);v.useEffect(()=>{if(!/^provider-[A-Za-z0-9_.-]+$/.test(o.module)||_)return;const ee=setTimeout(()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}}),250);return()=>clearTimeout(ee)},[o.module,t==null?void 0:t.workspace]);const P=zl(((fe=h.modelCatalogs)==null?void 0:fe[o.id])||((h.modelsProviderId||h.providerId)===o.id?h.models:[])),G=((xe=h.login)==null?void 0:xe.providerId)===o.id?h.login:null,Z=(G==null?void 0:G.status)||(G==null?void 0:G.phase),D=Jw(G==null?void 0:G.url);let ne,H="";try{ne=tr(p)}catch(ee){H=ee.message}const[j,ie]=xa(e,a,"providers",f,ee=>{var Re,ae;return[ee.id,ee.module,(Re=ee.config)==null?void 0:Re.default_model,(ae=ee.config)==null?void 0:ae.model]},"Filter providers"),Ee=Or(o.authMode||((ze=g==null?void 0:g.config)==null?void 0:ze.auth_mode)),me=t&&["working","starting","running","stopping","busy"].includes(t.status),_e=ee=>{var xt,Ut,rt,Xe,$e,Nt,Zt,rn;c.current=!0;const Re=o.selectionKey??o.id??"";l.current[Re]={apiKey:u,configText:p};const{connections:ae,...Le}=o,Oe={...ae,[Re]:Le},et=(ee==null?void 0:ee.id)||"",It=Oe[et]||(ee?{modelEntry:"catalog",dirty:!1,authMode:Or((xt=ee.config)==null?void 0:xt.auth_mode),credentialMode:(Ut=ee.credential)!=null&&Ut.hasStoredKey||!ee.credential&&ee.credentialsConfigured?"private":"environment",envVar:((rt=ee.credential)==null?void 0:rt.envVar)||"",id:ee.id,module:ee.module,source:ee.source||"",config:ni(ee.config||{}),model:((Xe=ee.config)==null?void 0:Xe.default_model)||(($e=ee.config)==null?void 0:$e.model)||"",effort:((Nt=ee.config)==null?void 0:Nt.reasoning_effort)||""}:{modelEntry:"catalog",dirty:!1,id:"",module:"",source:"",config:"{}",model:"",effort:"",credentialMode:"environment",envVar:""});d(((Zt=l.current[et])==null?void 0:Zt.apiKey)||""),m(((rn=l.current[et])==null?void 0:rn.configText)??It.config),i({...It,connections:Oe,selectionKey:et,detailOpen:!0,order:null})};v.useEffect(()=>{var Re,ae,Le,Oe,et,st;if(y.current||!f.length||!h.providersLoadedAt||h.providersLoadedAtIt.id===o.id)||(!o.id&&!o.module?f[0]:null);ee&&!o.dirty&&i({id:ee.id,selectionKey:ee.id,module:ee.module,source:ee.source||"",config:ni(ee.config||{}),model:((Re=ee.config)==null?void 0:Re.default_model)||((ae=ee.config)==null?void 0:ae.model)||"",effort:((Le=ee.config)==null?void 0:Le.reasoning_effort)||"",authMode:Or((Oe=ee.config)==null?void 0:Oe.auth_mode),credentialMode:(et=ee.credential)!=null&&et.hasStoredKey||!ee.credential&&ee.credentialsConfigured?"private":"environment",envVar:((st=ee.credential)==null?void 0:st.envVar)||"",dirty:!1})},[h.providersLoadedAt]);const Je=v.useRef("");v.useEffect(()=>{var ee;if(!((G==null?void 0:G.status)!=="completed"||G.loginId===Je.current||!g)){Je.current=G.loginId;try{const Re={...tr(p)};for(const Le of["auth_mode","token_file_path","host_file_path","login_on_mount"])Le in(g.config||{})&&(Re[Le]=g.config[Le]);const ae=ni(Re);m(ae),i({config:ae,authMode:Or((ee=g.config)==null?void 0:ee.auth_mode)})}catch{}}},[G==null?void 0:G.loginId,G==null?void 0:G.status,(Ye=g==null?void 0:g.config)==null?void 0:Ye.auth_mode]);const De=w("providers.remove");v.useEffect(()=>{(De==null?void 0:De.phase)==="ready"&&De.updatedAt>=E.current&&(delete l.current[o.id],d(""),m("{}"),i({id:"",module:"",config:"{}",model:"",dirty:!1,detailOpen:!1,connections:{...o.connections,[o.id]:void 0}}))},[De==null?void 0:De.updatedAt]);const ue=w("providers.save");v.useEffect(()=>{(ue==null?void 0:ue.phase)==="ready"&&ue.updatedAt>=E.current&&(d(""),l.current[o.selectionKey??o.id]={apiKey:"",configText:p},s({dirty:!1,connections:{...o.connections,[o.selectionKey??o.id]:void 0}}))},[ue==null?void 0:ue.updatedAt]),v.useEffect(()=>{var ee;((ee=w("providers.reorder",""))==null?void 0:ee.phase)==="ready"&&o.order&&i({order:null})},[(ht=w("providers.reorder",""))==null?void 0:ht.updatedAt]);const ye=(ee,Re={})=>x(ee,{id:o.id,...Re}),M=yp(_,{...ne,default_model:o.model,model:o.model}).filter(ee=>o.module!=="provider-openai-chatgpt"||ee.id!=="auth_mode"),Y=(ee,Re)=>{const ae={...ne};Re===""?delete ae[ee]:ae[ee]=Re,m(ni(ae)),s({config:ni(ae),dirty:!0,...ee==="reasoning_effort"?{effort:Re}:{}})},se=async()=>{await x("providers.save",{...o.id?{id:o.id}:{},module:o.module.trim(),...o.source.trim()?{source:o.source.trim()}:{},config:{...ne,...o.model?{default_model:o.model}:{}},scope:o.scope,...X&&W==="environment"&&O?{apiKeyEnv:O}:u&&W==="private"?{apiKey:u}:{}})},Fe=!!u||p!==o.config||Object.values(l.current).some(ee=>ee.apiKey),je=!!o.dirty||Fe||Object.values(o.connections||{}).some(ee=>ee==null?void 0:ee.dirty);return Gw("providers",{label:"Provider configuration",dirty:je,review:()=>{r("providers");const ee=Object.entries(o.connections||{}).find(([,Re])=>Re==null?void 0:Re.dirty);!o.dirty&&!Fe&&ee?_e(f.find(Re=>Re.id===ee[0])||null):i({detailOpen:!0})},discard:()=>{l.current={},d(""),m("{}"),i({id:"",selectionKey:"",module:"",source:"",config:"{}",model:"",effort:"",dirty:!1,connections:{},detailOpen:!1})}}),n.createElement("section",{className:"a-settings-section","data-part":"provider-settings"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Model providers"),n.createElement("p",null,"Connect a provider and choose models for your conversations.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh providers","data-operation-pending":N(q)||void 0,"aria-busy":N(q)||void 0,"data-action":"providers.list",disabled:N(q),onClick:()=>x("providers.list")},n.createElement(Mt,null))),N(q)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading your saved providers…"),(q==null?void 0:q.error)&&n.createElement("p",{className:"a-danger",role:"alert"},q.error),!f.length&&!N(q)&&n.createElement("p",{className:"a-caption"},"No saved providers yet. Add a connection below."),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,f.length," saved connections"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>_e(null)},n.createElement(Ln,null),"Add provider"),n.createElement("button",{className:"a-soft",disabled:f.length<2||U,"data-action":"view.update",onClick:()=>i({orderOpen:!0,order:o.order||{ids:f.map(ee=>ee.id),expectedIds:f.map(ee=>ee.id),scope:o.scope}})},"Preference order")),o.order&&o.orderOpen!==!1?n.createElement(xp,{title:"Provider preference order",description:"Provider priority breaks ties after routing matches a model. Saving for "+({global:"all workspaces",project:"this project",local:"this workspace"}[o.order.scope]||o.order.scope)+". Routing profile choices stay separate.",items:f.map(ee=>({id:ee.id,label:ee.id,description:ee.module})),ids:o.order.ids,onChange:ee=>i({order:{...o.order,ids:ee}}),onCancel:()=>i({order:null}),busy:N(w("providers.reorder","")),error:(bt=w("providers.reorder",""))==null?void 0:bt.error,action:"providers.reorder",onSave:()=>x("providers.reorder",{...o.order})}):n.createElement(Co,{label:"providers",detailOpen:!!o.detailOpen,onBack:()=>i({detailOpen:!1}),list:n.createElement(n.Fragment,null,ie,n.createElement(Xt,{name:"provider-list",busy:N(q)},j.map(ee=>{var Re,ae;return n.createElement(Va,{key:ee.id,id:ee.id,label:ee.id,description:(((Re=ee.config)==null?void 0:Re.default_model)||((ae=ee.config)==null?void 0:ae.model)||ee.module)+" · "+(ee.credentialsConfigured?"credentials ready":ee.keySource||"credentials not configured"),selected:ee.id===(o.selectionKey??o.id),onSelect:()=>_e(ee)})})))},n.createElement("div",{className:"a-settings-provider-detail"},n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"provider-id"},"Provider instance name"),n.createElement("input",{id:"provider-id",value:o.id,"data-action":"view.update",onChange:ee=>s({id:ee.target.value}),placeholder:"openai"})),n.createElement("div",null,n.createElement("label",{htmlFor:"provider-scope"},"Save for"),n.createElement("select",{id:"provider-scope",value:o.scope,"data-action":"view.update",onChange:ee=>s({scope:ee.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project (shareable)"),n.createElement("option",{value:"local"},"This workspace (private)")))),n.createElement(Xt,{name:"provider-models",busy:N(I)},n.createElement("label",{htmlFor:"provider-model"},"Default model"),n.createElement(wp,{editable:!0,catalogKey:o.id,id:"provider-model",label:"Default model",value:o.model,entry:(ft=h.providerCatalogs)==null?void 0:ft[o.id],models:P,state:e,act:a,onChange:ee=>s({model:ee})})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!g||N(I),"data-operation-pending":N(I)||void 0,"aria-busy":N(I)||void 0,"data-action":"providers.models",onClick:()=>ye("providers.models",{refresh:!0})},n.createElement(Mt,null),N(I)?"Discovering models…":"Refresh models"),n.createElement("button",{className:"a-soft",disabled:!g||N(z),"data-operation-pending":N(z)||void 0,"aria-busy":N(z)||void 0,"data-action":"providers.test",onClick:()=>ye("providers.test")},n.createElement(Pt,null),N(z)?"Testing provider…":"Test connection"),n.createElement("button",{className:"a-soft",disabled:!g||U,"data-action":"providers.login",onClick:()=>ye("providers.login",{authMode:Ee,scope:o.scope})},n.createElement(Kk,null),g!=null&&g.accountConnected?"Reconnect account":"Provider sign-in")),n.createElement(nt,{phase:I==null?void 0:I.phase,message:N(I)?"Discovering available models…":(I==null?void 0:I.error)||((I==null?void 0:I.phase)==="ready"?`${P.length?`Found ${P.length} models. Choose one above.`:"This provider returned no models. Enter a model ID manually."}`:"")}),n.createElement(nt,{phase:z!=null&&z.error?"error":N(z)?"working":((Ce=h.test)==null?void 0:Ce.reachable)===!1?"error":"ready",message:N(z)?"Testing provider connection…":(z==null?void 0:z.error)||((z==null?void 0:z.phase)==="ready"||((gt=h.test)==null?void 0:gt.providerId)===o.id?((Et=h.test)==null?void 0:Et.reachable)!==!1?"Provider check passed":"Provider check failed":""),detail:!N(z)&&!(z!=null&&z.error)&&((vt=h.test)==null?void 0:vt.providerId)===o.id?`${h.test.modelCount??0} models returned. This checks the provider’s model catalog; no chat request was sent.`:void 0}),n.createElement("p",{className:"a-caption"},"Checks use saved provider settings. Save changes before testing."),n.createElement(Zw,{key:o.id,state:e,id:o.id,sessionId:t==null?void 0:t.id,act:a,disabled:!g||U}),o.module==="provider-openai-chatgpt"&&n.createElement(n.Fragment,null,n.createElement(Ep,{account:g==null?void 0:g.account}),n.createElement(Kw,{mode:Ee,onChange:ee=>i({authMode:ee}),disabled:U||["starting","waiting"].includes(Z)})),G&&(o.module==="provider-openai-chatgpt"?n.createElement(Au,{login:G,busy:U,onCancel:()=>ye("providers.loginCancel"),onRetry:()=>ye("providers.login",{authMode:Ee,scope:o.scope}),onEnablePlan:()=>ye("providers.login",{authMode:"chatgpt_plan",scope:o.scope,enablePlan:!0}),welcomeDismissed:o.welcomedLoginId===G.loginId,onWelcomeDismiss:()=>i({welcomedLoginId:G.loginId})}):n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"Provider sign-in · ",Z),(G.instructions||[]).map((ee,Re)=>n.createElement("p",{key:Re},ee)),D&&n.createElement("a",{href:D,target:"_blank",rel:"noopener noreferrer","data-action":"providers.login",className:"a-link"},"Open secure provider sign-in"),G.error&&n.createElement("p",{className:"a-danger"},G.error),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"providers.loginStatus",onClick:()=>a("providers.loginStatus",{id:o.id})},"Check sign-in status"),["starting","waiting"].includes(Z)&&n.createElement("button",{className:"a-soft","data-action":"providers.loginCancel",onClick:()=>a("providers.loginCancel",{id:o.id})},"Cancel sign-in")))),n.createElement(Xt,{name:"provider-options",busy:N(F),className:"a-provider-options"},n.createElement("h4",null,"Provider options"),N(F)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading options from this provider…"),(F==null?void 0:F.error)&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-danger"},F.error," You can still edit advanced configuration."),n.createElement("button",{className:"a-link","data-action":"providers.schema",onClick:()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}})},"Retry loading options")),M.map(ee=>{var Le;const Re=(ne==null?void 0:ne[ee.id])??"",ae="provider-option-"+ee.id;return n.createElement("div",{key:ee.id},n.createElement("label",{htmlFor:ae},ee.display_name||ee.id),(Le=ee.choices)!=null&&Le.length?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(ee.id,Oe.target.value)},n.createElement("option",{value:""},"Provider default",ee.default!=null?` (${ee.default})`:""),Re!==""&&!ee.choices.includes(String(Re))&&n.createElement("option",{value:String(Re)},String(Re)," (saved)"),ee.choices.map(Oe=>n.createElement("option",{key:Oe,value:Oe},Oe))):ee.field_type==="boolean"?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(ee.id,Oe.target.value===""?"":Oe.target.value==="true")},n.createElement("option",{value:""},"Provider default",ee.default!=null?` (${ee.default})`:""),n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):n.createElement("input",{id:ae,value:Re,"data-action":"view.update",placeholder:ee.default||"Provider default",onChange:Oe=>Y(ee.id,Oe.target.value)}),n.createElement("p",{className:"a-caption"},ee.prompt))}),_&&!M.length&&n.createElement("p",{className:"a-caption"},"This provider has no additional options for the selected model.")),g&&n.createElement(n.Fragment,null,n.createElement(Tu,{credential:g.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:N(q),onClick:()=>x("providers.list")},n.createElement(Mt,null),"Refresh credentials")),n.createElement("details",{className:"a-provider-access",open:o.accessOpen??!(g!=null&&g.credentialsConfigured)},n.createElement("summary",{"data-action":"view.update",onClick:ee=>{ee.preventDefault(),i({accessOpen:!(o.accessOpen??!(g!=null&&g.credentialsConfigured))})}},"Provider & access · ",g!=null&&g.accountConnected?"Account connected":g!=null&&g.credentialsConfigured?"Credentials configured":"Setup needed")," ",n.createElement("label",{htmlFor:"provider-preset"},"Provider"),n.createElement("select",{id:"provider-preset",value:Ic.some(ee=>ee.module===o.module)?o.module:"custom","data-action":"view.update",onChange:ee=>{const Re=ee.target.value==="custom"?"":ee.target.value;d(""),s({module:Re,envVar:"",credentialMode:["provider-chat-completions","provider-ollama","provider-vllm"].includes(Re)?"private":"environment",...!o.id&&Re?{id:Re.replace("provider-","")}:{}})}},n.createElement("option",{value:"custom"},"Custom provider module"),Ic.map(ee=>n.createElement("option",{key:ee.module,value:ee.module},ee.name))),!Ic.some(ee=>ee.module===o.module)&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-module"},"Provider module"),n.createElement("input",{id:"provider-module",value:o.module,"data-action":"view.update",onChange:ee=>s({module:ee.target.value}),placeholder:"provider-custom"})),X?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key-source"},"API key source"),n.createElement("select",{id:"provider-key-source",value:W,"data-action":"view.update",onChange:ee=>{d(""),s({credentialMode:ee.target.value})}},n.createElement("option",{value:"environment"},"Environment variable"),n.createElement("option",{value:"private"},"Private saved key")),W==="environment"?n.createElement(Xt,{name:"provider-credentials",busy:N(T)},n.createElement("label",{htmlFor:"provider-key-env"},"Environment variable name"),n.createElement("input",{id:"provider-key-env",value:O,"data-action":"view.update",onChange:ee=>s({envVar:ee.target.value}),placeholder:(C==null?void 0:C.defaultEnvVar)||"MY_PROVIDER_API_KEY",spellCheck:!1,autoComplete:"off"}),(C==null?void 0:C.defaultEnvVar)&&n.createElement("p",{className:"a-caption"},"Default: ",n.createElement("code",null,C.defaultEnvVar),!!((at=C.alternatives)!=null&&at.length)&&n.createElement(n.Fragment,null," · Also supported: ",C.alternatives.join(", "))),n.createElement(nt,{phase:N(T)?"working":T!=null&&T.error||A&&!(C!=null&&C.available)?"error":"ready",message:N(T)?"Checking environment variable…":(T==null?void 0:T.error)||(A||!o.envVar&&C?C!=null&&C.available?"Found — this variable will supply the key.":"Not found in the app environment. Set it before launching the app, then restart.":""),detail:A!=null&&A.checkedAt&&!N(T)?`Checked ${new Date(A.checkedAt*1e3).toLocaleTimeString()}`:void 0}),n.createElement("button",{className:"a-link","data-action":"providers.credentials",disabled:N(T)||!o.module||!!o.envVar&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(o.envVar),onClick:()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}})},N(T)?"Checking…":"Check variable"),n.createElement("p",{className:"a-caption"},"Reads the backend’s launch environment and private key file. Only the variable name is saved. Key previews show only the beginning and end of longer keys.")):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key"},"API key"),n.createElement("input",{id:"provider-key",type:"password",autoComplete:"new-password","data-private":"true","data-action":"providers.save",value:u,onChange:ee=>{d(ee.target.value),i({dirty:!0})},placeholder:g!=null&&g.credentialsConfigured?"Leave blank to keep current credentials":"Stored privately on this computer"}),n.createElement("p",{className:"a-caption"},"The full key stays private on this computer; only a masked preview is shown."))):n.createElement("p",{className:"a-caption"},"This provider uses account sign-in rather than an API key.")),n.createElement("button",{className:"a-link","aria-expanded":o.advanced,"data-action":"view.update",onClick:()=>i({advanced:!o.advanced})},o.advanced?"Hide":"Show"," advanced configuration"),o.advanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-source"},"Module source (optional)"),n.createElement(Ma,{id:"provider-source",value:o.source,onChange:ee=>s({source:ee}),state:e,act:a,placeholder:"git+https://… or a local module folder"}),n.createElement("label",{htmlFor:"provider-config"},"Provider configuration (JSON)"),n.createElement("textarea",{id:"provider-config",className:"a-json-editor",value:p,spellCheck:!1,"data-private":"true","data-action":"providers.save",onChange:ee=>{const Re=ee.target.value;m(Re);try{tr(Re),s({config:Re})}catch{}}})),H&&n.createElement("p",{className:"a-danger"},H),["providers.save","providers.remove"].map(ee=>{const Re=w(ee);return Re&&n.createElement("p",{className:Re.error?"a-danger":"a-caption",role:"status",key:ee},Re.error||(N(Re)?"Saving provider settings…":ee==="providers.save"?"Provider saved. New conversations will use these settings.":"Provider removed."))}),n.createElement(Rn,{active:!!o.detailOpen},n.createElement("button",{className:"a-primary",disabled:!o.module.trim()||!!H||U||X&&W==="environment"&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(O),"data-operation-pending":N(ue)||void 0,"aria-busy":N(ue)||void 0,"data-action":"providers.save",onClick:se},n.createElement(Pt,null),"Save provider"),n.createElement("button",{className:"a-soft a-danger",disabled:!g||U,"data-operation-pending":N(w("providers.remove"))||void 0,"aria-busy":N(w("providers.remove"))||void 0,"data-action":"providers.remove",onClick:()=>x("providers.remove",{id:o.id,scope:o.scope})},n.createElement(ea,null),"Remove")),t&&g&&n.createElement("div",{className:"a-provider-session"},n.createElement("button",{className:"a-soft",disabled:!o.model||me||U,"data-action":"runtime.control",onClick:()=>a("runtime.control",{sessionId:t.id,operation:"provider.select",args:{instance:o.id,model:o.model,...ne!=null&&ne.reasoning_effort?{effort:ne.reasoning_effort}:{}}})},"Use model in this conversation"),n.createElement("p",{className:"a-caption"},"Current-session selection requires the provider to be mounted by its bundle.")))))}const yD={open:!1,tab:"modules",scope:"global",section:"tools",id:"",module:"",source:"",config:"{}",enabled:!0,sourceKind:"module",sourceName:"",sourceUri:"",sourceSection:"tools",behavioral:!1,behaviorResultsExpanded:!1},Df=[["tools","Tools"],["hooks","Hooks"],["providers","Providers"],["orchestrator","Orchestrator"],["context","Context manager"]];function ED({state:e,act:t}){var O,k,T,I,F,z,q,W,X,U,_,P,G,Z,D,ne,H;const a=(O=e.view)==null?void 0:O.registryDraft,[r,o]=v.useState({...yD,...a});v.useEffect(()=>{a&&o(j=>({...j,...a}))},[a]);const i=j=>{const ie={...r,...j};o(ie),t("view.update",{patch:{registryDraft:ie}})},[s,l]=v.useState(r.config);v.useEffect(()=>{l(r.config)},[r.config]);const c=e.registry||{},u=((k=e.management)==null?void 0:k.phase)==="working",d=["queued","working"].includes((I=(T=e.actionStatus)==null?void 0:T["modules.validate"])==null?void 0:I.phase)&&((q=(z=(F=e.actionStatus)==null?void 0:F["modules.validate"])==null?void 0:z.target)==null?void 0:q.id)===r.id,p=c.modules||[],m=c.sources||[],h=((W=c.validation)==null?void 0:W.id)===r.id?c.validation:null,[f,g]=xa(e,t,"registry-modules",p,j=>[j.id,j.module,j.section,j.source],"Filter registered modules"),[E,y]=xa(e,t,"registry-sources",m,j=>[j.name,j.kind,j.source],"Filter source overrides");let b={},S="";try{b=tr(s)}catch(j){S=j.message}const w=((X=c.sourceValidation)==null?void 0:X.kind)===r.sourceKind&&((U=c.sourceValidation)==null?void 0:U.name)===r.sourceName.trim()&&((_=c.sourceValidation)==null?void 0:_.submittedSource)===r.sourceUri.trim()&&((P=c.sourceValidation)==null?void 0:P.scope)===r.scope&&((G=c.sourceValidation)==null?void 0:G.section)===r.sourceSection?c.sourceValidation:null,N={kind:r.sourceKind,name:r.sourceName.trim(),source:r.sourceUri.trim(),scope:r.scope,...r.sourceKind==="module"?{section:r.sourceSection}:{}},x=["sources.validate","sources.save"].some(j=>{var ie,Ee;return["queued","working"].includes((Ee=(ie=e.actionStatus)==null?void 0:ie[j])==null?void 0:Ee.phase)}),A=j=>{const ie=JSON.stringify(j.config||{},null,2);l(ie),i({section:j.section,id:j.id,module:j.module,source:j.source||"",config:ie,enabled:j.enabled!==!1})},C=()=>t(r.tab==="modules"?"modules.list":"sources.list",{scope:r.scope});return n.createElement(Pa,{id:"registries",title:"Advanced module & source registries",summary:"Register modules and override their sources",state:e,act:t},n.createElement("section",{className:"a-settings-section a-registry","data-part":"registries"},n.createElement("div",{className:"a-maintenance-content"},n.createElement("p",null,"Register individual modules or override where named modules and bundles are loaded from. Most setups can use community bundles above."),n.createElement("nav",{className:"a-settings-nav","aria-label":"Registry sections"},[["modules","Modules"],["sources","Source overrides"]].map(([j,ie])=>n.createElement("button",{key:j,className:r.tab===j?"selected":"","data-action":"view.update",onClick:()=>i({tab:j})},ie))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-scope"},"Configuration scope"),n.createElement("select",{id:"registry-scope",value:r.scope,"data-action":"view.update",onChange:j=>i({scope:j.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace (private)"))),n.createElement("button",{className:"a-soft",disabled:u,"data-action":r.tab==="modules"?"modules.list":"sources.list",onClick:C},n.createElement(Mt,null),"Load registry")),r.tab==="modules"?n.createElement(n.Fragment,null,g,n.createElement("div",{className:"a-provider-list"},f.map(j=>n.createElement("button",{key:j.section+":"+j.id,className:r.id===j.id&&r.section===j.section?"selected":"","data-action":"view.update",onClick:()=>A(j)},n.createElement("strong",null,j.id),n.createElement("small",null,j.section," · ",j.enabled===!1?"disabled":"enabled"," · ",j.scope||r.scope))),n.createElement("button",{"data-action":"view.update",onClick:()=>{l("{}"),i({id:"",module:"",source:"",config:"{}",enabled:!0})}},n.createElement(Ln,null),"Add module")),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-section"},"Module type"),n.createElement("select",{id:"registry-section",value:r.section,"data-action":"view.update",onChange:j=>i({section:j.target.value})},Df.map(([j,ie])=>n.createElement("option",{key:j,value:j},ie)))),n.createElement("div",null,n.createElement("label",{htmlFor:"registry-id"},"Instance name (optional)"),n.createElement("input",{id:"registry-id",value:r.id,"data-action":"view.update",onChange:j=>i({id:j.target.value})}))),n.createElement("label",{htmlFor:"registry-module"},"Module name"),n.createElement("input",{id:"registry-module",value:r.module,"data-action":"view.update",onChange:j=>i({module:j.target.value}),placeholder:"tool-example"}),n.createElement("label",{htmlFor:"registry-source"},"Source (optional)"),n.createElement(Ma,{id:"registry-source",state:e,act:t,value:r.source,onChange:j=>i({source:j}),placeholder:"git+https://… or /local/path"}),n.createElement("label",{htmlFor:"registry-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"registry-config",className:"a-json-editor",value:s,"data-action":"modules.save","data-private":"true",spellCheck:!1,onChange:j=>{const ie=j.target.value;l(ie);try{tr(ie),i({config:ie})}catch{}}}),S&&n.createElement("p",{className:"a-danger"},S),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.enabled,"data-action":"view.update",onChange:j=>i({enabled:j.target.checked})}),"Enabled"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.behavioral,"data-action":"view.update",onChange:j=>i({behavioral:j.target.checked})}),"Also run module behavior tests"),n.createElement("p",{className:"a-caption"},"Behavior tests run the module’s code in an isolated process."),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||!!S||!r.module.trim(),"data-action":"modules.save",onClick:()=>t("modules.save",{section:r.section,module:r.module.trim(),...r.id?{id:r.id}:{},...r.source?{source:r.source}:{},config:b,enabled:r.enabled,scope:r.scope})},n.createElement(Pt,null),"Save module")),n.createElement("button",{className:"a-soft",disabled:u||!r.id,"data-operation-pending":d||void 0,"aria-busy":d||void 0,"data-action":"modules.validate",onClick:()=>t("modules.validate",{section:r.section,id:r.id,scope:r.scope,behavioral:r.behavioral})},"Validate core contract"),n.createElement("button",{className:"a-soft a-danger",disabled:u||!r.id,"data-action":"modules.remove",onClick:()=>t("modules.remove",{section:r.section,id:r.id,scope:r.scope})},n.createElement(ea,null),"Remove")),n.createElement(Xt,{name:"module-validation",busy:d},((ne=(D=(Z=e.actionStatus)==null?void 0:Z["modules.validate"])==null?void 0:D.target)==null?void 0:ne.id)===r.id&&n.createElement(nt,{phase:e.actionStatus["modules.validate"].phase==="ready"&&(h==null?void 0:h.passed)===!1?"error":e.actionStatus["modules.validate"].phase,message:e.actionStatus["modules.validate"].error||(e.actionStatus["modules.validate"].phase==="ready"?h!=null&&h.passed?"Module validation passed":"Module validation failed":"Validating module…")}),h&&n.createElement("div",{className:"a-selection-card"},n.createElement("strong",null,h.id,": ",h.passed?"validation passed":"validation needs attention"),n.createElement("ul",{className:"a-catalog-list"},(h.checks||[]).map((j,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:j.passed?"ready":"error",message:j.name,detail:j.message})))),h.behavioral&&n.createElement("div",null,n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.behaviorResultsExpanded,onClick:()=>i({behaviorResultsExpanded:!r.behaviorResultsExpanded})},h.behavioral.passed?"Behavior tests passed":"Behavior tests need attention"," · ",(h.behavioral.tests||[]).length," tests · ",r.behaviorResultsExpanded?"Hide":"Show"," results"),r.behaviorResultsExpanded&&n.createElement("ul",{className:"a-catalog-list"},(h.behavioral.tests||[]).map((j,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:j.status==="failed"?"error":j.status==="skipped"?"neutral":"ready",message:j.name,detail:j.status})))))))):n.createElement(n.Fragment,null,y,n.createElement("div",{className:"a-routing-profiles"},E.map(j=>n.createElement("div",{key:j.kind+":"+j.name},n.createElement("span",null,n.createElement("strong",null,j.name),n.createElement("small",null,j.kind," · ",j.source)),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i({sourceKind:j.kind,sourceName:j.name,sourceUri:j.source})},"Edit"),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove source ${j.name}`,disabled:u,"data-action":"sources.remove",onClick:()=>t("sources.remove",{kind:j.kind,name:j.name,scope:r.scope})},n.createElement(ea,null))))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"source-kind"},"Source type"),n.createElement("select",{id:"source-kind",value:r.sourceKind,"data-action":"view.update",onChange:j=>i({sourceKind:j.target.value})},n.createElement("option",{value:"module"},"Module"),n.createElement("option",{value:"bundle"},"Bundle"))),n.createElement("div",null,n.createElement("label",{htmlFor:"source-name"},"Registered name"),n.createElement("input",{id:"source-name",value:r.sourceName,"data-action":"view.update",onChange:j=>i({sourceName:j.target.value}),placeholder:"tool-example"}))),n.createElement("label",{htmlFor:"source-uri"},"Repository URL or local path"),n.createElement(Ma,{id:"source-uri",state:e,act:t,value:r.sourceUri,onChange:j=>i({sourceUri:j}),placeholder:"git+https://… or /local/path"}),r.sourceKind==="module"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"source-section"},"Module type to validate"),n.createElement("select",{id:"source-section",value:r.sourceSection,"data-action":"view.update",onChange:j=>i({sourceSection:j.target.value})},Df.map(([j,ie])=>n.createElement("option",{key:j,value:j},ie))),n.createElement("p",{className:"a-caption"},"Check the candidate before replacing the saved source. Validation checks the module contract; it does not start a conversation.")),n.createElement("div",{className:"a-dialog-actions"},r.sourceKind==="module"&&n.createElement("button",{className:"a-soft",disabled:u||x||!N.name||!N.source,"data-action":"sources.validate",onClick:()=>t("sources.validate",N)},"Validate without saving"),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||x||!N.name||!N.source,"data-action":"sources.save",onClick:()=>t("sources.save",{...N,...r.sourceKind==="module"?{validate:!0}:{}})},n.createElement(Pt,null),r.sourceKind==="module"?"Validate & save source":"Save source override"))),n.createElement(Xt,{name:"source-validation",busy:x},x&&n.createElement(nt,{phase:"working",message:"Validating candidate source…"}),!x&&w&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:w.passed?"ready":"error",message:w.saved?"Candidate validated and saved":w.passed?"Candidate validated; nothing saved":"Validation failed; saved source unchanged"}),(H=w.checks)==null?void 0:H.map((j,ie)=>n.createElement(nt,{key:ie,phase:j.passed?"ready":"error",message:j.name,detail:j.message}))))),n.createElement("p",{className:"a-caption"},"Saved configuration applies when sessions are prepared again. Use environment references for credentials; configure provider keys under Setup."))))}function Sp(e){var a;const t=[];for(const r of["providers","tools","hooks"])for(const[o,i]of(Array.isArray(e==null?void 0:e[r])?e[r]:[]).entries())t.push({key:`${r}:${o}`,section:r,index:o,module:i.module||"Unnamed module",id:i.instance_id||i.id||i.module,enabled:i.enabled!==!1,source:i.source,config:i.config||{},entry:i});for(const r of["orchestrator","context"]){const o=(a=e==null?void 0:e.session)==null?void 0:a[r];o&&t.push({key:`session:${r}`,section:r,index:r,module:typeof o=="string"?o:o.module,id:o.id||o.module||o,enabled:o.enabled!==!1,source:o.source,config:o.config||{},entry:o,required:!0})}return t}function Ff(e,t,a){const r=structuredClone(e),o=Sp(r).find(l=>l.key===t);if(!o)throw new Error("Select a module to edit.");const s={...typeof o.entry=="string"?{module:o.entry}:o.entry,...a};if(o.required){if(a.enabled===!1)throw new Error("The session requires an orchestrator and a context module.");r.session[o.section]=s}else r[o.section][o.index]=s;return r}function wD(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Configuration must be a JSON object.");return t}const ur=e=>JSON.stringify(e,null,2),kD={source:"",selectedUri:"",alias:"",role:"behavior",exportName:"my-amplifier",exportDescription:""};function Xw(e,t,a,r){const[o,i]=v.useState({...t,...e});v.useEffect(()=>{e&&i(l=>({...l,...e}))},[e]);function s(l){const c={...o,...l};i(c),r("view.update",{patch:{[a]:c}})}return[o,s]}function xD({state:e,session:t,act:a}){var x,A,C,O;const[r,o]=Xw((x=e.view)==null?void 0:x.bundleManager,kD,"bundleManager",a),i=Array.isArray(e.bundles)?e.bundles:((A=e.bundles)==null?void 0:A.entries)||[],[s,l]=v.useState({});v.useEffect(()=>{l(k=>Object.fromEntries(Object.entries(k).filter(([T,I])=>i.some(F=>F.id===T&&F.enabled!==I))))},[e.bundles]);const c=(C=e.actionStatus)==null?void 0:C["bundles.toggle"];v.useEffect(()=>{(c==null?void 0:c.phase)==="error"&&l(k=>{var I;const T={...k};return delete T[(I=c.target)==null?void 0:I.id],T})},[c]);const u=async(k,T)=>{l(I=>({...I,[k]:T}));try{if(!await a("bundles.toggle",{id:k,enabled:T}))throw new Error("Request not sent")}catch{l(I=>{const F={...I};return delete F[k],F})}},d=i.find(k=>k.id===r.entryId)||i[0],p=i.filter(k=>k.role!=="standalone"&&k.enabled!==!1),m=(O=e.actionStatus)==null?void 0:O["bundles.reorder"];v.useEffect(()=>{(m==null?void 0:m.phase)==="ready"&&r.order&&o({order:null})},[m==null?void 0:m.commandId,m==null?void 0:m.phase]);const h=e.bundleDiscovery||{},f=h.candidates||[],[g,E]=xa(e,a,"bundle-discovery",f,k=>[k.display_name,k.name,k.path,k.uri,k.kind,k.description],"Filter discovered bundles"),[y,b]=xa(e,a,"app-bundles",i,k=>[k.name,k.uri,k.role],"Filter app bundles"),S=f.find(k=>k.uri===r.selectedUri),w=e.management||{},N=Object.entries(e.actionStatus||{}).some(([k,T])=>k.startsWith("bundle")&&["queued","running","pending","working","discovering","applying"].includes(T.phase));return v.useEffect(()=>{a("bundles.list",{})},[]),n.createElement("div",{className:"a-bundle-pane"},n.createElement(Pa,{id:"add-bundles",title:"Add capabilities",summary:"Browse community bundle repositories",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(qr,null),n.createElement("div",null,n.createElement("h3",null,"Build your Amplifier"),n.createElement("p",null,"Add capabilities from community repositories, then shape the modules they compose into."))),w.error&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,w.error)),N&&n.createElement("div",{className:"a-management-status",role:"status"},n.createElement(Mt,{className:"a-progress-spinner"}),w.detail||"Updating your configuration…"),!N&&w.detail&&n.createElement("p",{className:"a-caption",role:"status"},w.detail),n.createElement("label",{htmlFor:"bundle-source"},"Repository or bundle URL"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"bundle-source",type:"url",value:r.source,placeholder:"https://github.com/owner/amplifier-bundle","data-action":"view.update",onChange:k=>o({source:k.target.value})}),n.createElement("button",{className:"a-primary",disabled:!r.source.trim()||N,"data-action":"bundle.discover",onClick:()=>a("bundle.discover",{url:r.source.trim()})},n.createElement(To,null),"Browse")),n.createElement("p",{className:"a-caption"},"Browse a repository’s YAML and Markdown bundles before choosing what to add."),f.length>0&&n.createElement("div",{className:"a-discovery","aria-label":"Discovered bundles"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,f.length," ",f.length===1?"bundle found":"bundles found"),h.revision&&n.createElement("code",null,h.revision.slice(0,9))),E,n.createElement("div",{className:"a-candidates"},g.map(k=>n.createElement("label",{className:`a-candidate ${(S==null?void 0:S.uri)===k.uri?"selected":""}`,key:k.uri},n.createElement("input",{type:"radio",name:"bundle-candidate",checked:(S==null?void 0:S.uri)===k.uri,"data-action":"view.update",onChange:()=>o({selectedUri:k.uri,alias:k.name||"",role:k.kind==="standalone"?"standalone":"behavior"})}),n.createElement("span",null,n.createElement("strong",null,k.display_name||k.name||k.path),n.createElement("small",null,k.path||k.uri),k.description&&n.createElement("p",null,k.description)),n.createElement("span",{className:"a-kind-tag"},k.kind||"bundle")))),n.createElement("p",{className:"a-caption"},"Type suggestions are based on file contents. Choose how you want to use the bundle below.")),(S||r.selectedUri)&&n.createElement("div",{className:"a-selection-card"},n.createElement("label",{htmlFor:"bundle-add-role"},"Use this bundle as"),n.createElement("select",{id:"bundle-add-role",value:r.role,"data-action":"view.update",onChange:k=>o({role:k.target.value})},n.createElement("option",{value:"behavior"},"An app capability — compose into sessions"),n.createElement("option",{value:"standalone"},"A standalone bundle — register an alias")),n.createElement("label",{htmlFor:"bundle-alias"},r.role==="standalone"?"Bundle alias":"Display name"),n.createElement("input",{id:"bundle-alias",value:r.alias,"data-action":"view.update",onChange:k=>o({alias:k.target.value}),placeholder:"my-capabilities"}),n.createElement("p",{className:"a-caption a-wrap"},r.selectedUri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:N||!r.selectedUri||r.role==="standalone"&&!r.alias.trim(),"data-action":"bundles.add",onClick:()=>a("bundles.add",{uri:r.selectedUri,...S!=null&&S.reviewId?{reviewId:S.reviewId}:{},name:r.alias.trim()||void 0,role:r.role})},n.createElement(Ln,null),r.role==="standalone"?"Register bundle":"Add capability"))))),n.createElement(Pa,{id:"app-bundles",title:"App bundles",summary:`${i.length} configured · inspect capabilities and aliases`,state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Your app bundles"),n.createElement("p",null,"Capabilities extend your conversations. Standalone aliases are available when starting a conversation.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh app bundles","data-action":"bundles.list",onClick:()=>a("bundles.list")},n.createElement(Mt,null))),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,i.length," configured · ",p.length," enabled capabilities"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:p.length<2||N,onClick:()=>o({orderOpen:!0,order:r.order||{ids:p.map(k=>k.id),expectedIds:p.map(k=>k.id)}})},"Composition order")),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:"Bundle composition order",description:"Capabilities compose from top to bottom. Later settings can override earlier ones. Disabled entries and standalone aliases are outside this chain.",items:p.map(k=>({id:k.id,label:k.name||k.uri,description:"App capability"})),ids:r.order.ids,onChange:k=>o({order:{...r.order,ids:k}}),onCancel:()=>o({order:null}),busy:["queued","working"].includes(m==null?void 0:m.phase),error:m==null?void 0:m.error,action:"bundles.reorder",onSave:()=>a("bundles.reorder",r.order)}):i.length?n.createElement(Co,{label:"bundles",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,b,y.map(k=>n.createElement(Va,{key:k.id,id:k.id,label:k.name||k.uri,description:k.role==="standalone"?"Standalone alias":"App capability",checked:s[k.id]??k.enabled!==!1,disabled:N,checkLabel:`Enable ${k.name||k.uri}`,checkAction:"bundles.toggle",onCheck:T=>u(k.id,T),selected:k.id===(d==null?void 0:d.id),onSelect:()=>o({entryId:k.id,detailOpen:!0})})))},d&&n.createElement(n.Fragment,null,n.createElement("h4",null,d.name||"Bundle"),n.createElement("p",null,d.role==="standalone"?"Standalone alias · choose it when starting a conversation.":"App capability · composes into prepared conversations."),n.createElement("p",{className:"a-caption"},d.enabled===!1?"Disabled":d.role==="standalone"?"Available as "+d.name:"Position "+(p.findIndex(k=>k.id===d.id)+1)+" of "+p.length+" in composition"),n.createElement("h5",null,"Source"),n.createElement("p",{className:"a-caption a-wrap"},d.uri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft a-danger","aria-label":`Remove ${d.name||"bundle"}`,disabled:N,"data-action":"bundles.remove",onClick:()=>a("bundles.remove",{id:d.id})},n.createElement(ea,null),"Remove bundle")),n.createElement("p",{className:"a-caption"},"Changes apply to future conversation preparation. Inspect conversation modules to change a loaded session."))):n.createElement("div",{className:"a-settings-empty"},n.createElement(ax,null),n.createElement("span",null,"Your app has no additional bundles yet. Browse a repository to add one.")))),n.createElement(Pa,{id:"loaded-modules",title:"Loaded session modules",summary:t?`Inspect and edit the running mount plan for ${t.title}`:"Select a conversation to inspect its mount plan",state:e,act:a},n.createElement(SD,{state:e,session:t,act:a})),n.createElement(ED,{state:e,act:a}),n.createElement(Pa,{id:"share-bundle",title:"Save and share",summary:"Export this session as a reusable bundle",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(wa,null),n.createElement("div",null,n.createElement("h3",null,"Share your setup"),n.createElement("p",null,"Export the current session’s bundle and applied configuration for others to load with Amplifier Foundation."))),n.createElement("label",{htmlFor:"bundle-export-name"},"Bundle name"),n.createElement("input",{id:"bundle-export-name",value:r.exportName,"data-action":"view.update",onChange:k=>o({exportName:k.target.value})}),n.createElement("label",{htmlFor:"bundle-export-description"},"Description"),n.createElement("input",{id:"bundle-export-description",value:r.exportDescription,"data-action":"view.update",onChange:k=>o({exportDescription:k.target.value})}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!t||N||!r.exportName.trim(),"data-action":"bundle.export",onClick:()=>a("bundle.export",{sessionId:t.id,name:r.exportName.trim(),description:r.exportDescription})},n.createElement(wa,null),"Export app bundle")),n.createElement("p",{className:"a-caption"},"Exports include bundle references and configuration. Provider credentials stay on this machine."))))}function SD({state:e,session:t,act:a}){var w,N,x,A;const[r,o]=Xw((w=e.view)==null?void 0:w.moduleEditor,{sessionId:"",text:"",selectedKey:"",configText:"",name:"my-amplifier",description:"",showRaw:!1,configAdvanced:!1},"moduleEditor",a),i=(t==null?void 0:t.configuration)||(((N=e.configuration)==null?void 0:N.sessionId)===(t==null?void 0:t.id)?e.configuration:null),s=i==null?void 0:i.plan;e.management;const l=(x=e.actionStatus)==null?void 0:x["configuration.apply"],c=(A=e.actionStatus)==null?void 0:A["configuration.inspect"],u=!!(t!=null&&t.configurationBusy)||["queued","working"].includes(c==null?void 0:c.phase)||["queued","working"].includes(l==null?void 0:l.phase),d=!!t&&["working","running","busy","starting","stopping"].includes(t.status);v.useEffect(()=>{t&&a("configuration.inspect",{id:t.id})},[t==null?void 0:t.id]),v.useEffect(()=>{var C,O,k;s&&t&&(r.sessionId!==t.id||!r.text||((C=t.pendingConfiguration)==null?void 0:C.phase)==="ready"&&r.appliedAt!==((O=t.pendingConfiguration)==null?void 0:O.appliedAt))&&o({sessionId:t.id,text:ur(s),selectedKey:"",configText:"",appliedAt:(k=t.pendingConfiguration)==null?void 0:k.appliedAt})},[t==null?void 0:t.id,s]);let p=null,m="";try{r.sessionId===(t==null?void 0:t.id)&&r.text&&(p=wD(r.text))}catch(C){m=C.message}const h=Sp(p),f=h.find(C=>C.key===r.selectedKey),[g,E]=xa(e,a,"loaded-modules",h,C=>[C.id,C.module,C.section,C.source],"Filter loaded modules"),y=!!p&&ur(p)!==ur(s);function b(C,O){try{const k=Ff(p,C,O);o({text:ur(k),...C===r.selectedKey&&O.config?{configText:ur(O.config)}:{}})}catch(k){o({parseError:k.message})}}function S(C){o({selectedKey:C.key,detailOpen:!0,configText:ur(C.config),parseError:""})}return n.createElement("section",{className:"a-settings-section a-module-settings"},n.createElement("div",{className:"a-settings-heading"},n.createElement(Os,null),n.createElement("div",null,n.createElement("h3",null,"Running mount plan"),n.createElement("p",null,t?`Inspect the loaded configuration behind “${t.title}”.`:"Start or select a conversation to inspect its composed configuration."))),t&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:c==null?void 0:c.phase,message:(c==null?void 0:c.error)||(["queued","working"].includes(c==null?void 0:c.phase)?"Reading the loaded AmplifierSession mount plan…":"")}),n.createElement("div",{className:"a-settings-row"},n.createElement("span",{className:"a-caption a-wrap"},t.bundle),n.createElement("button",{className:"a-soft",disabled:u,"data-action":"configuration.inspect",onClick:()=>a("configuration.inspect",{id:t.id})},n.createElement(Mt,null),s?"Refresh configuration":"Load configuration")),s&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"The fully composed plan includes your root bundle and app capabilities. Edits below apply to this conversation’s mounted configuration. Apply changes to reload modules and preserve the conversation history."),n.createElement(Co,{label:"modules",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,E,g.map(C=>n.createElement(Va,{key:C.key,id:C.key,label:C.id,description:C.section+(C.required?" · required":""),checked:C.enabled,disabled:C.required,checkLabel:`Enable ${C.id}`,onCheck:O=>b(C.key,{enabled:O}),selected:C.key===r.selectedKey,onSelect:()=>S(C)})))},f?n.createElement(n.Fragment,null,n.createElement("h4",null,f.module),f.source&&n.createElement("p",{className:"a-caption a-wrap"},f.source),n.createElement("div",{className:"a-module-fields"},Object.entries(f.config).map(([C,O])=>{const k=/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(C),T="module-field-"+C;return n.createElement("div",{key:C},n.createElement("label",{htmlFor:T},C.replaceAll("_"," ")),k?n.createElement("p",{className:"a-caption"},"Credential preserved. Manage keys in Model providers."):typeof O=="boolean"?n.createElement("select",{id:T,value:String(O),"data-action":"view.update",onChange:I=>b(f.key,{config:{...f.config,[C]:I.target.value==="true"}})},n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):O===null||typeof O=="object"?n.createElement("p",{className:"a-caption"},Array.isArray(O)?`${O.length} items`:"Structured value"," · edit in advanced configuration below."):n.createElement("input",{id:T,type:typeof O=="number"?"number":"text",value:O,"data-action":"view.update",onChange:I=>{typeof O=="number"&&!I.target.value||b(f.key,{config:{...f.config,[C]:typeof O=="number"?Number(I.target.value):I.target.value}})}}))})),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.configAdvanced,onClick:()=>o({configAdvanced:!r.configAdvanced})},r.configAdvanced?"Hide":"Edit"," advanced configuration"),r.configAdvanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"module-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"module-config",className:"a-json-editor",value:r.configText,spellCheck:!1,"data-action":"view.update",onChange:C=>{try{tr(C.target.value),o({configText:C.target.value,parseError:""})}catch(O){O.message.includes("private API key")?o({parseError:O.message}):o({configText:C.target.value,parseError:""})}}}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const C=tr(r.configText);o({text:ur(Ff(p,f.key,{config:C})),parseError:""})}catch(C){o({parseError:C.message})}}},n.createElement(Pt,null),"Update draft"))):n.createElement("div",{className:"a-settings-empty"},n.createElement(Os,null),n.createElement("span",null,"Select a module to edit its configuration."))),(m||r.parseError)&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,m||r.parseError)),n.createElement("div",{className:"a-module-plan-options"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>o({showRaw:!r.showRaw})},r.showRaw?"Hide":"Edit"," full configuration JSON"),r.showRaw&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"full-module-plan"},"Full composed plan"),n.createElement("textarea",{id:"full-module-plan",className:"a-json-editor a-full-plan",spellCheck:!1,value:r.text,"data-action":"view.update",onChange:C=>o({text:C.target.value,parseError:""})})),d&&n.createElement("p",{className:"a-caption"},"Work is active. Apply when idle will queue these changes until this turn and its worker lanes finish.")),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:!p||!!m||u||!y,"data-action":"configuration.apply",onClick:()=>a("configuration.apply",{id:t.id,config:p,whenIdle:!0})},n.createElement(Pt,null),d?"Apply when idle":"Apply to loaded session"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:!y&&!r.parseError&&!m,onClick:()=>o({text:ur(s),selectedKey:"",configText:"",parseError:""})},"Revert draft"),n.createElement("span",{className:"a-caption"},y?"Unapplied changes":"Saved configuration")),t.pendingConfiguration&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:t.pendingConfiguration.phase==="queued"?"pending":t.pendingConfiguration.phase==="applying"?"working":t.pendingConfiguration.phase,message:t.pendingConfiguration.error||t.pendingConfiguration.detail||"Applying mount-plan changes…"}),t.pendingConfiguration.phase==="queued"&&n.createElement("button",{className:"a-soft","data-action":"configuration.cancel",onClick:()=>a("configuration.cancel",{id:t.id})},"Cancel queued changes")),n.createElement("div",{className:"a-custom-bundle"},n.createElement("h4",null,"Keep this as a custom bundle"),n.createElement("p",null,"Save the applied configuration under your own name. Use Export below to share it. Apply any pending changes first."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-name"},"Name"),n.createElement("input",{id:"custom-bundle-name",value:r.name,"data-action":"view.update",onChange:C=>o({name:C.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-description"},"Description"),n.createElement("input",{id:"custom-bundle-description",value:r.description,"data-action":"view.update",onChange:C=>o({description:C.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!p||!!m||y||!r.name.trim()||u,"data-action":"bundle.save",onClick:()=>a("bundle.save",{sessionId:t.id,name:r.name.trim(),description:r.description})},n.createElement(wa,null),"Save custom bundle"))))))}function ek(e,t){const[a,r]=v.useState({visibility:"hidden"});return v.useLayoutEffect(()=>{var c,u;if(!e)return;const o=(c=t.current)==null?void 0:c.querySelector(".a-compact-popover"),i=(u=t.current)==null?void 0:u.querySelector("button");if(!o||!i)return;const s=()=>{const d=i.getBoundingClientRect(),p=Math.min(340,window.innerWidth-24),m=o.getBoundingClientRect().height;r({width:p,left:Math.max(12,Math.min(d.left,window.innerWidth-p-12)),top:Math.max(12,Math.min(d.top-m-10,window.innerHeight-m-12)),visibility:"visible"})};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{l.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[e,t]),a}const _i=(e,t)=>{var a,r;return((r=(a=e.registeredBundles)==null?void 0:a.find(o=>o.value===t))==null?void 0:r.label)||t||"Bundle"},Cp={};function tk(e){return e.compact?n.createElement(CD,{...e}):n.createElement(ND,{...e})}function CD({state:e,session:t,act:a,working:r}){var A,C,O,k,T;const o=Ja(e),i=Ag(e),s=((A=e.view)==null?void 0:A.composerBundle)||Cp,[l,c]=v.useState(s),[u,d]=v.useState(!1),[p,m]=v.useState(""),h=v.useRef(!1);v.useEffect(()=>c(s),[s]);const f=I=>{const F={...l,...I};c(F),a("view.update",{patch:{composerBundle:F}})},g=(t==null?void 0:t.bundle)||o.bundle||i.bundle||(((C=e.bundleDefaults)==null?void 0:C.workspacePath)===o.workspace?e.bundleDefaults.effective:""),E=l.open&&l.sessionId===((t==null?void 0:t.id)||null),y=v.useRef(null),b=ek(E,y);il(E,y,()=>f({open:!1})),v.useEffect(()=>{var I;(I=e.registeredBundles)!=null&&I.length||a("bundles.list",{})},[]);const S=e.registeredBundles||[],w=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1;async function N(I,F=!1){if(!h.current){h.current=!0,d(!0),m(""),f({bundle:I});try{await a(t?"bundle.switch":"view.update",t?{sessionId:t.id,bundle:I,resetModel:F}:{patch:{newSessionDraft:{...o,bundle:I}}})}catch(z){m(z.message)}finally{h.current=!1,d(!1)}}}const x=(t==null?void 0:t.bundlePreview)&&t.bundlePreview.bundle===l.bundle&&t.bundlePreview.modelCompatible===!1&&((O=t==null?void 0:t.bundleChange)==null?void 0:O.phase)!=="ready";return n.createElement("div",{className:"a-model-control a-bundle-control",ref:y},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle",disabled:!!w,"aria-expanded":!!E,"data-action":"view.update",onClick:()=>f({open:!E,sessionId:(t==null?void 0:t.id)||null,bundle:g})},n.createElement(qr,null),n.createElement("span",null,g?_i(e,g):i.phase==="error"?"Bundle unavailable":"Loading bundle…"),n.createElement(el,null)),E&&n.createElement("section",{className:"a-model-popover a-compact-popover",style:b,"aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>f({open:!1})},n.createElement(nn,null))),n.createElement("select",{"aria-label":"Registered root bundles",value:g||"",disabled:r||u||(t==null?void 0:t.configurationBusy),"data-action":t?"bundle.switch":"view.update",onChange:I=>N(I.target.value)},!g&&n.createElement("option",{value:"",disabled:!0},"Loading bundles…"),g&&!S.some(I=>I.value===g)&&n.createElement("option",{value:g},_i(e,g)),S.map(I=>n.createElement("option",{key:I.value,value:I.value},I.label||I.value))),((k=S.find(I=>I.value===g))==null?void 0:k.description)&&n.createElement("p",{className:"a-caption a-composer-bundle-description"},S.find(I=>I.value===g).description),x&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("button",{type:"button",className:"a-soft",disabled:u||r,onClick:()=>N(l.bundle,!0)},"Use the new bundle’s model")),(p||((T=t==null?void 0:t.bundleChange)==null?void 0:T.phase)==="error")&&n.createElement("small",{className:"a-danger",role:"status"},p||t.bundleChange.error)))}function ND({state:e,session:t,act:a,working:r}){var O,k,T,I,F;const o=((O=e.view)==null?void 0:O.composerBundle)||Cp,[i,s]=v.useState(o),[l,c]=v.useState(null),u=v.useRef(!1);v.useEffect(()=>s(o),[o]);const d=z=>{const q={...i,...z};s(q),a("view.update",{patch:{composerBundle:q}})},p=Ja(e),m=(t==null?void 0:t.bundle)||p.bundle||((k=e.bundleDefaults)==null?void 0:k.effective)||((T=e.settings)==null?void 0:T.bundle)||"work",h=i.open&&i.sessionId===((t==null?void 0:t.id)||null),f=v.useRef(null);il(h,f,()=>d({open:!1}));const g=t==null?void 0:t.bundleChange,E=t==null?void 0:t.bundlePreview,y=!!l||!!(t!=null&&t.configurationBusy)||(g==null?void 0:g.phase)==="working",b=(E==null?void 0:E.bundle)===i.bundle&&(E==null?void 0:E.previewId),S=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1,w=r||y||S||!((I=i.bundle)!=null&&I.trim()),N=b&&!E.modelCompatible&&!i.resetModel,x=l||(g==null?void 0:g.action),A=x==="bundle.preview"?"Previewing bundle changes…":x==="bundle.fork"?"Creating a conversation with this bundle…":"Switching bundle…";async function C(z){if(!u.current){u.current=!0,c(z);try{await a(z,z==="view.update"?{patch:{newSessionDraft:{...Ja(e),bundle:i.bundle},composerBundle:{},panel:null}}:{sessionId:t.id,bundle:i.bundle,...z!=="bundle.preview"?{...b?{previewId:E.previewId}:{},resetModel:!!i.resetModel}:{}})}finally{u.current=!1,c(null)}}}return n.createElement("div",{className:"a-model-control a-bundle-control",ref:f},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle","aria-expanded":!!h,"data-action":"view.update",onClick:()=>d({open:!h,sessionId:(t==null?void 0:t.id)||null,bundle:m,resetModel:!1})},n.createElement(qr,null),n.createElement("span",null,!t&&!p.bundle?"Workspace default":_i(e,m)),n.createElement(el,null)),h&&n.createElement("section",{className:"a-model-popover a-bundle-popover","aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>d({open:!1})},n.createElement(nn,null))),n.createElement("p",null,"Choose the tools, agents, and instructions for this conversation."),n.createElement(Ng,{id:"conversation-bundle",value:i.bundle||m,onChange:z=>d({bundle:z,resetModel:!1}),state:e,act:a}),t?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Switch directly, or preview the changes first. Switching keeps history and compatible model choices, and resets previous module edits, modes, and budget overrides."),b&&n.createElement("div",{className:"a-bundle-changes","aria-label":"Bundle changes"},Object.entries(E.changes||{}).map(([z,q])=>{var W,X,U,_;return n.createElement("div",{key:z},n.createElement("strong",null,z[0].toUpperCase()+z.slice(1)),"after"in q?n.createElement("p",null,q.before||"None"," → ",q.after||"None"):n.createElement(n.Fragment,null,((W=q.added)==null?void 0:W.length)>0&&n.createElement("p",null,"Add: ",q.added.join(", ")),((X=q.removed)==null?void 0:X.length)>0&&n.createElement("p",null,"Remove: ",q.removed.join(", ")),!((U=q.added)!=null&&U.length)&&!((_=q.removed)!=null&&_.length)&&n.createElement("p",null,"Same set; settings may change.")))}),n.createElement("p",null,"Instructions are replaced. Enabled app capabilities and shared settings still apply."),((F=E.appCapabilities)==null?void 0:F.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Added app capabilities (",E.appCapabilities.length,")"),n.createElement("ul",null,E.appCapabilities.map(z=>n.createElement("li",{key:z,className:"a-wrap"},z)))),!E.modelCompatible&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:!!i.resetModel,"data-action":"view.update",onChange:z=>d({resetModel:z.target.checked})})," Use the new bundle’s model"))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w||N||i.bundle===m,"data-action":"bundle.switch",onClick:()=>C("bundle.switch")},"Switch bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"bundle.preview",onClick:()=>C("bundle.preview")},"Preview changes"),n.createElement("button",{type:"button",className:"a-soft",disabled:w||N,"data-action":"bundle.fork",onClick:()=>C("bundle.fork")},"Fork with this bundle")),r&&n.createElement("p",null,"Finish this turn and its workers to preview or switch bundles."),(y||g)&&n.createElement(nt,{phase:y?"working":g.phase,message:y?A:g.error||(g.phase==="ready"?g.action==="bundle.preview"?"Preview ready":g.action==="bundle.fork"?"Fork created":"Bundle switched":"")})):n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"view.update",onClick:()=>C("view.update")},"Use bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:y||!p.bundle,"data-action":"view.update",onClick:()=>a("view.update",{patch:{newSessionDraft:{...p,bundle:""},composerBundle:{}}})},"Use workspace default"))))}function RD({state:e,act:t}){var h,f;const a=e.bundleDefaults||{},r=((h=e.view)==null?void 0:h.bundleDefaultsDraft)||Cp,[o,i]=v.useState(r),[s,l]=v.useState(!1),c=v.useRef(!1);v.useEffect(()=>i(r),[r]);const u=o.scope||"app",d=o.bundle??a[u]??"",p=g=>{const E={...o,...g};i(E),t("view.update",{patch:{bundleDefaultsDraft:E}})};async function m(g){var E;if(!c.current){c.current=!0,l(!0);try{await t("bundle.default",{scope:u,bundle:g,workspace:a.workspacePath||((E=e.settings)==null?void 0:E.workspace)})}finally{c.current=!1,l(!1)}}}return n.createElement("div",null,n.createElement("label",{htmlFor:"bundle-default-scope"},"Default applies to"),n.createElement("select",{id:"bundle-default-scope",value:u,"data-action":"view.update",onChange:g=>p({scope:g.target.value,bundle:a[g.target.value]||""})},n.createElement("option",{value:"app"},"This Unified app"),n.createElement("option",{value:"workspace"},"This workspace on this computer"),n.createElement("option",{value:"shared"},"Shared Amplifier settings (including CLI)")),n.createElement("label",{htmlFor:"default-bundle"},"Default bundle for new conversations"),n.createElement(Ng,{id:"default-bundle",value:d,state:e,act:t,onChange:g=>p({bundle:g})}),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:s||!d.trim(),"data-action":"bundle.default",onClick:()=>m(d.trim())},"Save default"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"bundle.default",onClick:async()=>{await m(null),p({bundle:""})}},"Use inherited default")),n.createElement("p",{className:"a-caption"},"New conversations here use ",n.createElement("strong",null,_i(e,a.effective||((f=e.settings)==null?void 0:f.bundle)))," from ",{workspace:"workspace settings",app:"this Unified app",shared:"shared Amplifier settings"}[a.source]||"shared Amplifier settings",". Workspace settings take priority over this app, then shared settings. Existing conversations keep their selected bundles."),u==="workspace"&&a.workspaceInherited&&n.createElement("p",{className:"a-caption"},"Clearing this computer’s override inherits the project’s ",_i(e,a.workspaceInherited)," default."))}const ao={page:"home",serverId:"",toolName:"",repository:"",ref:"",path:"",extras:"",connection:{id:"",name:"",transport:"stdio",command:"",args:"",env:"",cwd:"",url:"",headers:"",auth:"environment",installationId:""},values:{},raw:!1,json:"{}"},jt=e=>["running","working","queued","pending","connecting","installing"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase)),eo=e=>{var t;return["failed","error","interrupted"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase))||!!(e!=null&&e.error)||((t=e==null?void 0:e.result)==null?void 0:t.isError)===!0},Za=e=>JSON.stringify(e,null,2),ai=e=>Array.isArray(e)?e:Object.values(e||{}),Pi=e=>e.replace(/[_.-]+/g," ").replace(/^./,t=>t.toUpperCase()),Ta=e=>(e==null?void 0:e.repository)||(e==null?void 0:e.repo)||(e==null?void 0:e.url)||"",TD=e=>jt(e)?"working":eo(e)?"error":"ready",ID={"smartTools.catalog":"Catalog refreshed","smartTools.inspect":"Source inspected","smartTools.install":"Installation complete","smartTools.configure":"Connection saved","smartTools.connect":"Connected","smartTools.disconnect":"Disconnected","smartTools.remove":"Connection removed","smartTools.call":"Tool finished","smartTools.open":"Opened in canvas","smartTools.reconnect":"Reconnected","smartTools.schemas":"Tool fields loaded","smartTools.discover":"Tool definitions found","smartTools.uninstall":"Package uninstalled","smartTools.authStart":"Sign-in started","smartTools.authCancel":"Sign-in cancelled","smartTools.authForget":"Local sign-in removed","smartTools.accountAccept":"Account change accepted; reconnect explicitly"};function AD({value:e}){return typeof e=="string"?n.createElement("p",null,e):!Array.isArray(e)||e.some(t=>typeof t!="string"&&typeof(t==null?void 0:t.name)!="string")?n.createElement("pre",null,Za(e)):n.createElement("ul",{className:"a-smart-setup-requirements"},e.map((t,a)=>typeof t=="string"?n.createElement("li",{key:a},t):n.createElement("li",{key:a},n.createElement("strong",null,t.name),t.optional&&n.createElement("small",null," · Optional"),typeof t.purpose=="string"&&n.createElement("p",null,t.purpose),typeof t.install=="string"&&(/^https?:\/\//.test(t.install)?n.createElement("a",{href:t.install,target:"_blank",rel:"noreferrer"},"Setup instructions",n.createElement(sa,null)):n.createElement("p",null,t.install)),Object.keys(t).some(r=>!["name","optional","purpose","install"].includes(r))&&n.createElement("details",null,n.createElement("summary",null,"More requirement details"),n.createElement("pre",null,Za(t))))))}function _D(e,t){var l;const a=(l=e.view)==null?void 0:l.smartToolsEditor,[r,o]=v.useState({...ao,...a}),i=v.useRef(r);return v.useLayoutEffect(()=>{a&&(i.current={...ao,...a},o(i.current))},[a]),[r,c=>{const u={...i.current,...c};i.current=u,o(u),t("view.update",{patch:{smartToolsEditor:u}})}]}function PD(e,t,a={}){return[...e].reverse().find(r=>r.action===t&&Object.entries(a).every(([o,i])=>{var l,c;const s=((l=r.target)==null?void 0:l[o])??((c=r.args)==null?void 0:c[o])??(o==="id"?r.serverId:o==="name"?r.tool||r.name:r[o]);return r.target||r.args?(s??"")===(i??""):s==null||s===i}))}function ga({operation:e,busyMessage:t}){var r;if(!e)return null;const a=e.error||((r=e.result)!=null&&r.isError?"The tool reported an error. See its result below.":jt(e)?t||"Working…":ID[e.action]||"Finished");return n.createElement(nt,{phase:TD(e),message:typeof a=="string"?a:Za(a),detail:e.status==="interrupted"?"The previous app run ended before this request finished. Review the tool state before retrying.":void 0})}function OD({operation:e}){if(!e||jt(e)||e.result==null)return null;const t=e.result,a=!!(t&&typeof t=="object"&&t.$resource),r=a?t.summary??t.preview??null:t,o=typeof r=="string"?r:r==null?"":Za(r);return n.createElement("div",{className:"a-smart-result"},n.createElement("h4",null,"Result"),o&&n.createElement("pre",{tabIndex:0},o.slice(0,24e3)),a?n.createElement("p",{className:"a-caption"},"The full result is saved",typeof t.bytes=="number"?` (${Math.ceil(t.bytes/1024).toLocaleString()} KB)`:"",". Ask your agent to inspect it or show the details you need."):o.length>24e3&&n.createElement("p",{className:"a-caption"},"Showing the first 24,000 characters. The full result is saved and available for your agent to inspect."))}function MD(e){const t=e.split(` `).map(r=>r.trim()).filter(Boolean),a={};for(const r of t){const o=/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*([A-Za-z_][A-Za-z0-9_]*)$/.exec(r);if(!o)throw new Error("Use CHILD_VARIABLE=APP_VARIABLE on each line. Enter variable names, not secret values.");if(Object.hasOwn(a,o[1]))throw new Error(`The variable ${o[1]} appears more than once.`);a[o[1]]=o[2]}return a}function zD(e){const t={};for(const a of e.split(` -`).map(r=>r.trim()).filter(Boolean)){const r=/^([A-Za-z][A-Za-z0-9-]*)\s*=\s*([A-Za-z_][A-Za-z0-9_]*)$/.exec(a);if(!r)throw new Error("Use HEADER_NAME=APP_VARIABLE, never credential values.");if(Object.keys(t).some(o=>o.toLowerCase()===r[1].toLowerCase()))throw new Error("Header names must be unique.");t[r[1]]=r[2]}return t}function _c(e,t,a,r){var i;if(a||!(e!=null&&e.properties)||e.oneOf||e.anyOf||e.$ref){const s=JSON.parse(r);if(!s||typeof s!="object"||Array.isArray(s))throw new Error("Tool arguments must be a JSON object.");return s}const o={};for(const[s,l]of Object.entries(e.properties)){let c=t[s]??(l.default==null?"":l.enum||typeof l.default=="object"?Za(l.default):String(l.default));if(c===""){if((i=e.required)!=null&&i.includes(s))throw new Error(`${l.title||Pi(s)} is required.`);continue}if(l.enum)c=JSON.parse(c);else if(l.type==="boolean")c=c==="true";else if(l.type==="integer"||l.type==="number"){if(c=Number(c),!Number.isFinite(c)||l.type==="integer"&&!Number.isInteger(c))throw new Error(`${l.title||Pi(s)} must be ${l.type==="integer"?"a whole number":"a number"}.`)}else(l.type==="object"||l.type==="array"||l.oneOf||l.anyOf||l.$ref||Array.isArray(l.type))&&(c=JSON.parse(c));o[s]=c}return o}function LD({schema:e,values:t,edit:a}){return Object.entries(e.properties||{}).map(([r,o])=>{var m,h;const i=`smart-tool-field-${r}`,s=o.title||Pi(r),l=(m=e.required)==null?void 0:m.includes(r),c=o.type==="object"||o.type==="array"||o.oneOf||o.anyOf||o.$ref||Array.isArray(o.type),u=o.default==null?"":o.enum||c?Za(o.default):String(o.default),d=t[r]??u,p={id:i,value:d,"data-action":"view.update",onChange:f=>a({...t,[r]:f.target.value}),"aria-describedby":o.description?i+"-hint":void 0};return n.createElement("div",{className:"a-smart-field",key:r},n.createElement("label",{htmlFor:i},s,l&&n.createElement("span",{className:"a-smart-required"},"Required")),o.enum?n.createElement("select",{...p},n.createElement("option",{value:""},l?"Choose…":"Tool default"),o.enum.map((f,g)=>n.createElement("option",{key:g,value:JSON.stringify(f)},typeof f=="string"?f:JSON.stringify(f)))):o.type==="boolean"?n.createElement("select",{...p},n.createElement("option",{value:""},l?"Choose…":"Tool default"),n.createElement("option",{value:"true"},"Yes"),n.createElement("option",{value:"false"},"No")):c?n.createElement("textarea",{...p,className:"a-json-editor",spellCheck:!1,placeholder:o.type==="array"?"[]":"{}"}):o.type==="number"||o.type==="integer"?n.createElement("input",{...p,type:"number",step:o.type==="integer"?"1":"any",min:o.minimum,max:o.maximum}):n.createElement("textarea",{...p,rows:2,placeholder:((h=o.examples)==null?void 0:h[0])==null?"":String(o.examples[0])}),o.description&&n.createElement("p",{id:i+"-hint",className:"a-caption"},o.description))})}function DD({state:e,act:t,simple:a=!1,navigateSettings:r}){var ft,Ce,gt,Et,vt,at,X,Re,ae,Le,Oe,et,st,It,xt,Ut,rt,Xe,$e,Nt,Zt,rn,In,yn,Fn,Gn,An,Jt,dn,ut,ve,ge,At,Ot,Kt,Q,Yt,En,qn,pn,wn,mn,_n,on,pt,mt;const[o,i]=_D(e,t),s=v.useRef(!1),[l,c]=v.useState(null),[u,d]=v.useState(""),[p,m]=v.useState(null),h=e.smartTools||{},f=ai(h.servers),g=ai(h.catalog),y=ai(h.installations).filter(V=>!V.supersededBy&&!V.stagedFrom),E=ai(h.operations),b=f.find(V=>V.id===o.serverId),S=ai(b==null?void 0:b.tools).filter(V=>{var we,Ge;return(((Ge=(we=V._meta)==null?void 0:we.ui)==null?void 0:Ge.visibility)||["model","app"]).includes("model")}),w=S.find(V=>V.name===o.toolName),N=w&&{...w,...(b==null?void 0:b.loadedSchemaRevision)===(b==null?void 0:b.catalogRevision)?(ft=b==null?void 0:b.loadedSchemas)==null?void 0:ft[o.toolName]:{}},x=!!(N!=null&&N.inputSchema)&&(b==null?void 0:b.catalogState)!=="stale",A=(V,we={})=>(l==null?void 0:l.action)===V?l:PD(E,V,we),C=async(V,we={})=>{d(""),c({action:V,status:"pending",target:we});try{const Ge=await t(V,we);if(!Ge||Ge.accepted===!1)throw new Error("The request could not be sent. Please try again.");return c(null),Ge}catch(Ge){return c({action:V,status:"failed",error:Ge.message,target:we}),null}},O=(V,we={})=>{d(""),c(null),i({page:V,catalogReview:!1,catalogInstalling:!1,returnPage:V==="source"&&o.page==="catalog"?"catalog":null,...we})},k={...ao.connection,...o.connection},T=V=>i({connection:{...k,...V}}),I=[...E].reverse().find(jt),F=jt(l)||E.some(V=>{var we,Ge,Dt;return jt(V)&&(o.page==="source"?((we=V.target)==null?void 0:we.repository)===o.repository.trim():o.page==="connection"?V.action==="smartTools.configure"&&(((Ge=V.target)==null?void 0:Ge.id)||"")===k.id:["server","tool"].includes(o.page)?((Dt=V.target)==null?void 0:Dt.id)===(b==null?void 0:b.id):!1)}),[z,U]=xa(e,t,"smart-tool-connections",f,V=>[V.name,V.command,V.status],"Filter connections"),[H,te,j]=xa(e,t,"smart-tool-catalog",g,V=>[V.name,V.id,V.description,Ta(V)],a?"Search tools":"Filter catalog",{simple:a}),[_,P]=xa(e,t,"smart-tool-actions-"+((b==null?void 0:b.id)||""),S,V=>[V.name,V.title,V.description],"Filter tools"),G=A("smartTools.installBatch"),W=jt(G),D=V=>y.some(we=>Ta(we).replace(/\.git$/,"")===Ta(V).replace(/\.git$/,"")&&(we.path||".")===(V.path||".")),ne=o.catalogSelection||[],q=g.filter(V=>ne.includes(V.id)&&!D(V)),Z=Math.max(1,Math.min(o.catalogPage||1,Math.ceil(H.length/40)||1)),ie=H.length>50,ke=ie?H.slice((Z-1)*40,Z*40):H,me=g.find(V=>V.id===o.catalogId)||ke[0],_e=(V,we)=>i({catalogSelection:we?[...new Set([...ne,V])]:ne.filter(Ge=>Ge!==V)}),Je=V=>i({catalogSelection:[...new Set([...ne,...V.filter(we=>!D(we)).map(we=>we.id)])]});v.useEffect(()=>{i({catalogPage:1})},[j]);const De=o.page==="tool"?"server":"home",ue=V=>O("connection",{connection:V?{id:V.id,name:V.name,command:V.command,args:(V.args||[]).join(` -`),env:Object.entries(V.env||{}).map(([we,Ge])=>we+"="+Ge).join(` -`),cwd:V.cwd||"",transport:V.transport||"stdio",url:V.url||"",headers:Object.entries(V.headers||{}).map(([we,Ge])=>we+"="+Ge).join(` -`),auth:V.auth||"environment",installationId:V.installationId||""}:ao.connection}),ye=()=>({repository:o.repository.trim(),...o.ref.trim()?{ref:o.ref.trim()}:{},...o.path.trim()?{path:o.path.trim()}:{}}),M={repository:o.repository.trim(),ref:o.ref.trim(),path:o.path.trim()},Y=A("smartTools.inspect",M),se=A("smartTools.install",M),Fe=JSON.stringify(M),je=Wc(Fe,Y==null?void 0:Y.result,jt(Y)||eo(Y)),oe=y.find(V=>Ta(V)===o.repository.trim()&&(V.path||".")===(o.path||".")),Ze=!jt(se)&&!eo(se)&&(se==null?void 0:se.result)||oe,it=A("smartTools.call",{id:b==null?void 0:b.id,name:N==null?void 0:N.name,sessionId:e.selectedSessionId}),zt=Wc(JSON.stringify([e.selectedSessionId,b==null?void 0:b.id,N==null?void 0:N.name]),it,jt(it)||eo(it)),ct=[...E].reverse().find(V=>{var we,Ge,Dt;return V.action==="smartTools.call"&&V.status==="completed"&&((we=V.target)==null?void 0:we.id)===(b==null?void 0:b.id)&&((Ge=V.target)==null?void 0:Ge.name)===(N==null?void 0:N.name)&&((Dt=V.target)==null?void 0:Dt.sessionId)===e.selectedSessionId}),qt=async()=>{const V=e.selectedSessionId,we=await C("smartTools.open",{id:b.id,tool:N.name,...V?{sessionId:V}:{},...ct?{operationId:ct.id}:{}});we!=null&&we.operationId&&m({id:we.operationId,sessionId:V,serverId:b.id,toolName:N.name})};v.useEffect(()=>{var we;if(!p)return;const V=E.find(Ge=>Ge.id===p.id);!V||jt(V)||(V.status==="completed"&&e.selectedSessionId===p.sessionId&&((we=e.view)==null?void 0:we.panel)==="settings"&&o.page==="tool"&&o.serverId===p.serverId&&o.toolName===p.toolName&&t("view.update",{patch:{panel:null}}),m(null))},[p,E,e.selectedSessionId,(Ce=e.view)==null?void 0:Ce.panel,o.page,o.serverId,o.toolName]),v.useEffect(()=>{var V,we;!a||s.current||(s.current=!0,(we=(V=e.view)==null?void 0:V.smartToolsEditor)!=null&&we.page||(O("home"),g.length||C("smartTools.catalog")))},[a]);const le=()=>(i({catalogReview:!1,catalogInstalling:!0}),C("smartTools.installBatch",{ids:q.map(V=>V.id),extrasById:Object.fromEntries(q.map(V=>{var we;return[V.id,(((we=o.catalogExtras)==null?void 0:we[V.id])||"").split(",").map(Ge=>Ge.trim()).filter(Boolean)]}))})),fe=V=>O("setup",{setupInstructions:!1,repository:Ta(V),ref:V.ref||"",path:V.path||"",extras:(V.extras||[]).join(", ")}),xe=(N==null?void 0:N.inputSchema)||{type:"object",properties:{}},ze=!xe.properties||!!(xe.oneOf||xe.anyOf||xe.$ref),Ye=["smartTools.configure","smartTools.connect","smartTools.reconnect","smartTools.disconnect","smartTools.remove","smartTools.authForget","smartTools.accountAccept"].map(V=>A(V,{id:b==null?void 0:b.id})).filter(Boolean).sort((V,we)=>(we.updatedAt||we.createdAt||1/0)-(V.updatedAt||V.createdAt||1/0))[0],ht=v.useRef(null),bt=o.catalogReview?"review":o.catalogInstalling||W?"install":"browse";return v.useLayoutEffect(()=>{var V,we;o.page==="catalog"&&bt!=="browse"&&((V=ht.current)==null||V.focus(),(we=ht.current)==null||we.scrollIntoView({block:"start"}))},[bt,o.page]),n.createElement("section",{className:"a-settings-section a-smart-tools","data-part":"smart-tools-settings","data-simple":a},o.page!=="home"&&(!a||!["catalog"].includes(o.page))&&n.createElement("button",{type:"button",className:"a-link a-smart-back","data-action":"view.update",onClick:()=>O(De)},n.createElement(Sa,null),"Back to ",De==="server"?(b==null?void 0:b.name)||"connection":"Smart Tools"),u&&n.createElement(nt,{phase:"error",message:u}),a?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Add tools that help Amplifier do more of your work."),n.createElement("div",{className:"a-tool-browse-tabs"},n.createElement("button",{className:"a-soft",disabled:W,"aria-pressed":o.page==="home","data-action":"view.update",onClick:()=>O("home")},"Installed"),n.createElement("button",{className:"a-soft",disabled:W,"aria-pressed":o.page==="catalog","data-action":"smartTools.catalog",onClick:()=>{O("catalog"),g.length||C("smartTools.catalog")}},"Tool catalog"),n.createElement("button",{className:"a-link",disabled:W,"data-action":"view.update",onClick:()=>O("source",{repository:"",ref:"",path:"",extras:""})},"Add from GitHub URL"))):n.createElement("div",{className:"a-collection-toolbar"},n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>O("home")},"Installed & connected"),n.createElement("button",{className:"a-soft","data-action":"smartTools.catalog",onClick:()=>{O("catalog"),g.length||C("smartTools.catalog")}},n.createElement(vr,null),"Tool catalog"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>O("source")},n.createElement(wa,null),"Add from Git"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>ue()},n.createElement(Ln,null),"Add MCP connection")),o.page==="catalog"&&n.createElement(Xt,{className:a?"a-tool-catalog-simple":void 0,name:"smart-tool-catalog",busy:jt(A("smartTools.catalog"))},bt==="review"&&n.createElement("section",{className:"a-tool-batch-review","aria-label":"Review installation"},n.createElement("h4",{ref:ht,tabIndex:-1},"Install ",q.length," tools?"),n.createElement("p",null,"Installation adds the packages. Accounts and permissions are connected separately."),n.createElement("ul",null,q.map(V=>n.createElement("li",{key:V.id},V.name||V.id))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"smartTools.installBatch",disabled:W||!q.length,onClick:le},"Install selected (",q.length,")"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:W,onClick:()=>i({catalogReview:!1})},"Cancel"))),bt==="install"&&n.createElement("section",{"aria-label":"Catalog installation results"},n.createElement("h4",{ref:ht,tabIndex:-1},W?"Installing your tools…":eo(G)?"Some tools need attention":"Installation complete"),n.createElement(ga,{operation:G,busyMessage:"Installing selected packages…"}),n.createElement("ul",{className:"a-catalog-results"},((G==null?void 0:G.items)||[]).map(V=>n.createElement("li",{key:V.id},n.createElement("strong",null,V.name)," · ",V.status,n.createElement("small",null,V.error),V.status==="completed"&&n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>fe(V.source)},"Finish setup")))),!W&&((gt=G==null?void 0:G.items)==null?void 0:gt.some(V=>V.status!=="completed"))&&n.createElement("button",{className:"a-soft","data-action":"smartTools.installBatch",onClick:()=>C("smartTools.installBatch",{retryOperationId:G.id})},"Retry unfinished installations"),!W&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",onClick:()=>O("home")},"View installed tools"),n.createElement("button",{className:"a-soft",onClick:()=>O("catalog")},"Back to catalog"))),bt==="browse"?n.createElement(n.Fragment,null,n.createElement("div",{className:"a-catalog-controls"},n.createElement("div",{className:"a-smart-heading"},!a&&n.createElement("h4",null,"Smart Tools catalog"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Refresh Smart Tools catalog","data-action":"smartTools.catalog",disabled:jt(A("smartTools.catalog")),onClick:()=>C("smartTools.catalog")},n.createElement(Mt,null))),!a&&n.createElement("p",null,"Select tools to install together. Each package keeps its own installation result and setup steps."),(!a||jt(A("smartTools.catalog"))||eo(A("smartTools.catalog")))&&n.createElement(ga,{operation:A("smartTools.catalog"),busyMessage:"Loading the catalog…"}),te,n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,a?ie?`${(Z-1)*40+1}–${Math.min(Z*40,H.length)} of ${H.length} tools`:`${H.length===g.length?"All ":""}${H.length} tools`:`${q.length} selected across the catalog`),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>Je(ke)},"Select ",ie?"page":a?"all available":"matching"),ie&&n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>Je(H)},"Select all matching"),(!a||ne.length>0)&&n.createElement("button",{className:"a-link",disabled:!ne.length,"data-action":"view.update",onClick:()=>i({catalogSelection:[]})},"Clear selection"))),(a||q.length>0||W)&&n.createElement(Rn,null,n.createElement("span",{className:"a-catalog-selection-summary"},q.length," selected",q.some(V=>!ke.includes(V))&&n.createElement("small",null,q.filter(V=>!ke.includes(V)).length," outside this view")),n.createElement("button",{className:"a-primary",disabled:!q.length||W,"data-action":"smartTools.installBatch",onClick:()=>i({catalogReview:!0})},n.createElement(wa,null),"Review & install")),n.createElement(Co,{label:"catalog",detailOpen:!!o.catalogDetail,onBack:()=>i({catalogDetail:!1}),list:a?ke.map(V=>n.createElement("div",{className:"a-tool-catalog-row",key:V.id},n.createElement("input",{type:"checkbox",id:"select-tool-"+V.id,"aria-label":"Select "+(V.name||V.id),checked:ne.includes(V.id),disabled:D(V),"data-action":"view.update",onChange:we=>_e(V.id,we.target.checked)}),n.createElement("label",{htmlFor:"select-tool-"+V.id},n.createElement("strong",null,V.name||V.id),n.createElement("small",null,V.description||"Open details to learn more."),D(V)&&n.createElement("span",{className:"a-count"},"Installed")),n.createElement("button",{className:"a-icon","aria-label":"Details for "+(V.name||V.id),"data-action":"view.update",onClick:()=>i({catalogId:V.id,catalogDetail:!0})},n.createElement(en,null)))):ke.map(V=>n.createElement(Va,{key:V.id,id:V.id,label:V.name||V.id,description:V.description||Ta(V),badge:D(V)?"Installed":void 0,checked:ne.includes(V.id),disabled:D(V),onCheck:we=>_e(V.id,we),selected:!a&&V.id===(me==null?void 0:me.id),onSelect:()=>i({catalogId:V.id,catalogDetail:!0})}))},me?n.createElement(n.Fragment,null,n.createElement("h4",null,me.name||me.id),n.createElement("p",null,me.description),n.createElement("details",{className:"a-everyday-disclosure",open:!a||void 0},n.createElement("summary",null,"Source & installation options"),n.createElement("div",null,n.createElement("p",{className:"a-caption a-wrap"},Ta(me)),n.createElement("dl",null,n.createElement("dt",null,"Version"),n.createElement("dd",null,me.version||((Et=me.manifest)==null?void 0:Et.version)||"See manifest"),n.createElement("dt",null,"Branch or revision"),n.createElement("dd",null,me.ref||"Repository default")),((vt=me.manifest)==null?void 0:vt.requires)&&n.createElement(n.Fragment,null,n.createElement("h5",null,"Requirements from the tool author"),n.createElement("pre",{className:"a-wrap"},typeof me.manifest.requires=="string"?me.manifest.requires:Za(me.manifest.requires))),n.createElement("label",{htmlFor:"catalog-package-extras"},"Optional package extras"),n.createElement("input",{id:"catalog-package-extras",value:((at=o.catalogExtras)==null?void 0:at[me.id])||"",placeholder:"For example, mcp","data-action":"view.update",onChange:V=>i({catalogExtras:{...o.catalogExtras,[me.id]:V.target.value}})}),n.createElement("p",{className:"a-caption"},"Comma-separated extras from this tool’s instructions. Applied only to this selected package."))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:D(me),"data-action":"view.update",onClick:()=>_e(me.id,!ne.includes(me.id))},D(me)?"Installed":ne.includes(me.id)?"Deselect tool":"Select for installation"),n.createElement("button",{className:"a-link","data-action":"smartTools.inspect",onClick:()=>{O("source",{returnPage:"catalog",repository:Ta(me),ref:me.ref||"",path:me.path||"",extras:""}),C("smartTools.inspect",{repository:Ta(me),...me.ref?{ref:me.ref}:{},...me.path?{path:me.path}:{}})}},"Inspect source and setup")),n.createElement("p",{className:"a-caption"},"Installing a package does not connect an account or grant access. Some tools need advanced setup before they can be used.")):n.createElement("p",null,"No matching catalog items.")),ie&&n.createElement("div",{className:"a-catalog-pages"},n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:Z===1,onClick:()=>i({catalogPage:Z-1,catalogDetail:!1})},"Previous"),n.createElement("span",null,(Z-1)*40+1,"–",Math.min(Z*40,H.length)," of ",H.length),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:Z*40>=H.length,onClick:()=>i({catalogPage:Z+1,catalogDetail:!1})},"Next")),!g.length&&!jt(A("smartTools.catalog"))&&n.createElement("p",{className:"a-smart-empty"},"The catalog has not loaded yet. Refresh to try again, or add a tool from a Git URL.")):null),a&&o.page==="home"&&n.createElement("section",{className:"a-installed-tools","aria-label":"Installed tools"},!y.length&&!f.length?n.createElement("div",{className:"a-ai-welcome"},n.createElement(zk,{"aria-hidden":"true"}),n.createElement("h4",null,"No tools installed yet"),n.createElement("p",null,"Find tools for your work in the catalog, or add one using its GitHub URL."),n.createElement("button",{className:"a-primary",onClick:()=>{O("catalog"),g.length||C("smartTools.catalog")}},"Explore tool catalog")):n.createElement(n.Fragment,null,!!y.length&&n.createElement("div",{className:"a-everyday-list"},y.map((V,we)=>{var Ge;return n.createElement(Va,{key:V.id||we,id:V.id||String(we),label:V.name||((Ge=V.manifest)==null?void 0:Ge.name)||Ta(V),description:f.some(Dt=>Dt.installationId===V.id)?"Installed · connection configured":"Installed · finish setup",onSelect:()=>fe(V)})})),!!f.length&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Connected services"),f.length>6&&U,n.createElement("div",{className:"a-everyday-list"},z.map(V=>n.createElement(Va,{key:V.id,id:V.id,label:V.name,description:V.connectionState||(V.error?"Needs attention":V.status||"Not connected"),onSelect:()=>O("server",{serverId:V.id})})))))),o.page!=="catalog"&&!(a&&o.page==="home")&&n.createElement(Co,{label:"configurations",detailOpen:o.page!=="home",onBack:()=>O("home"),list:n.createElement(n.Fragment,null,f.length>6&&U,f.length>0&&n.createElement("div",{className:"a-smart-heading"},n.createElement("h4",null,"Connections"),n.createElement("small",null,f.filter(V=>["ready","connected"].includes(V.status)).length," ready · ",f.length," configured")),z.map(V=>{var we,Ge;return n.createElement(Va,{key:V.id,id:V.id,label:V.name,description:(V.connectionState||(V.error?"Needs attention":V.status||"Not connected"))+((we=V.tools)!=null&&we.length?` · ${V.tools.length} tools`:"")+(V.uiCapable||(Ge=V.tools)!=null&&Ge.some(Dt=>{var kn,sn;return(sn=(kn=Dt._meta)==null?void 0:kn.ui)==null?void 0:sn.resourceUri})?" · Canvas views":""),selected:V.id===(b==null?void 0:b.id),onSelect:()=>O("server",{serverId:V.id})})}),n.createElement("div",{className:"a-smart-heading"},n.createElement("h4",null,a?"Installed tools":"Installed packages"),n.createElement("small",null,y.length)),y.map((V,we)=>{var Ge,Dt;return n.createElement(Va,{key:V.id||we,id:V.id||String(we),label:V.name||((Ge=V.manifest)==null?void 0:Ge.name)||Ta(V),description:a?f.some(kn=>kn.installationId===V.id)?"Installed · connection configured":"Installed · finish setup":V.version||((Dt=V.commit)==null?void 0:Dt.slice(0,8))||"Installed",selected:o.page==="source"&&Ta(V)===o.repository,onSelect:()=>fe(V)})}),!f.length&&!y.length&&n.createElement("div",{className:"a-smart-empty"},n.createElement("h4",null,"No tools installed yet"),n.createElement("p",null,"Choose a tool from the catalog, add a GitHub URL, or connect an MCP service.")))},o.page==="home"&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Your Smart Tools"),n.createElement("p",null,"Choose a connection to browse its tools, run a tool, or open its interactive view. Installed packages have their own setup details."),I&&n.createElement(ga,{operation:I}),n.createElement(ga,{operation:A("smartTools.remove")})),o.page==="setup"&&n.createElement(n.Fragment,null,n.createElement("h4",null,(oe==null?void 0:oe.name)||((X=oe==null?void 0:oe.manifest)==null?void 0:X.name)||"Finish setup"),n.createElement("p",null,"The package is installed. A connection and any required account access are separate."),f.filter(V=>V.installationId===(oe==null?void 0:oe.id)&&!!(oe!=null&&oe.id)).map(V=>n.createElement("button",{key:V.id,className:"a-soft","data-action":"view.update",onClick:()=>O("server",{serverId:V.id})},"Open ",V.name)),!o.setupInstructions&&!f.some(V=>V.installationId===(oe==null?void 0:oe.id)&&!!(oe!=null&&oe.id))&&n.createElement("div",{className:"a-ai-hint"},n.createElement("strong",null,"Advanced setup required"),n.createElement("p",null,"This tool does not provide a guided connection setup. Use its documented connection details before using it."),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i({setupInstructions:!0})},"Open setup instructions")),o.setupInstructions&&n.createElement("section",{className:"a-smart-setup-instructions","aria-label":"Setup instructions"},n.createElement("h4",null,"Set up ",(oe==null?void 0:oe.name)||((Re=oe==null?void 0:oe.manifest)==null?void 0:Re.name)||"this tool"),n.createElement("p",null,oe!=null&&oe.guidance&&typeof oe.guidance=="string"?oe.guidance:(oe==null?void 0:oe.nextStep)||"Follow the tool author’s instructions to connect the installed package."),/^https?:\/\//.test(o.repository)&&n.createElement("p",null,n.createElement("a",{href:o.repository,target:"_blank",rel:"noreferrer"},"Open the tool’s documentation",n.createElement(sa,null))),(oe==null?void 0:oe.binDir)&&n.createElement(n.Fragment,null,n.createElement("p",null,"Installed executables"),n.createElement("code",{className:"a-smart-path"},oe.binDir)),((ae=oe==null?void 0:oe.manifest)==null?void 0:ae.requires)&&n.createElement(n.Fragment,null,n.createElement("h5",null,"Requirements from the tool author"),n.createElement(AD,{value:oe.manifest.requires})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"view.update",onClick:()=>{var V;return O("connection",{connection:{...ao.connection,name:(oe==null?void 0:oe.name)||((V=oe==null?void 0:oe.manifest)==null?void 0:V.name)||"",installationId:(oe==null?void 0:oe.id)||""}})}},"Configure MCP connection"),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>O("source")},"Source & installation options"))),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Installation details"),n.createElement("div",null,n.createElement("p",null,oe==null?void 0:oe.description),n.createElement("code",{className:"a-wrap"},o.repository),n.createElement("p",{className:"a-caption"},oe==null?void 0:oe.nextStep)))),o.page==="source"&&n.createElement(n.Fragment,null,n.createElement("h4",null,oe?`Set up ${oe.name||((Le=oe.manifest)==null?void 0:Le.name)||"tool"}`:a?"Add from GitHub URL":"Add from Git"),n.createElement("p",null,oe?"Review the installed tool’s instructions and configure its connection below.":a?"Paste the repository link for a Smart Tool. Review its details before installing.":"Inspect the tool’s manifest and source revision, then install the Python package into its own environment."),n.createElement("label",{htmlFor:"smart-tool-repository"},"Repository URL"),n.createElement("input",{id:"smart-tool-repository",type:"url",value:o.repository,placeholder:"https://github.com/owner/tool","data-action":"view.update",onChange:V=>i({repository:V.target.value})}),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Branch & folder options"),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"smart-tool-ref"},"Branch, tag or commit (optional)"),n.createElement("input",{id:"smart-tool-ref",value:o.ref,placeholder:"Repository default","data-action":"view.update",onChange:V=>i({ref:V.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"smart-tool-path"},"Package folder (optional)"),n.createElement("input",{id:"smart-tool-path",value:o.path,placeholder:"Repository root","data-action":"view.update",onChange:V=>i({path:V.target.value})})))),n.createElement(Xt,{name:"smart-tool-inspection",busy:jt(Y)},n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-operation-pending":jt(Y)||void 0,"aria-busy":jt(Y)||void 0,"data-action":"smartTools.inspect",disabled:!o.repository.trim()||F,onClick:()=>C("smartTools.inspect",ye())},n.createElement(Mt,null),"Inspect source")),n.createElement(ga,{operation:Y,busyMessage:"Reading the tool manifest…"}),je&&n.createElement("div",{className:"a-smart-source-summary"},n.createElement("strong",null,je.name||((Oe=je.manifest)==null?void 0:Oe.name)||((et=je.metadata)==null?void 0:et.name)||"Tool source"),n.createElement("p",null,je.description||((st=je.manifest)==null?void 0:st.description)||((It=je.metadata)==null?void 0:It.description)),n.createElement("dl",null,n.createElement("div",null,n.createElement("dt",null,"Revision"),n.createElement("dd",null,n.createElement("code",null,((xt=je.commit)==null?void 0:xt.slice(0,12))||je.revision||o.ref||"Default branch"))),je.version||(Ut=je.manifest)!=null&&Ut.version?n.createElement("div",null,n.createElement("dt",null,"Version"),n.createElement("dd",null,je.version||((rt=je.manifest)==null?void 0:rt.version))):null),(((Xe=je.manifest)==null?void 0:Xe.requires)||je.requires)&&n.createElement("div",{className:"a-smart-requirements"},n.createElement("h5",null,"Requirements from the tool author"),n.createElement("pre",null,typeof((($e=je.manifest)==null?void 0:$e.requires)||je.requires)=="string"?((Nt=je.manifest)==null?void 0:Nt.requires)||je.requires:Za(((Zt=je.manifest)==null?void 0:Zt.requires)||je.requires))))),n.createElement(Xt,{name:"smart-tool-installation",busy:jt(se)},n.createElement("label",{htmlFor:"smart-tool-extras"},"Optional package extras"),n.createElement("input",{id:"smart-tool-extras",value:o.extras,placeholder:"For example, mcp","data-action":"view.update",onChange:V=>i({extras:V.target.value})}),n.createElement("p",{className:"a-caption"},"Use extras documented by the tool author, separated by commas. An MCP adapter may be an optional extra."),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary","data-operation-pending":jt(se)||void 0,"aria-busy":jt(se)||void 0,"data-action":"smartTools.install",disabled:!o.repository.trim()||F,onClick:()=>C("smartTools.install",{...ye(),...o.extras.trim()?{extras:o.extras.split(",").map(V=>V.trim()).filter(Boolean)}:{}})},n.createElement(wa,null),oe?"Install source revision":"Install package")),n.createElement(ga,{operation:se,busyMessage:"Installing the package in its own environment…"}),(Ze==null?void 0:Ze.previousInstallationId)&&n.createElement("button",{type:"button",className:"a-soft","data-action":"updates.smartToolRollback",onClick:()=>t("updates.smartToolRollback",{id:Ze.id})},"Restore previous version"),Ze&&n.createElement("div",{className:"a-smart-source-summary"},n.createElement("strong",null,n.createElement(Pt,null),"Package installed"),Ze.binDir&&n.createElement(n.Fragment,null,n.createElement("p",null,"Executables are available in:"),n.createElement("code",{className:"a-smart-path"},Ze.binDir)),Ze.guidance&&n.createElement("p",null,typeof Ze.guidance=="string"?Ze.guidance:Za(Ze.guidance)),n.createElement("p",null,Ze.nextStep||"Use the tool’s documented MCP executable and arguments to add a connection."),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>{var V;ue(),i({connection:{...ao.connection,name:Ze.name||((V=Ze.manifest)==null?void 0:V.name)||"",command:"",installationId:Ze.id}})}},n.createElement(cm,null),"Configure MCP connection",n.createElement(Dr,null)),n.createElement("button",{type:"button",className:"a-link a-danger","data-action":"smartTools.uninstall",disabled:F,onClick:()=>C("smartTools.uninstall",{id:Ze.id})},n.createElement(ea,null),"Uninstall package"),n.createElement("p",{className:"a-caption"},"Remove dependent connections first. This deletes the app-managed package folder; work stored elsewhere is kept."),n.createElement(ga,{operation:A("smartTools.uninstall",{id:Ze.id})})))),o.page==="connection"&&n.createElement("form",{id:"smart-connection-form",onSubmit:async V=>{V.preventDefault();try{await C("smartTools.configure",{...k.id?{id:k.id}:{},name:k.name.trim(),transport:k.transport,...k.installationId?{installationId:k.installationId}:{},...k.transport==="stdio"?{command:k.command.trim(),args:k.args.split(` -`).map(we=>we.trim()).filter(Boolean),env:MD(k.env),...k.cwd.trim()?{cwd:k.cwd.trim()}:{}}:{url:k.url.trim(),auth:k.auth,headers:k.auth==="oauth"?{}:zD(k.headers)}})}catch(we){d(we.message)}}},n.createElement("h4",null,k.id?"Edit connection":"Add MCP connection"),n.createElement("p",null,"Save a connection, then connect when you are ready. Saving does not contact the server."),n.createElement("label",{htmlFor:"smart-tool-connection-name"},"Display name"),n.createElement("input",{id:"smart-tool-connection-name",required:!0,value:k.name,placeholder:"My Smart Tool","data-action":"view.update",onChange:V=>T({name:V.target.value})}),n.createElement("label",{htmlFor:"smart-tool-transport"},"Connection type"),n.createElement("select",{id:"smart-tool-transport",value:k.transport,"data-action":"view.update",onChange:V=>T({transport:V.target.value})},n.createElement("option",{value:"stdio"},"Local executable"),n.createElement("option",{value:"streamable-http"},"Remote MCP endpoint")),k.transport==="stdio"?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-command"},"Executable"),n.createElement("input",{id:"smart-tool-command",required:!0,value:k.command,placeholder:"/path/to/environment/bin/tool-mcp",spellCheck:!1,"data-action":"view.update",onChange:V=>T({command:V.target.value})}),n.createElement("label",{htmlFor:"smart-tool-arguments"},"Arguments — one per line"),n.createElement("textarea",{id:"smart-tool-arguments",value:k.args,spellCheck:!1,"data-action":"view.update",onChange:V=>T({args:V.target.value})}),n.createElement("p",{className:"a-caption"},"Each line is one argument. Shell commands are not evaluated."),n.createElement("label",{htmlFor:"smart-tool-cwd"},"Working folder (optional)"),n.createElement(Ma,{id:"smart-tool-cwd",value:k.cwd,onChange:V=>T({cwd:V}),directory:!0,state:e,act:t}),n.createElement("label",{htmlFor:"smart-tool-environment"},"Environment variable references (optional)"),n.createElement("textarea",{id:"smart-tool-environment",value:k.env,spellCheck:!1,placeholder:"TOOL_API_KEY=MY_TOOL_API_KEY","data-action":"view.update",onChange:V=>T({env:V.target.value})}),n.createElement("p",{className:"a-caption"},"Use CHILD_VARIABLE=APP_VARIABLE. Enter names, never key values.")):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-url"},"MCP endpoint"),n.createElement("input",{id:"smart-tool-url",type:"url",required:!0,value:k.url,placeholder:"https://example.com/mcp","data-action":"view.update",onChange:V=>T({url:V.target.value})}),n.createElement("label",{htmlFor:"smart-tool-auth"},"Authorization"),n.createElement("select",{id:"smart-tool-auth",value:k.auth,"data-action":"view.update",onChange:V=>T({auth:V.target.value})},n.createElement("option",{value:"environment"},"Header references or no authentication"),n.createElement("option",{value:"oauth"},"Browser sign-in (OAuth)")),k.auth==="environment"?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-headers"},"Header references (optional)"),n.createElement("textarea",{id:"smart-tool-headers",value:k.headers,placeholder:"Authorization=MY_TOOL_AUTHORIZATION","data-action":"view.update",onChange:V=>T({headers:V.target.value})}),n.createElement("p",{className:"a-caption"},"Use HEADER_NAME=APP_VARIABLE. The variable must contain the complete header value, such as a Bearer token. Never paste credentials here.")):n.createElement("p",{className:"a-caption"},"The server must support MCP OAuth discovery. Start sign-in after saving, then review the provider’s consent page.")),n.createElement(ga,{operation:A("smartTools.configure"),busyMessage:"Saving the connection…"}),n.createElement(Rn,null,n.createElement("button",{type:"submit",form:"smart-connection-form",className:"a-primary","data-action":"smartTools.configure",disabled:!k.name.trim()||!(k.transport==="stdio"?k.command:k.url).trim()||F},n.createElement(Pt,null),"Save connection"),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>O("home")},"View connections",n.createElement(Dr,null)))),(o.page==="server"||o.page==="tool")&&!b&&n.createElement(nt,{phase:"neutral",message:"This connection is no longer configured."}),o.page==="server"&&b&&n.createElement(Xt,{name:"smart-tool-connection-"+b.id,busy:jt(Ye)},n.createElement("div",{className:"a-smart-heading"},n.createElement("div",null,n.createElement("h4",null,b.name),n.createElement("p",null,b.connectionState||b.status||"Not connected"," · ",S.length," tools")),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Edit "+b.name,"data-action":"view.update",onClick:()=>ue(b)},n.createElement(ux,null))),n.createElement("div",{className:"a-smart-source-summary","data-part":"connector-account"},n.createElement("p",null,"Account identity: ",["verified","accepted"].includes((rn=b.account)==null?void 0:rn.status)?b.account.displayName||b.account.subject:((In=b.account)==null?void 0:In.status)==="changed"?"Changed — review required":((yn=b.account)==null?void 0:yn.status)==="unconfirmed"?"Unconfirmed — reconnect is blocked":"Unknown — the server has not supplied supported account details."),((Fn=b.account)==null?void 0:Fn.subject)&&n.createElement("p",{className:"a-caption"},b.account.issuer," · ",b.account.subject),((Gn=b.account)==null?void 0:Gn.provenance)&&n.createElement("p",{className:"a-caption"},"Server-attested through authenticated transport. This is not independent identity verification. Last observed: ",new Date(b.account.observedAt*1e3).toLocaleString(),"."),((An=b.account)==null?void 0:An.detail)&&n.createElement("p",null,b.account.detail),((Jt=b.account)==null?void 0:Jt.status)==="changed"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Previously accepted: ",b.account.expected.issuer," · ",b.account.expected.subject),n.createElement("p",null,"Reported now: ",b.account.candidate.displayName||b.account.candidate.subject," · ",b.account.candidate.issuer," · ",b.account.candidate.subject),n.createElement("p",{className:"a-caption"},"The connector attests this identity through its authenticated transport. Accepting saves this account choice; it does not reconnect or call a tool."),n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.accountAccept",disabled:F,onClick:()=>C("smartTools.accountAccept",{id:b.id,expectedRevision:b.account.revision,issuer:b.account.candidate.issuer,subject:b.account.candidate.subject})},"Accept this account change"))),((ut=(dn=b.authorization)==null?void 0:dn.requestedScopes)==null?void 0:ut.length)>0&&n.createElement("p",{className:"a-caption"},"Requested access: ",b.authorization.requestedScopes.join(", ")),n.createElement("p",{className:"a-caption"},"Granted access: ",((ge=(ve=b.authorization)==null?void 0:ve.grantedScopes)==null?void 0:ge.join(", "))||"Not reported"," · Consent: ",((At=b.authorization)==null?void 0:At.consent)||"Unknown"),b.auth==="oauth"&&n.createElement("div",{className:"a-smart-source-summary"},n.createElement("p",null,"Sign-in: ",((Ot=b.login)==null?void 0:Ot.phase)||"Not started"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.authStart",disabled:["starting","waiting"].includes((Kt=b.login)==null?void 0:Kt.phase),onClick:()=>C("smartTools.authStart",{id:b.id,redirectOrigin:window.location.origin})},"Sign in"),((Q=b.login)==null?void 0:Q.url)&&n.createElement("a",{className:"a-soft",href:b.login.url,target:"_blank",rel:"noopener noreferrer"},"Review access and authorize"),["starting","waiting"].includes((Yt=b.login)==null?void 0:Yt.phase)&&n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.authCancel",onClick:()=>C("smartTools.authCancel",{id:b.id})},"Cancel sign-in"),n.createElement("button",{type:"button",className:"a-link a-danger","data-action":"smartTools.authForget",onClick:()=>C("smartTools.authForget",{id:b.id})},"Forget local sign-in")),((qn=(En=b.login)==null?void 0:En.requestedScopes)==null?void 0:qn.length)>0&&b.login.requestedScopes.join(" ")!==((wn=(pn=b.authorization)==null?void 0:pn.requestedScopes)==null?void 0:wn.join(" "))&&n.createElement("p",null,"Requested access: ",b.login.requestedScopes.join(", ")),((mn=b.login)==null?void 0:mn.error)&&n.createElement(nt,{phase:"error",message:b.login.error}),n.createElement("p",{className:"a-caption"},"You complete consent with the provider. Forgetting sign-in removes local credentials; revoke remote access in your provider’s account settings.")),b.error&&n.createElement(nt,{phase:"error",message:b.error}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","aria-busy":jt(A("smartTools.connect",{id:b.id}))||void 0,"data-action":"smartTools.connect",disabled:F||["connected","ready"].includes(b.status),onClick:()=>C("smartTools.connect",{id:b.id})},n.createElement(cm,null),b.status==="connected"||b.status==="ready"?"Connected":"Connect"),n.createElement("button",{type:"button",className:"a-soft","aria-busy":jt(A("smartTools.disconnect",{id:b.id}))||void 0,"data-action":"smartTools.disconnect",disabled:F||!["connected","ready"].includes(b.status),onClick:()=>C("smartTools.disconnect",{id:b.id})},n.createElement(yx,null),"Disconnect"),n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.reconnect",disabled:F||["starting","waiting"].includes((_n=b.login)==null?void 0:_n.phase),onClick:()=>C("smartTools.reconnect",{id:b.id})},n.createElement(Mt,null),"Reconnect")),n.createElement(ga,{operation:Ye,busyMessage:"Updating the connection…"}),b.catalogState==="stale"&&n.createElement(nt,{phase:"neutral",message:"Tool definitions need a refresh before another call."}),n.createElement("button",{type:"button",className:"a-link","data-action":"smartTools.discover",disabled:F||!["connected","ready"].includes(b.status),onClick:()=>C("smartTools.discover",{id:b.id,refresh:!0})},"Refresh tool definitions"),n.createElement(ga,{operation:A("smartTools.discover",{id:b.id})}),S.length>4&&P,n.createElement("div",{className:"a-smart-list"},_.map(V=>{var we,Ge,Dt;return n.createElement("button",{type:"button",key:V.name,className:"a-smart-list-row","data-action":"view.update",onClick:()=>{O("tool",{toolName:V.name,values:{},raw:!1,json:"{}"}),b.catalogState!=="stale"&&C("smartTools.schemas",{id:b.id,names:[V.name],catalogRevision:b.catalogRevision})}},n.createElement(Os,null),n.createElement("span",null,n.createElement("strong",null,V.title||((we=V.annotations)==null?void 0:we.title)||Pi(V.name)),n.createElement("small",null,V.description||V.name),((Dt=(Ge=V._meta)==null?void 0:Ge.ui)==null?void 0:Dt.resourceUri)&&n.createElement("small",{className:"a-smart-view-label"},"Interactive canvas view")),n.createElement(en,null))})),!S.length&&n.createElement("p",{className:"a-smart-empty"},"Connect to discover the tools supplied by this server."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-link a-danger",disabled:F,"data-action":"smartTools.remove",onClick:async()=>{await C("smartTools.remove",{id:b.id})&&O("home")}},n.createElement(ea,null),"Remove connection")),n.createElement("p",{className:"a-caption"},"Removing a connection keeps the installed package and the tool’s saved work.")),o.page==="tool"&&b&&!N&&n.createElement(nt,{phase:"neutral",message:"This tool is no longer in the server’s tool list. Reconnect to discover its current tools."}),o.page==="tool"&&N&&n.createElement(n.Fragment,null,n.createElement("h4",null,N.title||((on=N.annotations)==null?void 0:on.title)||Pi(N.name)),n.createElement("p",null,N.description),n.createElement("code",{className:"a-smart-tool-id"},b.name," / ",N.name),((mt=(pt=N._meta)==null?void 0:pt.ui)==null?void 0:mt.resourceUri)&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.open",disabled:F,onClick:qt},n.createElement(sa,null),"Open interactive view")),n.createElement(ga,{operation:A("smartTools.open",{id:b.id,tool:N.name}),busyMessage:"Opening the canvas view…"}),!x&&n.createElement(n.Fragment,null,n.createElement("p",null,"Load the current tool fields before making a call."),n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.schemas",disabled:F||b.catalogState==="stale",onClick:()=>C("smartTools.schemas",{id:b.id,names:[N.name],catalogRevision:b.catalogRevision})},"Load tool fields")),n.createElement(ga,{operation:A("smartTools.schemas",{id:b.id})}),x&&n.createElement("form",{id:"smart-tool-form",onSubmit:V=>{V.preventDefault();try{const we=_c(xe,o.values,o.raw,o.json);C("smartTools.call",{id:b.id,name:N.name,arguments:we,catalogRevision:b.catalogRevision})}catch(we){d(we.message)}}},!ze&&!o.raw?n.createElement(LD,{schema:xe,values:o.values,edit:V=>i({values:V})}):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-json"},"Tool arguments (JSON)"),n.createElement("textarea",{id:"smart-tool-json",className:"a-json-editor",value:o.json,spellCheck:!1,"data-action":"view.update",onChange:V=>i({json:V.target.value})})),!ze&&n.createElement("button",{type:"button",className:"a-link a-smart-advanced","data-action":"view.update","aria-expanded":o.raw,onClick:()=>{try{if(o.raw){const V=_c(xe,{},!0,o.json);if(Object.keys(V).some(Ge=>!Object.hasOwn(xe.properties,Ge)))throw new Error("These arguments include extra properties. Keep the JSON editor to preserve them.");const we=Object.fromEntries(Object.entries(V).map(([Ge,Dt])=>{var kn,sn;return[Ge,(sn=(kn=xe.properties)==null?void 0:kn[Ge])!=null&&sn.enum||typeof Dt=="object"?JSON.stringify(Dt):String(Dt)]}));i({raw:!1,values:we})}else{let V;try{V=_c({...xe,required:[]},o.values,!1,"{}")}catch{V={}}i({raw:!0,json:Za(V)})}d("")}catch(V){d(V.message)}}},o.raw?"Use form fields":"Edit arguments as JSON"),n.createElement(Rn,null,n.createElement("button",{type:"submit",form:"smart-tool-form",className:"a-primary","data-operation-pending":jt(it)||void 0,"aria-busy":jt(it)||void 0,"data-action":"smartTools.call",disabled:F||!["connected","ready"].includes(b.status)},n.createElement(pg,null),"Run tool"))),n.createElement(Xt,{name:"smart-tool-result",busy:jt(it)},n.createElement(ga,{operation:it,busyMessage:"Running the tool…"}),n.createElement(OD,{operation:zt})))),a&&n.createElement("div",{className:"a-everyday-footer"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>r==null?void 0:r("tool-connections")},"Advanced tool connections",n.createElement(sa,null))))}function FD({state:e,act:t}){var x,A;const a=e.notificationSettings||{},r=((x=e.view)==null?void 0:x.maintenanceDraft)||{},[o,i]=v.useState(""),[s,l]=v.useState(""),[c,u]=v.useState(null),[d,p]=v.useState(""),[m,h]=v.useState(""),f=v.useRef({topic:0,token:0}),g=v.useRef(!1),y=C=>{t("view.update",{patch:{maintenanceDraft:{...r,...C}}})},E=C=>{f.current.topic++,i(C)},b=r.notifyEnabled??a.enabled??!1,S=r.notifyServer??a.server??"https://ntfy.sh",w=(A=e.actionStatus)==null?void 0:A["notifications.save"];v.useEffect(()=>{if(!(!c||(w==null?void 0:w.commandId)!==c.id||["queued","working"].includes(w.phase))){if(g.current=!1,u(null),w.phase==="error"){p(w.error||"Could not save. Your entries are kept.");return}w.phase==="ready"&&(f.current.topic===c.version.topic&&i(""),f.current.token===c.version.token&&l(""),h("Notification preferences saved."))}},[w==null?void 0:w.commandId,w==null?void 0:w.phase,c]);const N=async()=>{if(g.current)return;g.current=!0,p(""),h("");const C={...f.current};try{const O=await t("notifications.save",{patch:{desktop:r.notifyDesktop??a.desktop??!0,server:S,enabled:b,preview:r.notifyPreview??a.preview??!1,...o?{topic:o}:{},...s?{token:s}:{}}});if(!(O!=null&&O.accepted)||!O.operationId)throw Error((O==null?void 0:O.error)||"Could not save. Please retry.");u({id:O.operationId,version:C})}catch(O){g.current=!1,p(O.message)}};return n.createElement("div",{className:"a-notification-settings"},n.createElement("p",{className:"a-everyday-intro"},"Know when your response is ready, wherever you’re working."),n.createElement("section",{className:"a-notification-card"},n.createElement("label",{className:"a-everyday-toggle"},n.createElement("span",null,n.createElement("strong",null,"On this device"),n.createElement("small",null,"Show a browser notification when a response is ready.")),n.createElement("input",{type:"checkbox",checked:r.notifyDesktop??a.desktop??!0,"data-action":"view.update",onChange:C=>y({notifyDesktop:C.target.checked})})),n.createElement("p",{className:"a-caption"},"Your browser also needs permission."),n.createElement("button",{className:"a-link","data-action":"notification.request",onClick:()=>t("notification.request")},"Allow browser notifications")),n.createElement("section",{className:"a-notification-card"},n.createElement("label",{className:"a-everyday-toggle"},n.createElement("span",null,n.createElement("strong",null,"On another device"),n.createElement("small",null,a.enabled&&a.topicConfigured?"Connected through ntfy.":"Get notifications on your phone with ntfy.")),n.createElement("input",{type:"checkbox","data-action":"view.update",checked:b,onChange:C=>y({notifyEnabled:C.target.checked})})),n.createElement("details",{className:"a-everyday-disclosure",open:b||void 0},n.createElement("summary",null,a.topicConfigured?"Manage phone notifications":"Set up phone notifications"),n.createElement("div",{className:"a-notification-steps"},n.createElement("div",null,n.createElement("h4",null,"1. Open ntfy on your phone"),n.createElement("p",null,n.createElement("a",{href:"https://ntfy.sh",target:"_blank",rel:"noreferrer"},"Get the ntfy app"),", then subscribe to a topic. A topic is the name of your notification channel.")),n.createElement("div",null,n.createElement("h4",null,"2. Use the same topic here"),n.createElement("label",{htmlFor:"notify-topic"},"Topic name ",a.topicConfigured&&"(saved)"),n.createElement("div",{className:"a-topic-entry"},n.createElement("input",{id:"notify-topic",type:"password",autoComplete:"off",placeholder:a.topicConfigured?"Leave blank to keep your saved topic":"Your topic name",value:o,"data-private":"true","data-action":"notifications.save",onChange:C=>E(C.target.value)}),n.createElement("button",{className:"a-soft",onClick:()=>E("amplifier-"+crypto.randomUUID().replaceAll("-","").slice(0,20))},"Create a name")),o&&n.createElement("button",{className:"a-link",onClick:async()=>{var C;try{await navigator.clipboard.writeText(o),h("Topic copied. Subscribe to it in ntfy.")}catch{(C=document.getElementById("notify-topic"))==null||C.select(),h("Select and copy the topic, then subscribe to it in ntfy.")}}},"Copy topic name"),n.createElement("p",{className:"a-caption"},"Use an unguessable name or a protected topic. Anyone with access to the topic can read its notifications.")),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Server & account"),n.createElement("div",null,n.createElement("label",{htmlFor:"notify-server"},"Notification server"),n.createElement("input",{id:"notify-server",type:"url","data-action":"view.update",value:S,onChange:C=>y({notifyServer:C.target.value})}),n.createElement("p",{className:"a-caption"},"Use the same server in the ntfy app. The default is ntfy.sh."),n.createElement("label",{htmlFor:"notify-token"},"Access token (optional)",a.tokenConfigured?" · saved":""),n.createElement("input",{id:"notify-token",type:"password",autoComplete:"off","data-private":"true","data-action":"notifications.save",value:s,placeholder:a.tokenConfigured?"Leave blank to keep saved token":"",onChange:C=>{f.current.token++,l(C.target.value)}}),n.createElement("p",{className:"a-caption"},"For protected topics, create a token in your ntfy account. It stays private on this host."))),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:r.notifyPreview??a.preview??!1,onChange:C=>y({notifyPreview:C.target.checked})}),"Include a response preview"),n.createElement("p",{className:"a-caption"},"Off by default. Notifications say your response is ready without including its content.")))),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:!!c||b&&!o&&!a.topicConfigured,"data-action":"notifications.save",onClick:N},c?"Saving…":"Save notifications")),d&&n.createElement(nt,{phase:"error",message:d}),n.createElement(nt,{phase:"ready",message:m}))}const qD=()=>({id:crypto.randomUUID(),name:"Personal server",url:"",enabled:!1,streams:["sessions","workers","tools","usage","updates"],workspace:"amplifier-unified",workspacePattern:"*",includePaths:!1,authMode:"static",apiKeyEnv:"AMPLIFIER_CONTEXT_INTELLIGENCE_API_KEY",authResource:""});function UD({state:e,act:t}){var E,b,S,w,N,x,A,C,O,k,T,I,F,z,U,H,te;const a=j=>{var _,P;return["queued","working","pending"].includes((P=(_=e.actionStatus)==null?void 0:_[j])==null?void 0:P.phase)},r=e.diagnostics||{},o=((E=e.view)==null?void 0:E.diagnosticsDraft)||{},i=o.config||r.config,s=r.streams||[];if(!i)return null;const l=j=>t("view.update",{patch:{diagnosticsDraft:{...o,...j}}}),c=j=>l({config:{...i,...j}}),u=i.destinations.find(j=>j.id===o.destinationId),d=j=>c({destinations:i.destinations.map(_=>_.id===u.id?{..._,...j}:_)}),p=async()=>{const j=await t("diagnostics.configure",{config:i});j!=null&&j.accepted&&l({config:null})},m=r.lastResult,h=u&&((b=r.destinations)==null?void 0:b.find(j=>j.id===u.id)),f=u&&((S=r.results)==null?void 0:S[u.id]),g=(j,_,P)=>P?[...j,_]:j.filter(G=>G!==_),y=(j,_,P=!1)=>n.createElement("div",{className:"a-diagnostic-streams"},s.map(G=>n.createElement("label",{className:"a-inline-checkbox",key:G.id},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:j.includes(G.id),disabled:!P&&!i.streams.includes(G.id),onChange:W=>_(g(j,G.id,W.target.checked))}),n.createElement("span",null,G.label))));return n.createElement(Pa,{id:"diagnostics",title:"Diagnostics & Context Intelligence",summary:"Local capture, selected streams and your servers",state:e,act:t},n.createElement("p",null,"Keep diagnostic records on this computer, or send selected streams to your own Context Intelligence servers. Each server has its own choices. App forwarding starts only after you save an enabled destination. Bundle exporters have their own settings."),u?n.createElement(Xt,{name:"diagnostic-destination-"+u.id,busy:(f==null?void 0:f.phase)==="working"},n.createElement("button",{className:"a-link a-diagnostics-back","data-action":"view.update",onClick:()=>l({destinationId:null})},n.createElement(Sa,null),"All destinations"),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Name",n.createElement("input",{"data-action":"view.update",value:u.name,onChange:j=>d({name:j.target.value})})),n.createElement("label",null,"Server URL",n.createElement("input",{type:"url",placeholder:"https://context.example.com","data-action":"view.update",value:u.url,onChange:j=>d({url:j.target.value})}))),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:u.enabled,onChange:j=>d({enabled:j.target.checked})}),"Send new selected records to this server"),n.createElement("label",null,"Authentication",n.createElement("select",{"data-action":"view.update",value:u.authMode,onChange:j=>d({authMode:j.target.value})},n.createElement("option",{value:"static"},"API key from environment"),n.createElement("option",{value:"entra"},"Microsoft Entra"))),u.authMode==="static"?n.createElement(n.Fragment,null,n.createElement("label",null,"API key environment variable",n.createElement("input",{"data-action":"view.update",value:u.apiKeyEnv,onChange:j=>d({apiKeyEnv:j.target.value})})),n.createElement("button",{className:"a-soft","data-action":"diagnostics.environment",onClick:()=>t("diagnostics.environment",{name:u.apiKeyEnv})},"Check variable"),(m==null?void 0:m.action)==="diagnostics.environment"&&m.name===u.apiKeyEnv&&n.createElement(nt,{...m})):n.createElement("label",null,"Entra resource URI",n.createElement("input",{"data-action":"view.update",value:u.authResource,placeholder:"api://application-id",onChange:j=>d({authResource:j.target.value})})),n.createElement("h4",null,"Streams for this server"),y(u.streams,j=>d({streams:j})),n.createElement("p",{className:"a-caption"},"Conversation text may contain private information. Redaction is best effort. Tool arguments, results, reasoning, file contents and canvas HTML are excluded from metadata streams."),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Server workspace label",n.createElement("input",{"data-action":"view.update",value:u.workspace,onChange:j=>d({workspace:j.target.value})})),n.createElement("label",null,"Capture from workspace paths",n.createElement("input",{"data-action":"view.update",value:u.workspacePattern,placeholder:"* or /Users/me/work/*",onChange:j=>d({workspacePattern:j.target.value})}))),n.createElement("p",{className:"a-caption"},"The label organizes records; it is not an access boundary on a shared server. Path filters use * and ? wildcards."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:u.includePaths,onChange:j=>d({includePaths:j.target.checked})}),"Include workspace folder paths in remote records"),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"diagnostics.configure",onClick:p},"Save destination")),n.createElement("button",{className:"a-soft","data-operation-pending":(f==null?void 0:f.phase)==="working"||void 0,"aria-busy":(f==null?void 0:f.phase)==="working"||void 0,"data-action":"diagnostics.test",disabled:!!o.config||(f==null?void 0:f.phase)==="working",onClick:()=>t("diagnostics.test",{id:u.id})},"Test connection"),n.createElement("button",{className:"a-soft","data-action":"diagnostics.retry",disabled:!((w=h==null?void 0:h.counts)!=null&&w.failed),onClick:()=>t("diagnostics.retry",{id:u.id})},n.createElement(Mt,null),"Retry failed deliveries")),n.createElement("p",{className:"a-caption"},"Save before testing. A test sends one synthetic event to verify authentication and write access."),!o.config&&n.createElement(nt,{...f}),n.createElement("p",{className:"a-caption"},((N=h==null?void 0:h.counts)==null?void 0:N.accepted)||0," accepted · ",((x=h==null?void 0:h.counts)==null?void 0:x.duplicate)||0," recognized retries · ",((A=h==null?void 0:h.counts)==null?void 0:A.pending)||0," queued · ",((C=h==null?void 0:h.counts)==null?void 0:C.failed)||0," failed · ",((O=h==null?void 0:h.counts)==null?void 0:O.cancelled)||0," cancelled"),(h==null?void 0:h.error)&&n.createElement(nt,{phase:"error",message:`Delivery needs attention: ${h.error.type}${h.error.statusCode?" (HTTP "+h.error.statusCode+")":""}`}),n.createElement("button",{className:"a-soft a-danger","data-action":"diagnostics.configure",onClick:async()=>{const j=await t("diagnostics.configure",{config:{...i,destinations:i.destinations.filter(_=>_.id!==u.id)}});j!=null&&j.accepted&&l({config:null,destinationId:null})}},n.createElement(ea,null),"Remove destination")):n.createElement(n.Fragment,null,n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:i.enabled,onChange:j=>c({enabled:j.target.checked})}),"Collect app diagnostics and enable selected forwarding"),n.createElement("p",{className:"a-caption"},"Sessions use the community Context Intelligence hook and shared files. The choices below control this app’s metadata index and forwarding; they do not disable the hook."),n.createElement("h4",null,"Model request details"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:i.providerRequests===!0,onChange:j=>c({providerRequests:j.target.checked})}),"Record provider requests for troubleshooting"),n.createElement("p",{className:"a-caption"},"Off by default. Applies to supported provider connections and delegated work when conversations next prepare, without interrupting current work. Explicit provider opt-outs are kept. Earlier calls cannot be recovered."),n.createElement("p",{className:"a-caption"},"Saved requests can contain private messages, instructions, tool inputs, and attachments. Recognizable credentials are redacted and each record is size limited. Providers may also record responses; some adapters expose only a summary. Records stay in the existing session logs; any configured bundle exporters still apply."),n.createElement("h4",null,"Streams to index and make available for forwarding"),y(i.streams,j=>c({streams:j,destinations:i.destinations.map(_=>({..._,streams:_.streams.filter(P=>j.includes(P))}))}),!0),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Index days",n.createElement("input",{type:"number",min:"1",max:"365",value:i.retentionDays,"data-action":"view.update",onChange:j=>c({retentionDays:Number(j.target.value)})})),n.createElement("label",null,"Maximum indexed records",n.createElement("input",{type:"number",min:"100",max:"100000",value:i.maxRecords,"data-action":"view.update",onChange:j=>c({maxRecords:Number(j.target.value)})}))),n.createElement("p",{className:"a-caption"},"These limits apply to the local index and queued deliveries. Shared Context Intelligence events.jsonl files are preserved. Indexed: ",(k=r.local)!=null&&k.storageError&&((T=r.local)==null?void 0:T.records)==null?"unavailable":(((I=r.local)==null?void 0:I.records)??0)+" records",".",(F=r.local)!=null&&F.dropped||(z=r.local)!=null&&z.outboxDropped||(U=r.local)!=null&&U.expiredPending?` Dropped: ${r.local.dropped||0}; outbox limit: ${r.local.outboxDropped||0}; expired before delivery: ${r.local.expiredPending||0}.`:""),((H=r.local)==null?void 0:H.configurationError)&&n.createElement(nt,{phase:"error",message:"The saved diagnostics configuration could not be read. Capture and forwarding are disabled; save reviewed settings to restore them."}),((te=r.local)==null?void 0:te.storageError)&&n.createElement(nt,{phase:"error",message:"Local diagnostic storage needs attention. Conversations can continue."}),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"diagnostics.configure",onClick:p},"Save capture settings")),n.createElement("h4",null,"Destinations"),n.createElement("div",{className:"a-diagnostic-destinations"},i.destinations.map(j=>{var P;const _=(P=r.destinations)==null?void 0:P.find(G=>G.id===j.id);return n.createElement("button",{className:"a-settings-group-title","data-action":"view.update",key:j.id,onClick:()=>l({destinationId:j.id})},n.createElement("span",null,n.createElement("strong",null,j.name),n.createElement("small",null,j.enabled?"Sending selected streams":"Disabled"," · ",j.streams.length," streams",_!=null&&_.error?" · Needs attention":"")),n.createElement(mo,null))})),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{const j=qD();l({config:{...i,destinations:[...i.destinations,j]},destinationId:j.id})}},n.createElement(Ln,null),"Add server"),n.createElement("p",{className:"a-caption"},"Saving a changed destination cancels its old pending deliveries. Data already accepted or in flight cannot be recalled. Selecting another stream starts with new records; history is never uploaded automatically."),n.createElement(Xt,{name:"diagnostic-records",busy:a("diagnostics.records")},n.createElement("h4",null,"Inspect local records"),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Stream filter",n.createElement("input",{"data-action":"view.update",value:o.stream||"*",onChange:j=>l({stream:j.target.value}),placeholder:"* or updates"})),n.createElement("label",null,"Session ID (optional)",n.createElement("input",{"data-action":"view.update",value:o.sessionId||"",onChange:j=>l({sessionId:j.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"diagnostics.records",onClick:()=>t("diagnostics.records",{stream:o.stream||"*",...o.sessionId?{sessionId:o.sessionId}:{}})},"Read records"),(m==null?void 0:m.action)==="diagnostics.records"&&n.createElement(n.Fragment,null,n.createElement("button",{className:"a-soft","data-action":"diagnostics.export",onClick:()=>t("diagnostics.export")},n.createElement(wa,null),"Export this page"),m.nextBefore&&n.createElement("button",{className:"a-soft","data-action":"diagnostics.records",onClick:()=>t("diagnostics.records",{stream:o.stream||"*",...o.sessionId?{sessionId:o.sessionId}:{},before:m.nextBefore})},"Older records"))),(m==null?void 0:m.action)==="diagnostics.records"&&n.createElement("pre",{className:"a-state-view"},JSON.stringify(m.items,null,2)))),(m==null?void 0:m.action)!=="diagnostics.records"&&(m==null?void 0:m.action)!=="diagnostics.test"&&(m==null?void 0:m.action)!=="diagnostics.environment"&&n.createElement(nt,{phase:(m==null?void 0:m.phase)||"ready",message:m==null?void 0:m.message}))}const qf=1e6;async function jD(e,t={}){var r,o;if(!e)throw new Error("Choose a conversation export.");if(e.size>qf)throw new Error("Choose a conversation export smaller than 1 MB.");if(!/\.(json|jsonl)$/i.test(e.name||""))throw new Error("Choose a JSON or JSONL conversation export.");const a=await e.text();if(new TextEncoder().encode(a).length>qf)throw new Error("Choose a conversation export smaller than 1 MB.");if(!a.trim())throw new Error("The selected conversation export is empty.");return{content:a,format:/\.jsonl$/i.test(e.name)?"jsonl":"json",...(r=t.title)!=null&&r.trim()?{title:t.title.trim()}:{},...(o=t.bundle)!=null&&o.trim()?{bundle:t.bundle.trim()}:{}}}function $D({state:e,act:t}){var f,g,y,E,b,S,w;const a=v.useContext(Ju);v.useEffect(()=>{a==="notifications"&&t("notifications.get")},[a]);const r=(f=e.sessions)==null?void 0:f.find(N=>N.id===e.selectedSessionId),o=((g=e.view)==null?void 0:g.maintenanceDraft)||{},i=e.permissions||{};e.notificationSettings;const s=((y=e.management)==null?void 0:y.phase)==="working",l=N=>{var A,C;const x=(A=e.actionStatus)==null?void 0:A[N];return["queued","working"].includes(x==null?void 0:x.phase)&&(!((C=x.target)!=null&&C.sessionId)||x.target.sessionId===(r==null?void 0:r.id))},c=N=>t("view.update",{patch:{maintenanceDraft:{...o,...N}}}),u=o.scope||"global",d=o.resetParts||[],p=(E=e.maintenance)==null?void 0:E.resetPreview,m=p&&JSON.stringify([...d].sort())===JSON.stringify([...p.parts||[]].sort()),h=(N,x={})=>t(N,{...r?{sessionId:r.id}:{},...x});return n.createElement("div",{"data-part":"maintenance"},n.createElement(UD,{state:e,act:t}),n.createElement(Pa,{id:"history",title:"Conversation history",state:e,act:t},n.createElement("p",null,"Your CLI projects and conversations appear automatically in the workspace sidebar. Open a chat there to continue the same conversation, or export its transcript here."),r&&n.createElement("button",{className:"a-soft","aria-busy":l("history.export")||void 0,"data-action":"history.export",onClick:()=>h("history.export",{format:"jsonl"})},"Export runtime transcript"),n.createElement("div",{className:"a-selection-card"},n.createElement("h4",null,"Import a conversation file"),n.createElement("p",null,"Load a Unified JSON export or CLI JSONL transcript as a new conversation."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"history-import-title"},"Conversation title (optional)"),n.createElement("input",{id:"history-import-title",value:o.importTitle||"","data-action":"view.update",onChange:N=>c({importTitle:N.target.value})})),n.createElement("details",null,n.createElement("summary",null,"Advanced import options"),n.createElement("label",{htmlFor:"history-import-bundle"},"Bundle override (optional)"),n.createElement("input",{id:"history-import-bundle",value:o.importBundle||"","data-action":"view.update",onChange:N=>c({importBundle:N.target.value}),placeholder:"Use the export’s bundle"}))),n.createElement("label",{htmlFor:"history-import-file"},"Choose JSON or JSONL (up to 1 MB)"),n.createElement(Cg,{id:"history-import-file",accept:".json,.jsonl,application/json,application/x-ndjson",disabled:s,action:"history.importFile",label:"Choose a conversation",hint:"Drop JSON or JSONL here · up to 1 MB",onFile:async N=>{const x=await jD(N,{title:o.importTitle,bundle:o.importBundle});c({importError:""}),await t("history.importFile",x)}}),o.importError&&n.createElement("p",{className:"a-danger",role:"alert"},o.importError),n.createElement("p",{className:"a-caption"},"Original transcript entries are preserved. Imported jobs do not restart automatically.")),n.createElement("label",null,"Older than (days)",n.createElement("input",{type:"number",min:"1",value:o.cleanupDays||30,"data-action":"view.update",onChange:N=>c({cleanupDays:Number(N.target.value)})})),n.createElement("button",{className:"a-soft","aria-busy":l("history.cleanup")||void 0,"data-action":"history.cleanup",onClick:()=>t("history.cleanup",{days:o.cleanupDays||30})},"Preview cleanup"),e.cleanupPreview&&n.createElement(n.Fragment,null,n.createElement("p",null,e.cleanupPreview.sessions.length," inactive conversations eligible. Your selected conversation is kept."),n.createElement("label",null,n.createElement("input",{type:"checkbox","data-action":"view.update",checked:!!o.purge,onChange:N=>c({purge:N.target.checked})}),"Also remove retained legacy app files (shared CLI history is kept)"),n.createElement("button",{className:"a-soft a-danger","aria-busy":l("history.cleanup")||void 0,"data-action":"history.cleanup",disabled:!e.cleanupPreview.sessions.length,onClick:()=>t("history.cleanup",{days:o.cleanupDays||30,apply:!0,purge:!!o.purge})},"Clean up these conversations"))),n.createElement(Pa,{id:"permissions",title:"File access",state:e,act:t},n.createElement(Xt,{className:"a-settings-page-body",name:"permissions-preferences",busy:l("permissions.get")},n.createElement("p",null,"File tools can write within your project by default. Add other allowed locations below. Denied locations take precedence, and individual tools may apply stricter limits. Shell commands and other tools can have separate policies."),n.createElement("p",{className:"a-caption"},"These fields edit write overrides at the selected scope. Empty fields do not show all effective access: inherited settings and bundle restrictions can still apply."),n.createElement("label",null,"Edit overrides for",n.createElement("select",{value:u,"data-action":"view.update",onChange:N=>c({scope:N.target.value})},n.createElement("option",{value:"global"},"All projects"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This computer’s project settings"))),n.createElement("button",{className:"a-soft","aria-busy":l("permissions.get")||void 0,"data-action":"permissions.get",disabled:!r,onClick:()=>h("permissions.get",{scope:u})},"Load permissions"),n.createElement("label",{htmlFor:"allowed-folders"},"Allowed folders (one per line)"),n.createElement(Ma,{id:"allowed-folders",multiline:!0,directory:!0,state:e,act:t,value:o.allowed??(i.allowed||[]).join(` +`).map(r=>r.trim()).filter(Boolean)){const r=/^([A-Za-z][A-Za-z0-9-]*)\s*=\s*([A-Za-z_][A-Za-z0-9_]*)$/.exec(a);if(!r)throw new Error("Use HEADER_NAME=APP_VARIABLE, never credential values.");if(Object.keys(t).some(o=>o.toLowerCase()===r[1].toLowerCase()))throw new Error("Header names must be unique.");t[r[1]]=r[2]}return t}function _c(e,t,a,r){var i;if(a||!(e!=null&&e.properties)||e.oneOf||e.anyOf||e.$ref){const s=JSON.parse(r);if(!s||typeof s!="object"||Array.isArray(s))throw new Error("Tool arguments must be a JSON object.");return s}const o={};for(const[s,l]of Object.entries(e.properties)){let c=t[s]??(l.default==null?"":l.enum||typeof l.default=="object"?Za(l.default):String(l.default));if(c===""){if((i=e.required)!=null&&i.includes(s))throw new Error(`${l.title||Pi(s)} is required.`);continue}if(l.enum)c=JSON.parse(c);else if(l.type==="boolean")c=c==="true";else if(l.type==="integer"||l.type==="number"){if(c=Number(c),!Number.isFinite(c)||l.type==="integer"&&!Number.isInteger(c))throw new Error(`${l.title||Pi(s)} must be ${l.type==="integer"?"a whole number":"a number"}.`)}else(l.type==="object"||l.type==="array"||l.oneOf||l.anyOf||l.$ref||Array.isArray(l.type))&&(c=JSON.parse(c));o[s]=c}return o}function LD({schema:e,values:t,edit:a}){return Object.entries(e.properties||{}).map(([r,o])=>{var m,h;const i=`smart-tool-field-${r}`,s=o.title||Pi(r),l=(m=e.required)==null?void 0:m.includes(r),c=o.type==="object"||o.type==="array"||o.oneOf||o.anyOf||o.$ref||Array.isArray(o.type),u=o.default==null?"":o.enum||c?Za(o.default):String(o.default),d=t[r]??u,p={id:i,value:d,"data-action":"view.update",onChange:f=>a({...t,[r]:f.target.value}),"aria-describedby":o.description?i+"-hint":void 0};return n.createElement("div",{className:"a-smart-field",key:r},n.createElement("label",{htmlFor:i},s,l&&n.createElement("span",{className:"a-smart-required"},"Required")),o.enum?n.createElement("select",{...p},n.createElement("option",{value:""},l?"Choose…":"Tool default"),o.enum.map((f,g)=>n.createElement("option",{key:g,value:JSON.stringify(f)},typeof f=="string"?f:JSON.stringify(f)))):o.type==="boolean"?n.createElement("select",{...p},n.createElement("option",{value:""},l?"Choose…":"Tool default"),n.createElement("option",{value:"true"},"Yes"),n.createElement("option",{value:"false"},"No")):c?n.createElement("textarea",{...p,className:"a-json-editor",spellCheck:!1,placeholder:o.type==="array"?"[]":"{}"}):o.type==="number"||o.type==="integer"?n.createElement("input",{...p,type:"number",step:o.type==="integer"?"1":"any",min:o.minimum,max:o.maximum}):n.createElement("textarea",{...p,rows:2,placeholder:((h=o.examples)==null?void 0:h[0])==null?"":String(o.examples[0])}),o.description&&n.createElement("p",{id:i+"-hint",className:"a-caption"},o.description))})}function DD({state:e,act:t,simple:a=!1,navigateSettings:r}){var ft,Ce,gt,Et,vt,at,ee,Re,ae,Le,Oe,et,st,It,xt,Ut,rt,Xe,$e,Nt,Zt,rn,In,yn,Fn,Gn,An,Jt,dn,ut,ve,ge,At,Ot,Kt,Q,Yt,En,qn,pn,wn,mn,_n,on,pt,mt;const[o,i]=_D(e,t),s=v.useRef(!1),[l,c]=v.useState(null),[u,d]=v.useState(""),[p,m]=v.useState(null),h=e.smartTools||{},f=ai(h.servers),g=ai(h.catalog),E=ai(h.installations).filter(V=>!V.supersededBy&&!V.stagedFrom),y=ai(h.operations),b=f.find(V=>V.id===o.serverId),S=ai(b==null?void 0:b.tools).filter(V=>{var ke,Ge;return(((Ge=(ke=V._meta)==null?void 0:ke.ui)==null?void 0:Ge.visibility)||["model","app"]).includes("model")}),w=S.find(V=>V.name===o.toolName),N=w&&{...w,...(b==null?void 0:b.loadedSchemaRevision)===(b==null?void 0:b.catalogRevision)?(ft=b==null?void 0:b.loadedSchemas)==null?void 0:ft[o.toolName]:{}},x=!!(N!=null&&N.inputSchema)&&(b==null?void 0:b.catalogState)!=="stale",A=(V,ke={})=>(l==null?void 0:l.action)===V?l:PD(y,V,ke),C=async(V,ke={})=>{d(""),c({action:V,status:"pending",target:ke});try{const Ge=await t(V,ke);if(!Ge||Ge.accepted===!1)throw new Error("The request could not be sent. Please try again.");return c(null),Ge}catch(Ge){return c({action:V,status:"failed",error:Ge.message,target:ke}),null}},O=(V,ke={})=>{d(""),c(null),i({page:V,catalogReview:!1,catalogInstalling:!1,returnPage:V==="source"&&o.page==="catalog"?"catalog":null,...ke})},k={...ao.connection,...o.connection},T=V=>i({connection:{...k,...V}}),I=[...y].reverse().find(jt),F=jt(l)||y.some(V=>{var ke,Ge,Dt;return jt(V)&&(o.page==="source"?((ke=V.target)==null?void 0:ke.repository)===o.repository.trim():o.page==="connection"?V.action==="smartTools.configure"&&(((Ge=V.target)==null?void 0:Ge.id)||"")===k.id:["server","tool"].includes(o.page)?((Dt=V.target)==null?void 0:Dt.id)===(b==null?void 0:b.id):!1)}),[z,q]=xa(e,t,"smart-tool-connections",f,V=>[V.name,V.command,V.status],"Filter connections"),[W,X,U]=xa(e,t,"smart-tool-catalog",g,V=>[V.name,V.id,V.description,Ta(V)],a?"Search tools":"Filter catalog",{simple:a}),[_,P]=xa(e,t,"smart-tool-actions-"+((b==null?void 0:b.id)||""),S,V=>[V.name,V.title,V.description],"Filter tools"),G=A("smartTools.installBatch"),Z=jt(G),D=V=>E.some(ke=>Ta(ke).replace(/\.git$/,"")===Ta(V).replace(/\.git$/,"")&&(ke.path||".")===(V.path||".")),ne=o.catalogSelection||[],H=g.filter(V=>ne.includes(V.id)&&!D(V)),j=Math.max(1,Math.min(o.catalogPage||1,Math.ceil(W.length/40)||1)),ie=W.length>50,Ee=ie?W.slice((j-1)*40,j*40):W,me=g.find(V=>V.id===o.catalogId)||Ee[0],_e=(V,ke)=>i({catalogSelection:ke?[...new Set([...ne,V])]:ne.filter(Ge=>Ge!==V)}),Je=V=>i({catalogSelection:[...new Set([...ne,...V.filter(ke=>!D(ke)).map(ke=>ke.id)])]});v.useEffect(()=>{i({catalogPage:1})},[U]);const De=o.page==="tool"?"server":"home",ue=V=>O("connection",{connection:V?{id:V.id,name:V.name,command:V.command,args:(V.args||[]).join(` +`),env:Object.entries(V.env||{}).map(([ke,Ge])=>ke+"="+Ge).join(` +`),cwd:V.cwd||"",transport:V.transport||"stdio",url:V.url||"",headers:Object.entries(V.headers||{}).map(([ke,Ge])=>ke+"="+Ge).join(` +`),auth:V.auth||"environment",installationId:V.installationId||""}:ao.connection}),ye=()=>({repository:o.repository.trim(),...o.ref.trim()?{ref:o.ref.trim()}:{},...o.path.trim()?{path:o.path.trim()}:{}}),M={repository:o.repository.trim(),ref:o.ref.trim(),path:o.path.trim()},Y=A("smartTools.inspect",M),se=A("smartTools.install",M),Fe=JSON.stringify(M),je=Wc(Fe,Y==null?void 0:Y.result,jt(Y)||eo(Y)),oe=E.find(V=>Ta(V)===o.repository.trim()&&(V.path||".")===(o.path||".")),Ze=!jt(se)&&!eo(se)&&(se==null?void 0:se.result)||oe,it=A("smartTools.call",{id:b==null?void 0:b.id,name:N==null?void 0:N.name,sessionId:e.selectedSessionId}),zt=Wc(JSON.stringify([e.selectedSessionId,b==null?void 0:b.id,N==null?void 0:N.name]),it,jt(it)||eo(it)),ct=[...y].reverse().find(V=>{var ke,Ge,Dt;return V.action==="smartTools.call"&&V.status==="completed"&&((ke=V.target)==null?void 0:ke.id)===(b==null?void 0:b.id)&&((Ge=V.target)==null?void 0:Ge.name)===(N==null?void 0:N.name)&&((Dt=V.target)==null?void 0:Dt.sessionId)===e.selectedSessionId}),qt=async()=>{const V=e.selectedSessionId,ke=await C("smartTools.open",{id:b.id,tool:N.name,...V?{sessionId:V}:{},...ct?{operationId:ct.id}:{}});ke!=null&&ke.operationId&&m({id:ke.operationId,sessionId:V,serverId:b.id,toolName:N.name})};v.useEffect(()=>{var ke;if(!p)return;const V=y.find(Ge=>Ge.id===p.id);!V||jt(V)||(V.status==="completed"&&e.selectedSessionId===p.sessionId&&((ke=e.view)==null?void 0:ke.panel)==="settings"&&o.page==="tool"&&o.serverId===p.serverId&&o.toolName===p.toolName&&t("view.update",{patch:{panel:null}}),m(null))},[p,y,e.selectedSessionId,(Ce=e.view)==null?void 0:Ce.panel,o.page,o.serverId,o.toolName]),v.useEffect(()=>{var V,ke;!a||s.current||(s.current=!0,(ke=(V=e.view)==null?void 0:V.smartToolsEditor)!=null&&ke.page||(O("home"),g.length||C("smartTools.catalog")))},[a]);const le=()=>(i({catalogReview:!1,catalogInstalling:!0}),C("smartTools.installBatch",{ids:H.map(V=>V.id),extrasById:Object.fromEntries(H.map(V=>{var ke;return[V.id,(((ke=o.catalogExtras)==null?void 0:ke[V.id])||"").split(",").map(Ge=>Ge.trim()).filter(Boolean)]}))})),fe=V=>O("setup",{setupInstructions:!1,repository:Ta(V),ref:V.ref||"",path:V.path||"",extras:(V.extras||[]).join(", ")}),xe=(N==null?void 0:N.inputSchema)||{type:"object",properties:{}},ze=!xe.properties||!!(xe.oneOf||xe.anyOf||xe.$ref),Ye=["smartTools.configure","smartTools.connect","smartTools.reconnect","smartTools.disconnect","smartTools.remove","smartTools.authForget","smartTools.accountAccept"].map(V=>A(V,{id:b==null?void 0:b.id})).filter(Boolean).sort((V,ke)=>(ke.updatedAt||ke.createdAt||1/0)-(V.updatedAt||V.createdAt||1/0))[0],ht=v.useRef(null),bt=o.catalogReview?"review":o.catalogInstalling||Z?"install":"browse";return v.useLayoutEffect(()=>{var V,ke;o.page==="catalog"&&bt!=="browse"&&((V=ht.current)==null||V.focus(),(ke=ht.current)==null||ke.scrollIntoView({block:"start"}))},[bt,o.page]),n.createElement("section",{className:"a-settings-section a-smart-tools","data-part":"smart-tools-settings","data-simple":a},o.page!=="home"&&(!a||!["catalog"].includes(o.page))&&n.createElement("button",{type:"button",className:"a-link a-smart-back","data-action":"view.update",onClick:()=>O(De)},n.createElement(Sa,null),"Back to ",De==="server"?(b==null?void 0:b.name)||"connection":"Smart Tools"),u&&n.createElement(nt,{phase:"error",message:u}),a?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Add tools that help Amplifier do more of your work."),n.createElement("div",{className:"a-tool-browse-tabs"},n.createElement("button",{className:"a-soft",disabled:Z,"aria-pressed":o.page==="home","data-action":"view.update",onClick:()=>O("home")},"Installed"),n.createElement("button",{className:"a-soft",disabled:Z,"aria-pressed":o.page==="catalog","data-action":"smartTools.catalog",onClick:()=>{O("catalog"),g.length||C("smartTools.catalog")}},"Tool catalog"),n.createElement("button",{className:"a-link",disabled:Z,"data-action":"view.update",onClick:()=>O("source",{repository:"",ref:"",path:"",extras:""})},"Add from GitHub URL"))):n.createElement("div",{className:"a-collection-toolbar"},n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>O("home")},"Installed & connected"),n.createElement("button",{className:"a-soft","data-action":"smartTools.catalog",onClick:()=>{O("catalog"),g.length||C("smartTools.catalog")}},n.createElement(vr,null),"Tool catalog"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>O("source")},n.createElement(wa,null),"Add from Git"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>ue()},n.createElement(Ln,null),"Add MCP connection")),o.page==="catalog"&&n.createElement(Xt,{className:a?"a-tool-catalog-simple":void 0,name:"smart-tool-catalog",busy:jt(A("smartTools.catalog"))},bt==="review"&&n.createElement("section",{className:"a-tool-batch-review","aria-label":"Review installation"},n.createElement("h4",{ref:ht,tabIndex:-1},"Install ",H.length," tools?"),n.createElement("p",null,"Installation adds the packages. Accounts and permissions are connected separately."),n.createElement("ul",null,H.map(V=>n.createElement("li",{key:V.id},V.name||V.id))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"smartTools.installBatch",disabled:Z||!H.length,onClick:le},"Install selected (",H.length,")"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:Z,onClick:()=>i({catalogReview:!1})},"Cancel"))),bt==="install"&&n.createElement("section",{"aria-label":"Catalog installation results"},n.createElement("h4",{ref:ht,tabIndex:-1},Z?"Installing your tools…":eo(G)?"Some tools need attention":"Installation complete"),n.createElement(ga,{operation:G,busyMessage:"Installing selected packages…"}),n.createElement("ul",{className:"a-catalog-results"},((G==null?void 0:G.items)||[]).map(V=>n.createElement("li",{key:V.id},n.createElement("strong",null,V.name)," · ",V.status,n.createElement("small",null,V.error),V.status==="completed"&&n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>fe(V.source)},"Finish setup")))),!Z&&((gt=G==null?void 0:G.items)==null?void 0:gt.some(V=>V.status!=="completed"))&&n.createElement("button",{className:"a-soft","data-action":"smartTools.installBatch",onClick:()=>C("smartTools.installBatch",{retryOperationId:G.id})},"Retry unfinished installations"),!Z&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",onClick:()=>O("home")},"View installed tools"),n.createElement("button",{className:"a-soft",onClick:()=>O("catalog")},"Back to catalog"))),bt==="browse"?n.createElement(n.Fragment,null,n.createElement("div",{className:"a-catalog-controls"},n.createElement("div",{className:"a-smart-heading"},!a&&n.createElement("h4",null,"Smart Tools catalog"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Refresh Smart Tools catalog","data-action":"smartTools.catalog",disabled:jt(A("smartTools.catalog")),onClick:()=>C("smartTools.catalog")},n.createElement(Mt,null))),!a&&n.createElement("p",null,"Select tools to install together. Each package keeps its own installation result and setup steps."),(!a||jt(A("smartTools.catalog"))||eo(A("smartTools.catalog")))&&n.createElement(ga,{operation:A("smartTools.catalog"),busyMessage:"Loading the catalog…"}),X,n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,a?ie?`${(j-1)*40+1}–${Math.min(j*40,W.length)} of ${W.length} tools`:`${W.length===g.length?"All ":""}${W.length} tools`:`${H.length} selected across the catalog`),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>Je(Ee)},"Select ",ie?"page":a?"all available":"matching"),ie&&n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>Je(W)},"Select all matching"),(!a||ne.length>0)&&n.createElement("button",{className:"a-link",disabled:!ne.length,"data-action":"view.update",onClick:()=>i({catalogSelection:[]})},"Clear selection"))),(a||H.length>0||Z)&&n.createElement(Rn,null,n.createElement("span",{className:"a-catalog-selection-summary"},H.length," selected",H.some(V=>!Ee.includes(V))&&n.createElement("small",null,H.filter(V=>!Ee.includes(V)).length," outside this view")),n.createElement("button",{className:"a-primary",disabled:!H.length||Z,"data-action":"smartTools.installBatch",onClick:()=>i({catalogReview:!0})},n.createElement(wa,null),"Review & install")),n.createElement(Co,{label:"catalog",detailOpen:!!o.catalogDetail,onBack:()=>i({catalogDetail:!1}),list:a?Ee.map(V=>n.createElement("div",{className:"a-tool-catalog-row",key:V.id},n.createElement("input",{type:"checkbox",id:"select-tool-"+V.id,"aria-label":"Select "+(V.name||V.id),checked:ne.includes(V.id),disabled:D(V),"data-action":"view.update",onChange:ke=>_e(V.id,ke.target.checked)}),n.createElement("label",{htmlFor:"select-tool-"+V.id},n.createElement("strong",null,V.name||V.id),n.createElement("small",null,V.description||"Open details to learn more."),D(V)&&n.createElement("span",{className:"a-count"},"Installed")),n.createElement("button",{className:"a-icon","aria-label":"Details for "+(V.name||V.id),"data-action":"view.update",onClick:()=>i({catalogId:V.id,catalogDetail:!0})},n.createElement(en,null)))):Ee.map(V=>n.createElement(Va,{key:V.id,id:V.id,label:V.name||V.id,description:V.description||Ta(V),badge:D(V)?"Installed":void 0,checked:ne.includes(V.id),disabled:D(V),onCheck:ke=>_e(V.id,ke),selected:!a&&V.id===(me==null?void 0:me.id),onSelect:()=>i({catalogId:V.id,catalogDetail:!0})}))},me?n.createElement(n.Fragment,null,n.createElement("h4",null,me.name||me.id),n.createElement("p",null,me.description),n.createElement("details",{className:"a-everyday-disclosure",open:!a||void 0},n.createElement("summary",null,"Source & installation options"),n.createElement("div",null,n.createElement("p",{className:"a-caption a-wrap"},Ta(me)),n.createElement("dl",null,n.createElement("dt",null,"Version"),n.createElement("dd",null,me.version||((Et=me.manifest)==null?void 0:Et.version)||"See manifest"),n.createElement("dt",null,"Branch or revision"),n.createElement("dd",null,me.ref||"Repository default")),((vt=me.manifest)==null?void 0:vt.requires)&&n.createElement(n.Fragment,null,n.createElement("h5",null,"Requirements from the tool author"),n.createElement("pre",{className:"a-wrap"},typeof me.manifest.requires=="string"?me.manifest.requires:Za(me.manifest.requires))),n.createElement("label",{htmlFor:"catalog-package-extras"},"Optional package extras"),n.createElement("input",{id:"catalog-package-extras",value:((at=o.catalogExtras)==null?void 0:at[me.id])||"",placeholder:"For example, mcp","data-action":"view.update",onChange:V=>i({catalogExtras:{...o.catalogExtras,[me.id]:V.target.value}})}),n.createElement("p",{className:"a-caption"},"Comma-separated extras from this tool’s instructions. Applied only to this selected package."))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:D(me),"data-action":"view.update",onClick:()=>_e(me.id,!ne.includes(me.id))},D(me)?"Installed":ne.includes(me.id)?"Deselect tool":"Select for installation"),n.createElement("button",{className:"a-link","data-action":"smartTools.inspect",onClick:()=>{O("source",{returnPage:"catalog",repository:Ta(me),ref:me.ref||"",path:me.path||"",extras:""}),C("smartTools.inspect",{repository:Ta(me),...me.ref?{ref:me.ref}:{},...me.path?{path:me.path}:{}})}},"Inspect source and setup")),n.createElement("p",{className:"a-caption"},"Installing a package does not connect an account or grant access. Some tools need advanced setup before they can be used.")):n.createElement("p",null,"No matching catalog items.")),ie&&n.createElement("div",{className:"a-catalog-pages"},n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:j===1,onClick:()=>i({catalogPage:j-1,catalogDetail:!1})},"Previous"),n.createElement("span",null,(j-1)*40+1,"–",Math.min(j*40,W.length)," of ",W.length),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:j*40>=W.length,onClick:()=>i({catalogPage:j+1,catalogDetail:!1})},"Next")),!g.length&&!jt(A("smartTools.catalog"))&&n.createElement("p",{className:"a-smart-empty"},"The catalog has not loaded yet. Refresh to try again, or add a tool from a Git URL.")):null),a&&o.page==="home"&&n.createElement("section",{className:"a-installed-tools","aria-label":"Installed tools"},!E.length&&!f.length?n.createElement("div",{className:"a-ai-welcome"},n.createElement(zk,{"aria-hidden":"true"}),n.createElement("h4",null,"No tools installed yet"),n.createElement("p",null,"Find tools for your work in the catalog, or add one using its GitHub URL."),n.createElement("button",{className:"a-primary",onClick:()=>{O("catalog"),g.length||C("smartTools.catalog")}},"Explore tool catalog")):n.createElement(n.Fragment,null,!!E.length&&n.createElement("div",{className:"a-everyday-list"},E.map((V,ke)=>{var Ge;return n.createElement(Va,{key:V.id||ke,id:V.id||String(ke),label:V.name||((Ge=V.manifest)==null?void 0:Ge.name)||Ta(V),description:f.some(Dt=>Dt.installationId===V.id)?"Installed · connection configured":"Installed · finish setup",onSelect:()=>fe(V)})})),!!f.length&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Connected services"),f.length>6&&q,n.createElement("div",{className:"a-everyday-list"},z.map(V=>n.createElement(Va,{key:V.id,id:V.id,label:V.name,description:V.connectionState||(V.error?"Needs attention":V.status||"Not connected"),onSelect:()=>O("server",{serverId:V.id})})))))),o.page!=="catalog"&&!(a&&o.page==="home")&&n.createElement(Co,{label:"configurations",detailOpen:o.page!=="home",onBack:()=>O("home"),list:n.createElement(n.Fragment,null,f.length>6&&q,f.length>0&&n.createElement("div",{className:"a-smart-heading"},n.createElement("h4",null,"Connections"),n.createElement("small",null,f.filter(V=>["ready","connected"].includes(V.status)).length," ready · ",f.length," configured")),z.map(V=>{var ke,Ge;return n.createElement(Va,{key:V.id,id:V.id,label:V.name,description:(V.connectionState||(V.error?"Needs attention":V.status||"Not connected"))+((ke=V.tools)!=null&&ke.length?` · ${V.tools.length} tools`:"")+(V.uiCapable||(Ge=V.tools)!=null&&Ge.some(Dt=>{var kn,sn;return(sn=(kn=Dt._meta)==null?void 0:kn.ui)==null?void 0:sn.resourceUri})?" · Canvas views":""),selected:V.id===(b==null?void 0:b.id),onSelect:()=>O("server",{serverId:V.id})})}),n.createElement("div",{className:"a-smart-heading"},n.createElement("h4",null,a?"Installed tools":"Installed packages"),n.createElement("small",null,E.length)),E.map((V,ke)=>{var Ge,Dt;return n.createElement(Va,{key:V.id||ke,id:V.id||String(ke),label:V.name||((Ge=V.manifest)==null?void 0:Ge.name)||Ta(V),description:a?f.some(kn=>kn.installationId===V.id)?"Installed · connection configured":"Installed · finish setup":V.version||((Dt=V.commit)==null?void 0:Dt.slice(0,8))||"Installed",selected:o.page==="source"&&Ta(V)===o.repository,onSelect:()=>fe(V)})}),!f.length&&!E.length&&n.createElement("div",{className:"a-smart-empty"},n.createElement("h4",null,"No tools installed yet"),n.createElement("p",null,"Choose a tool from the catalog, add a GitHub URL, or connect an MCP service.")))},o.page==="home"&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Your Smart Tools"),n.createElement("p",null,"Choose a connection to browse its tools, run a tool, or open its interactive view. Installed packages have their own setup details."),I&&n.createElement(ga,{operation:I}),n.createElement(ga,{operation:A("smartTools.remove")})),o.page==="setup"&&n.createElement(n.Fragment,null,n.createElement("h4",null,(oe==null?void 0:oe.name)||((ee=oe==null?void 0:oe.manifest)==null?void 0:ee.name)||"Finish setup"),n.createElement("p",null,"The package is installed. A connection and any required account access are separate."),f.filter(V=>V.installationId===(oe==null?void 0:oe.id)&&!!(oe!=null&&oe.id)).map(V=>n.createElement("button",{key:V.id,className:"a-soft","data-action":"view.update",onClick:()=>O("server",{serverId:V.id})},"Open ",V.name)),!o.setupInstructions&&!f.some(V=>V.installationId===(oe==null?void 0:oe.id)&&!!(oe!=null&&oe.id))&&n.createElement("div",{className:"a-ai-hint"},n.createElement("strong",null,"Advanced setup required"),n.createElement("p",null,"This tool does not provide a guided connection setup. Use its documented connection details before using it."),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i({setupInstructions:!0})},"Open setup instructions")),o.setupInstructions&&n.createElement("section",{className:"a-smart-setup-instructions","aria-label":"Setup instructions"},n.createElement("h4",null,"Set up ",(oe==null?void 0:oe.name)||((Re=oe==null?void 0:oe.manifest)==null?void 0:Re.name)||"this tool"),n.createElement("p",null,oe!=null&&oe.guidance&&typeof oe.guidance=="string"?oe.guidance:(oe==null?void 0:oe.nextStep)||"Follow the tool author’s instructions to connect the installed package."),/^https?:\/\//.test(o.repository)&&n.createElement("p",null,n.createElement("a",{href:o.repository,target:"_blank",rel:"noreferrer"},"Open the tool’s documentation",n.createElement(sa,null))),(oe==null?void 0:oe.binDir)&&n.createElement(n.Fragment,null,n.createElement("p",null,"Installed executables"),n.createElement("code",{className:"a-smart-path"},oe.binDir)),((ae=oe==null?void 0:oe.manifest)==null?void 0:ae.requires)&&n.createElement(n.Fragment,null,n.createElement("h5",null,"Requirements from the tool author"),n.createElement(AD,{value:oe.manifest.requires})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"view.update",onClick:()=>{var V;return O("connection",{connection:{...ao.connection,name:(oe==null?void 0:oe.name)||((V=oe==null?void 0:oe.manifest)==null?void 0:V.name)||"",installationId:(oe==null?void 0:oe.id)||""}})}},"Configure MCP connection"),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>O("source")},"Source & installation options"))),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Installation details"),n.createElement("div",null,n.createElement("p",null,oe==null?void 0:oe.description),n.createElement("code",{className:"a-wrap"},o.repository),n.createElement("p",{className:"a-caption"},oe==null?void 0:oe.nextStep)))),o.page==="source"&&n.createElement(n.Fragment,null,n.createElement("h4",null,oe?`Set up ${oe.name||((Le=oe.manifest)==null?void 0:Le.name)||"tool"}`:a?"Add from GitHub URL":"Add from Git"),n.createElement("p",null,oe?"Review the installed tool’s instructions and configure its connection below.":a?"Paste the repository link for a Smart Tool. Review its details before installing.":"Inspect the tool’s manifest and source revision, then install the Python package into its own environment."),n.createElement("label",{htmlFor:"smart-tool-repository"},"Repository URL"),n.createElement("input",{id:"smart-tool-repository",type:"url",value:o.repository,placeholder:"https://github.com/owner/tool","data-action":"view.update",onChange:V=>i({repository:V.target.value})}),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Branch & folder options"),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"smart-tool-ref"},"Branch, tag or commit (optional)"),n.createElement("input",{id:"smart-tool-ref",value:o.ref,placeholder:"Repository default","data-action":"view.update",onChange:V=>i({ref:V.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"smart-tool-path"},"Package folder (optional)"),n.createElement("input",{id:"smart-tool-path",value:o.path,placeholder:"Repository root","data-action":"view.update",onChange:V=>i({path:V.target.value})})))),n.createElement(Xt,{name:"smart-tool-inspection",busy:jt(Y)},n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-operation-pending":jt(Y)||void 0,"aria-busy":jt(Y)||void 0,"data-action":"smartTools.inspect",disabled:!o.repository.trim()||F,onClick:()=>C("smartTools.inspect",ye())},n.createElement(Mt,null),"Inspect source")),n.createElement(ga,{operation:Y,busyMessage:"Reading the tool manifest…"}),je&&n.createElement("div",{className:"a-smart-source-summary"},n.createElement("strong",null,je.name||((Oe=je.manifest)==null?void 0:Oe.name)||((et=je.metadata)==null?void 0:et.name)||"Tool source"),n.createElement("p",null,je.description||((st=je.manifest)==null?void 0:st.description)||((It=je.metadata)==null?void 0:It.description)),n.createElement("dl",null,n.createElement("div",null,n.createElement("dt",null,"Revision"),n.createElement("dd",null,n.createElement("code",null,((xt=je.commit)==null?void 0:xt.slice(0,12))||je.revision||o.ref||"Default branch"))),je.version||(Ut=je.manifest)!=null&&Ut.version?n.createElement("div",null,n.createElement("dt",null,"Version"),n.createElement("dd",null,je.version||((rt=je.manifest)==null?void 0:rt.version))):null),(((Xe=je.manifest)==null?void 0:Xe.requires)||je.requires)&&n.createElement("div",{className:"a-smart-requirements"},n.createElement("h5",null,"Requirements from the tool author"),n.createElement("pre",null,typeof((($e=je.manifest)==null?void 0:$e.requires)||je.requires)=="string"?((Nt=je.manifest)==null?void 0:Nt.requires)||je.requires:Za(((Zt=je.manifest)==null?void 0:Zt.requires)||je.requires))))),n.createElement(Xt,{name:"smart-tool-installation",busy:jt(se)},n.createElement("label",{htmlFor:"smart-tool-extras"},"Optional package extras"),n.createElement("input",{id:"smart-tool-extras",value:o.extras,placeholder:"For example, mcp","data-action":"view.update",onChange:V=>i({extras:V.target.value})}),n.createElement("p",{className:"a-caption"},"Use extras documented by the tool author, separated by commas. An MCP adapter may be an optional extra."),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary","data-operation-pending":jt(se)||void 0,"aria-busy":jt(se)||void 0,"data-action":"smartTools.install",disabled:!o.repository.trim()||F,onClick:()=>C("smartTools.install",{...ye(),...o.extras.trim()?{extras:o.extras.split(",").map(V=>V.trim()).filter(Boolean)}:{}})},n.createElement(wa,null),oe?"Install source revision":"Install package")),n.createElement(ga,{operation:se,busyMessage:"Installing the package in its own environment…"}),(Ze==null?void 0:Ze.previousInstallationId)&&n.createElement("button",{type:"button",className:"a-soft","data-action":"updates.smartToolRollback",onClick:()=>t("updates.smartToolRollback",{id:Ze.id})},"Restore previous version"),Ze&&n.createElement("div",{className:"a-smart-source-summary"},n.createElement("strong",null,n.createElement(Pt,null),"Package installed"),Ze.binDir&&n.createElement(n.Fragment,null,n.createElement("p",null,"Executables are available in:"),n.createElement("code",{className:"a-smart-path"},Ze.binDir)),Ze.guidance&&n.createElement("p",null,typeof Ze.guidance=="string"?Ze.guidance:Za(Ze.guidance)),n.createElement("p",null,Ze.nextStep||"Use the tool’s documented MCP executable and arguments to add a connection."),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>{var V;ue(),i({connection:{...ao.connection,name:Ze.name||((V=Ze.manifest)==null?void 0:V.name)||"",command:"",installationId:Ze.id}})}},n.createElement(cm,null),"Configure MCP connection",n.createElement(Dr,null)),n.createElement("button",{type:"button",className:"a-link a-danger","data-action":"smartTools.uninstall",disabled:F,onClick:()=>C("smartTools.uninstall",{id:Ze.id})},n.createElement(ea,null),"Uninstall package"),n.createElement("p",{className:"a-caption"},"Remove dependent connections first. This deletes the app-managed package folder; work stored elsewhere is kept."),n.createElement(ga,{operation:A("smartTools.uninstall",{id:Ze.id})})))),o.page==="connection"&&n.createElement("form",{id:"smart-connection-form",onSubmit:async V=>{V.preventDefault();try{await C("smartTools.configure",{...k.id?{id:k.id}:{},name:k.name.trim(),transport:k.transport,...k.installationId?{installationId:k.installationId}:{},...k.transport==="stdio"?{command:k.command.trim(),args:k.args.split(` +`).map(ke=>ke.trim()).filter(Boolean),env:MD(k.env),...k.cwd.trim()?{cwd:k.cwd.trim()}:{}}:{url:k.url.trim(),auth:k.auth,headers:k.auth==="oauth"?{}:zD(k.headers)}})}catch(ke){d(ke.message)}}},n.createElement("h4",null,k.id?"Edit connection":"Add MCP connection"),n.createElement("p",null,"Save a connection, then connect when you are ready. Saving does not contact the server."),n.createElement("label",{htmlFor:"smart-tool-connection-name"},"Display name"),n.createElement("input",{id:"smart-tool-connection-name",required:!0,value:k.name,placeholder:"My Smart Tool","data-action":"view.update",onChange:V=>T({name:V.target.value})}),n.createElement("label",{htmlFor:"smart-tool-transport"},"Connection type"),n.createElement("select",{id:"smart-tool-transport",value:k.transport,"data-action":"view.update",onChange:V=>T({transport:V.target.value})},n.createElement("option",{value:"stdio"},"Local executable"),n.createElement("option",{value:"streamable-http"},"Remote MCP endpoint")),k.transport==="stdio"?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-command"},"Executable"),n.createElement("input",{id:"smart-tool-command",required:!0,value:k.command,placeholder:"/path/to/environment/bin/tool-mcp",spellCheck:!1,"data-action":"view.update",onChange:V=>T({command:V.target.value})}),n.createElement("label",{htmlFor:"smart-tool-arguments"},"Arguments — one per line"),n.createElement("textarea",{id:"smart-tool-arguments",value:k.args,spellCheck:!1,"data-action":"view.update",onChange:V=>T({args:V.target.value})}),n.createElement("p",{className:"a-caption"},"Each line is one argument. Shell commands are not evaluated."),n.createElement("label",{htmlFor:"smart-tool-cwd"},"Working folder (optional)"),n.createElement(Ma,{id:"smart-tool-cwd",value:k.cwd,onChange:V=>T({cwd:V}),directory:!0,state:e,act:t}),n.createElement("label",{htmlFor:"smart-tool-environment"},"Environment variable references (optional)"),n.createElement("textarea",{id:"smart-tool-environment",value:k.env,spellCheck:!1,placeholder:"TOOL_API_KEY=MY_TOOL_API_KEY","data-action":"view.update",onChange:V=>T({env:V.target.value})}),n.createElement("p",{className:"a-caption"},"Use CHILD_VARIABLE=APP_VARIABLE. Enter names, never key values.")):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-url"},"MCP endpoint"),n.createElement("input",{id:"smart-tool-url",type:"url",required:!0,value:k.url,placeholder:"https://example.com/mcp","data-action":"view.update",onChange:V=>T({url:V.target.value})}),n.createElement("label",{htmlFor:"smart-tool-auth"},"Authorization"),n.createElement("select",{id:"smart-tool-auth",value:k.auth,"data-action":"view.update",onChange:V=>T({auth:V.target.value})},n.createElement("option",{value:"environment"},"Header references or no authentication"),n.createElement("option",{value:"oauth"},"Browser sign-in (OAuth)")),k.auth==="environment"?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-headers"},"Header references (optional)"),n.createElement("textarea",{id:"smart-tool-headers",value:k.headers,placeholder:"Authorization=MY_TOOL_AUTHORIZATION","data-action":"view.update",onChange:V=>T({headers:V.target.value})}),n.createElement("p",{className:"a-caption"},"Use HEADER_NAME=APP_VARIABLE. The variable must contain the complete header value, such as a Bearer token. Never paste credentials here.")):n.createElement("p",{className:"a-caption"},"The server must support MCP OAuth discovery. Start sign-in after saving, then review the provider’s consent page.")),n.createElement(ga,{operation:A("smartTools.configure"),busyMessage:"Saving the connection…"}),n.createElement(Rn,null,n.createElement("button",{type:"submit",form:"smart-connection-form",className:"a-primary","data-action":"smartTools.configure",disabled:!k.name.trim()||!(k.transport==="stdio"?k.command:k.url).trim()||F},n.createElement(Pt,null),"Save connection"),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>O("home")},"View connections",n.createElement(Dr,null)))),(o.page==="server"||o.page==="tool")&&!b&&n.createElement(nt,{phase:"neutral",message:"This connection is no longer configured."}),o.page==="server"&&b&&n.createElement(Xt,{name:"smart-tool-connection-"+b.id,busy:jt(Ye)},n.createElement("div",{className:"a-smart-heading"},n.createElement("div",null,n.createElement("h4",null,b.name),n.createElement("p",null,b.connectionState||b.status||"Not connected"," · ",S.length," tools")),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Edit "+b.name,"data-action":"view.update",onClick:()=>ue(b)},n.createElement(ux,null))),n.createElement("div",{className:"a-smart-source-summary","data-part":"connector-account"},n.createElement("p",null,"Account identity: ",["verified","accepted"].includes((rn=b.account)==null?void 0:rn.status)?b.account.displayName||b.account.subject:((In=b.account)==null?void 0:In.status)==="changed"?"Changed — review required":((yn=b.account)==null?void 0:yn.status)==="unconfirmed"?"Unconfirmed — reconnect is blocked":"Unknown — the server has not supplied supported account details."),((Fn=b.account)==null?void 0:Fn.subject)&&n.createElement("p",{className:"a-caption"},b.account.issuer," · ",b.account.subject),((Gn=b.account)==null?void 0:Gn.provenance)&&n.createElement("p",{className:"a-caption"},"Server-attested through authenticated transport. This is not independent identity verification. Last observed: ",new Date(b.account.observedAt*1e3).toLocaleString(),"."),((An=b.account)==null?void 0:An.detail)&&n.createElement("p",null,b.account.detail),((Jt=b.account)==null?void 0:Jt.status)==="changed"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Previously accepted: ",b.account.expected.issuer," · ",b.account.expected.subject),n.createElement("p",null,"Reported now: ",b.account.candidate.displayName||b.account.candidate.subject," · ",b.account.candidate.issuer," · ",b.account.candidate.subject),n.createElement("p",{className:"a-caption"},"The connector attests this identity through its authenticated transport. Accepting saves this account choice; it does not reconnect or call a tool."),n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.accountAccept",disabled:F,onClick:()=>C("smartTools.accountAccept",{id:b.id,expectedRevision:b.account.revision,issuer:b.account.candidate.issuer,subject:b.account.candidate.subject})},"Accept this account change"))),((ut=(dn=b.authorization)==null?void 0:dn.requestedScopes)==null?void 0:ut.length)>0&&n.createElement("p",{className:"a-caption"},"Requested access: ",b.authorization.requestedScopes.join(", ")),n.createElement("p",{className:"a-caption"},"Granted access: ",((ge=(ve=b.authorization)==null?void 0:ve.grantedScopes)==null?void 0:ge.join(", "))||"Not reported"," · Consent: ",((At=b.authorization)==null?void 0:At.consent)||"Unknown"),b.auth==="oauth"&&n.createElement("div",{className:"a-smart-source-summary"},n.createElement("p",null,"Sign-in: ",((Ot=b.login)==null?void 0:Ot.phase)||"Not started"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.authStart",disabled:["starting","waiting"].includes((Kt=b.login)==null?void 0:Kt.phase),onClick:()=>C("smartTools.authStart",{id:b.id,redirectOrigin:window.location.origin})},"Sign in"),((Q=b.login)==null?void 0:Q.url)&&n.createElement("a",{className:"a-soft",href:b.login.url,target:"_blank",rel:"noopener noreferrer"},"Review access and authorize"),["starting","waiting"].includes((Yt=b.login)==null?void 0:Yt.phase)&&n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.authCancel",onClick:()=>C("smartTools.authCancel",{id:b.id})},"Cancel sign-in"),n.createElement("button",{type:"button",className:"a-link a-danger","data-action":"smartTools.authForget",onClick:()=>C("smartTools.authForget",{id:b.id})},"Forget local sign-in")),((qn=(En=b.login)==null?void 0:En.requestedScopes)==null?void 0:qn.length)>0&&b.login.requestedScopes.join(" ")!==((wn=(pn=b.authorization)==null?void 0:pn.requestedScopes)==null?void 0:wn.join(" "))&&n.createElement("p",null,"Requested access: ",b.login.requestedScopes.join(", ")),((mn=b.login)==null?void 0:mn.error)&&n.createElement(nt,{phase:"error",message:b.login.error}),n.createElement("p",{className:"a-caption"},"You complete consent with the provider. Forgetting sign-in removes local credentials; revoke remote access in your provider’s account settings.")),b.error&&n.createElement(nt,{phase:"error",message:b.error}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","aria-busy":jt(A("smartTools.connect",{id:b.id}))||void 0,"data-action":"smartTools.connect",disabled:F||["connected","ready"].includes(b.status),onClick:()=>C("smartTools.connect",{id:b.id})},n.createElement(cm,null),b.status==="connected"||b.status==="ready"?"Connected":"Connect"),n.createElement("button",{type:"button",className:"a-soft","aria-busy":jt(A("smartTools.disconnect",{id:b.id}))||void 0,"data-action":"smartTools.disconnect",disabled:F||!["connected","ready"].includes(b.status),onClick:()=>C("smartTools.disconnect",{id:b.id})},n.createElement(yx,null),"Disconnect"),n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.reconnect",disabled:F||["starting","waiting"].includes((_n=b.login)==null?void 0:_n.phase),onClick:()=>C("smartTools.reconnect",{id:b.id})},n.createElement(Mt,null),"Reconnect")),n.createElement(ga,{operation:Ye,busyMessage:"Updating the connection…"}),b.catalogState==="stale"&&n.createElement(nt,{phase:"neutral",message:"Tool definitions need a refresh before another call."}),n.createElement("button",{type:"button",className:"a-link","data-action":"smartTools.discover",disabled:F||!["connected","ready"].includes(b.status),onClick:()=>C("smartTools.discover",{id:b.id,refresh:!0})},"Refresh tool definitions"),n.createElement(ga,{operation:A("smartTools.discover",{id:b.id})}),S.length>4&&P,n.createElement("div",{className:"a-smart-list"},_.map(V=>{var ke,Ge,Dt;return n.createElement("button",{type:"button",key:V.name,className:"a-smart-list-row","data-action":"view.update",onClick:()=>{O("tool",{toolName:V.name,values:{},raw:!1,json:"{}"}),b.catalogState!=="stale"&&C("smartTools.schemas",{id:b.id,names:[V.name],catalogRevision:b.catalogRevision})}},n.createElement(Os,null),n.createElement("span",null,n.createElement("strong",null,V.title||((ke=V.annotations)==null?void 0:ke.title)||Pi(V.name)),n.createElement("small",null,V.description||V.name),((Dt=(Ge=V._meta)==null?void 0:Ge.ui)==null?void 0:Dt.resourceUri)&&n.createElement("small",{className:"a-smart-view-label"},"Interactive canvas view")),n.createElement(en,null))})),!S.length&&n.createElement("p",{className:"a-smart-empty"},"Connect to discover the tools supplied by this server."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-link a-danger",disabled:F,"data-action":"smartTools.remove",onClick:async()=>{await C("smartTools.remove",{id:b.id})&&O("home")}},n.createElement(ea,null),"Remove connection")),n.createElement("p",{className:"a-caption"},"Removing a connection keeps the installed package and the tool’s saved work.")),o.page==="tool"&&b&&!N&&n.createElement(nt,{phase:"neutral",message:"This tool is no longer in the server’s tool list. Reconnect to discover its current tools."}),o.page==="tool"&&N&&n.createElement(n.Fragment,null,n.createElement("h4",null,N.title||((on=N.annotations)==null?void 0:on.title)||Pi(N.name)),n.createElement("p",null,N.description),n.createElement("code",{className:"a-smart-tool-id"},b.name," / ",N.name),((mt=(pt=N._meta)==null?void 0:pt.ui)==null?void 0:mt.resourceUri)&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.open",disabled:F,onClick:qt},n.createElement(sa,null),"Open interactive view")),n.createElement(ga,{operation:A("smartTools.open",{id:b.id,tool:N.name}),busyMessage:"Opening the canvas view…"}),!x&&n.createElement(n.Fragment,null,n.createElement("p",null,"Load the current tool fields before making a call."),n.createElement("button",{type:"button",className:"a-soft","data-action":"smartTools.schemas",disabled:F||b.catalogState==="stale",onClick:()=>C("smartTools.schemas",{id:b.id,names:[N.name],catalogRevision:b.catalogRevision})},"Load tool fields")),n.createElement(ga,{operation:A("smartTools.schemas",{id:b.id})}),x&&n.createElement("form",{id:"smart-tool-form",onSubmit:V=>{V.preventDefault();try{const ke=_c(xe,o.values,o.raw,o.json);C("smartTools.call",{id:b.id,name:N.name,arguments:ke,catalogRevision:b.catalogRevision})}catch(ke){d(ke.message)}}},!ze&&!o.raw?n.createElement(LD,{schema:xe,values:o.values,edit:V=>i({values:V})}):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"smart-tool-json"},"Tool arguments (JSON)"),n.createElement("textarea",{id:"smart-tool-json",className:"a-json-editor",value:o.json,spellCheck:!1,"data-action":"view.update",onChange:V=>i({json:V.target.value})})),!ze&&n.createElement("button",{type:"button",className:"a-link a-smart-advanced","data-action":"view.update","aria-expanded":o.raw,onClick:()=>{try{if(o.raw){const V=_c(xe,{},!0,o.json);if(Object.keys(V).some(Ge=>!Object.hasOwn(xe.properties,Ge)))throw new Error("These arguments include extra properties. Keep the JSON editor to preserve them.");const ke=Object.fromEntries(Object.entries(V).map(([Ge,Dt])=>{var kn,sn;return[Ge,(sn=(kn=xe.properties)==null?void 0:kn[Ge])!=null&&sn.enum||typeof Dt=="object"?JSON.stringify(Dt):String(Dt)]}));i({raw:!1,values:ke})}else{let V;try{V=_c({...xe,required:[]},o.values,!1,"{}")}catch{V={}}i({raw:!0,json:Za(V)})}d("")}catch(V){d(V.message)}}},o.raw?"Use form fields":"Edit arguments as JSON"),n.createElement(Rn,null,n.createElement("button",{type:"submit",form:"smart-tool-form",className:"a-primary","data-operation-pending":jt(it)||void 0,"aria-busy":jt(it)||void 0,"data-action":"smartTools.call",disabled:F||!["connected","ready"].includes(b.status)},n.createElement(pg,null),"Run tool"))),n.createElement(Xt,{name:"smart-tool-result",busy:jt(it)},n.createElement(ga,{operation:it,busyMessage:"Running the tool…"}),n.createElement(OD,{operation:zt})))),a&&n.createElement("div",{className:"a-everyday-footer"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>r==null?void 0:r("tool-connections")},"Advanced tool connections",n.createElement(sa,null))))}function FD({state:e,act:t}){var x,A;const a=e.notificationSettings||{},r=((x=e.view)==null?void 0:x.maintenanceDraft)||{},[o,i]=v.useState(""),[s,l]=v.useState(""),[c,u]=v.useState(null),[d,p]=v.useState(""),[m,h]=v.useState(""),f=v.useRef({topic:0,token:0}),g=v.useRef(!1),E=C=>{t("view.update",{patch:{maintenanceDraft:{...r,...C}}})},y=C=>{f.current.topic++,i(C)},b=r.notifyEnabled??a.enabled??!1,S=r.notifyServer??a.server??"https://ntfy.sh",w=(A=e.actionStatus)==null?void 0:A["notifications.save"];v.useEffect(()=>{if(!(!c||(w==null?void 0:w.commandId)!==c.id||["queued","working"].includes(w.phase))){if(g.current=!1,u(null),w.phase==="error"){p(w.error||"Could not save. Your entries are kept.");return}w.phase==="ready"&&(f.current.topic===c.version.topic&&i(""),f.current.token===c.version.token&&l(""),h("Notification preferences saved."))}},[w==null?void 0:w.commandId,w==null?void 0:w.phase,c]);const N=async()=>{if(g.current)return;g.current=!0,p(""),h("");const C={...f.current};try{const O=await t("notifications.save",{patch:{desktop:r.notifyDesktop??a.desktop??!0,server:S,enabled:b,preview:r.notifyPreview??a.preview??!1,...o?{topic:o}:{},...s?{token:s}:{}}});if(!(O!=null&&O.accepted)||!O.operationId)throw Error((O==null?void 0:O.error)||"Could not save. Please retry.");u({id:O.operationId,version:C})}catch(O){g.current=!1,p(O.message)}};return n.createElement("div",{className:"a-notification-settings"},n.createElement("p",{className:"a-everyday-intro"},"Know when your response is ready, wherever you’re working."),n.createElement("section",{className:"a-notification-card"},n.createElement("label",{className:"a-everyday-toggle"},n.createElement("span",null,n.createElement("strong",null,"On this device"),n.createElement("small",null,"Show a browser notification when a response is ready.")),n.createElement("input",{type:"checkbox",checked:r.notifyDesktop??a.desktop??!0,"data-action":"view.update",onChange:C=>E({notifyDesktop:C.target.checked})})),n.createElement("p",{className:"a-caption"},"Your browser also needs permission."),n.createElement("button",{className:"a-link","data-action":"notification.request",onClick:()=>t("notification.request")},"Allow browser notifications")),n.createElement("section",{className:"a-notification-card"},n.createElement("label",{className:"a-everyday-toggle"},n.createElement("span",null,n.createElement("strong",null,"On another device"),n.createElement("small",null,a.enabled&&a.topicConfigured?"Connected through ntfy.":"Get notifications on your phone with ntfy.")),n.createElement("input",{type:"checkbox","data-action":"view.update",checked:b,onChange:C=>E({notifyEnabled:C.target.checked})})),n.createElement("details",{className:"a-everyday-disclosure",open:b||void 0},n.createElement("summary",null,a.topicConfigured?"Manage phone notifications":"Set up phone notifications"),n.createElement("div",{className:"a-notification-steps"},n.createElement("div",null,n.createElement("h4",null,"1. Open ntfy on your phone"),n.createElement("p",null,n.createElement("a",{href:"https://ntfy.sh",target:"_blank",rel:"noreferrer"},"Get the ntfy app"),", then subscribe to a topic. A topic is the name of your notification channel.")),n.createElement("div",null,n.createElement("h4",null,"2. Use the same topic here"),n.createElement("label",{htmlFor:"notify-topic"},"Topic name ",a.topicConfigured&&"(saved)"),n.createElement("div",{className:"a-topic-entry"},n.createElement("input",{id:"notify-topic",type:"password",autoComplete:"off",placeholder:a.topicConfigured?"Leave blank to keep your saved topic":"Your topic name",value:o,"data-private":"true","data-action":"notifications.save",onChange:C=>y(C.target.value)}),n.createElement("button",{className:"a-soft",onClick:()=>y("amplifier-"+crypto.randomUUID().replaceAll("-","").slice(0,20))},"Create a name")),o&&n.createElement("button",{className:"a-link",onClick:async()=>{var C;try{await navigator.clipboard.writeText(o),h("Topic copied. Subscribe to it in ntfy.")}catch{(C=document.getElementById("notify-topic"))==null||C.select(),h("Select and copy the topic, then subscribe to it in ntfy.")}}},"Copy topic name"),n.createElement("p",{className:"a-caption"},"Use an unguessable name or a protected topic. Anyone with access to the topic can read its notifications.")),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Server & account"),n.createElement("div",null,n.createElement("label",{htmlFor:"notify-server"},"Notification server"),n.createElement("input",{id:"notify-server",type:"url","data-action":"view.update",value:S,onChange:C=>E({notifyServer:C.target.value})}),n.createElement("p",{className:"a-caption"},"Use the same server in the ntfy app. The default is ntfy.sh."),n.createElement("label",{htmlFor:"notify-token"},"Access token (optional)",a.tokenConfigured?" · saved":""),n.createElement("input",{id:"notify-token",type:"password",autoComplete:"off","data-private":"true","data-action":"notifications.save",value:s,placeholder:a.tokenConfigured?"Leave blank to keep saved token":"",onChange:C=>{f.current.token++,l(C.target.value)}}),n.createElement("p",{className:"a-caption"},"For protected topics, create a token in your ntfy account. It stays private on this host."))),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:r.notifyPreview??a.preview??!1,onChange:C=>E({notifyPreview:C.target.checked})}),"Include a response preview"),n.createElement("p",{className:"a-caption"},"Off by default. Notifications say your response is ready without including its content.")))),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:!!c||b&&!o&&!a.topicConfigured,"data-action":"notifications.save",onClick:N},c?"Saving…":"Save notifications")),d&&n.createElement(nt,{phase:"error",message:d}),n.createElement(nt,{phase:"ready",message:m}))}const qD=()=>({id:crypto.randomUUID(),name:"Personal server",url:"",enabled:!1,streams:["sessions","workers","tools","usage","updates"],workspace:"amplifier-unified",workspacePattern:"*",includePaths:!1,authMode:"static",apiKeyEnv:"AMPLIFIER_CONTEXT_INTELLIGENCE_API_KEY",authResource:""});function UD({state:e,act:t}){var y,b,S,w,N,x,A,C,O,k,T,I,F,z,q,W,X;const a=U=>{var _,P;return["queued","working","pending"].includes((P=(_=e.actionStatus)==null?void 0:_[U])==null?void 0:P.phase)},r=e.diagnostics||{},o=((y=e.view)==null?void 0:y.diagnosticsDraft)||{},i=o.config||r.config,s=r.streams||[];if(!i)return null;const l=U=>t("view.update",{patch:{diagnosticsDraft:{...o,...U}}}),c=U=>l({config:{...i,...U}}),u=i.destinations.find(U=>U.id===o.destinationId),d=U=>c({destinations:i.destinations.map(_=>_.id===u.id?{..._,...U}:_)}),p=async()=>{const U=await t("diagnostics.configure",{config:i});U!=null&&U.accepted&&l({config:null})},m=r.lastResult,h=u&&((b=r.destinations)==null?void 0:b.find(U=>U.id===u.id)),f=u&&((S=r.results)==null?void 0:S[u.id]),g=(U,_,P)=>P?[...U,_]:U.filter(G=>G!==_),E=(U,_,P=!1)=>n.createElement("div",{className:"a-diagnostic-streams"},s.map(G=>n.createElement("label",{className:"a-inline-checkbox",key:G.id},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:U.includes(G.id),disabled:!P&&!i.streams.includes(G.id),onChange:Z=>_(g(U,G.id,Z.target.checked))}),n.createElement("span",null,G.label))));return n.createElement(Pa,{id:"diagnostics",title:"Diagnostics & Context Intelligence",summary:"Local capture, selected streams and your servers",state:e,act:t},n.createElement("p",null,"Keep diagnostic records on this computer, or send selected streams to your own Context Intelligence servers. Each server has its own choices. App forwarding starts only after you save an enabled destination. Bundle exporters have their own settings."),u?n.createElement(Xt,{name:"diagnostic-destination-"+u.id,busy:(f==null?void 0:f.phase)==="working"},n.createElement("button",{className:"a-link a-diagnostics-back","data-action":"view.update",onClick:()=>l({destinationId:null})},n.createElement(Sa,null),"All destinations"),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Name",n.createElement("input",{"data-action":"view.update",value:u.name,onChange:U=>d({name:U.target.value})})),n.createElement("label",null,"Server URL",n.createElement("input",{type:"url",placeholder:"https://context.example.com","data-action":"view.update",value:u.url,onChange:U=>d({url:U.target.value})}))),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:u.enabled,onChange:U=>d({enabled:U.target.checked})}),"Send new selected records to this server"),n.createElement("label",null,"Authentication",n.createElement("select",{"data-action":"view.update",value:u.authMode,onChange:U=>d({authMode:U.target.value})},n.createElement("option",{value:"static"},"API key from environment"),n.createElement("option",{value:"entra"},"Microsoft Entra"))),u.authMode==="static"?n.createElement(n.Fragment,null,n.createElement("label",null,"API key environment variable",n.createElement("input",{"data-action":"view.update",value:u.apiKeyEnv,onChange:U=>d({apiKeyEnv:U.target.value})})),n.createElement("button",{className:"a-soft","data-action":"diagnostics.environment",onClick:()=>t("diagnostics.environment",{name:u.apiKeyEnv})},"Check variable"),(m==null?void 0:m.action)==="diagnostics.environment"&&m.name===u.apiKeyEnv&&n.createElement(nt,{...m})):n.createElement("label",null,"Entra resource URI",n.createElement("input",{"data-action":"view.update",value:u.authResource,placeholder:"api://application-id",onChange:U=>d({authResource:U.target.value})})),n.createElement("h4",null,"Streams for this server"),E(u.streams,U=>d({streams:U})),n.createElement("p",{className:"a-caption"},"Conversation text may contain private information. Redaction is best effort. Tool arguments, results, reasoning, file contents and canvas HTML are excluded from metadata streams."),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Server workspace label",n.createElement("input",{"data-action":"view.update",value:u.workspace,onChange:U=>d({workspace:U.target.value})})),n.createElement("label",null,"Capture from workspace paths",n.createElement("input",{"data-action":"view.update",value:u.workspacePattern,placeholder:"* or /Users/me/work/*",onChange:U=>d({workspacePattern:U.target.value})}))),n.createElement("p",{className:"a-caption"},"The label organizes records; it is not an access boundary on a shared server. Path filters use * and ? wildcards."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:u.includePaths,onChange:U=>d({includePaths:U.target.checked})}),"Include workspace folder paths in remote records"),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"diagnostics.configure",onClick:p},"Save destination")),n.createElement("button",{className:"a-soft","data-operation-pending":(f==null?void 0:f.phase)==="working"||void 0,"aria-busy":(f==null?void 0:f.phase)==="working"||void 0,"data-action":"diagnostics.test",disabled:!!o.config||(f==null?void 0:f.phase)==="working",onClick:()=>t("diagnostics.test",{id:u.id})},"Test connection"),n.createElement("button",{className:"a-soft","data-action":"diagnostics.retry",disabled:!((w=h==null?void 0:h.counts)!=null&&w.failed),onClick:()=>t("diagnostics.retry",{id:u.id})},n.createElement(Mt,null),"Retry failed deliveries")),n.createElement("p",{className:"a-caption"},"Save before testing. A test sends one synthetic event to verify authentication and write access."),!o.config&&n.createElement(nt,{...f}),n.createElement("p",{className:"a-caption"},((N=h==null?void 0:h.counts)==null?void 0:N.accepted)||0," accepted · ",((x=h==null?void 0:h.counts)==null?void 0:x.duplicate)||0," recognized retries · ",((A=h==null?void 0:h.counts)==null?void 0:A.pending)||0," queued · ",((C=h==null?void 0:h.counts)==null?void 0:C.failed)||0," failed · ",((O=h==null?void 0:h.counts)==null?void 0:O.cancelled)||0," cancelled"),(h==null?void 0:h.error)&&n.createElement(nt,{phase:"error",message:`Delivery needs attention: ${h.error.type}${h.error.statusCode?" (HTTP "+h.error.statusCode+")":""}`}),n.createElement("button",{className:"a-soft a-danger","data-action":"diagnostics.configure",onClick:async()=>{const U=await t("diagnostics.configure",{config:{...i,destinations:i.destinations.filter(_=>_.id!==u.id)}});U!=null&&U.accepted&&l({config:null,destinationId:null})}},n.createElement(ea,null),"Remove destination")):n.createElement(n.Fragment,null,n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:i.enabled,onChange:U=>c({enabled:U.target.checked})}),"Collect app diagnostics and enable selected forwarding"),n.createElement("p",{className:"a-caption"},"Sessions use the community Context Intelligence hook and shared files. The choices below control this app’s metadata index and forwarding; they do not disable the hook."),n.createElement("h4",null,"Model request details"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:i.providerRequests===!0,onChange:U=>c({providerRequests:U.target.checked})}),"Record provider requests for troubleshooting"),n.createElement("p",{className:"a-caption"},"Off by default. Applies to supported provider connections and delegated work when conversations next prepare, without interrupting current work. Explicit provider opt-outs are kept. Earlier calls cannot be recovered."),n.createElement("p",{className:"a-caption"},"Saved requests can contain private messages, instructions, tool inputs, and attachments. Recognizable credentials are redacted and each record is size limited. Providers may also record responses; some adapters expose only a summary. Records stay in the existing session logs; any configured bundle exporters still apply."),n.createElement("h4",null,"Streams to index and make available for forwarding"),E(i.streams,U=>c({streams:U,destinations:i.destinations.map(_=>({..._,streams:_.streams.filter(P=>U.includes(P))}))}),!0),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Index days",n.createElement("input",{type:"number",min:"1",max:"365",value:i.retentionDays,"data-action":"view.update",onChange:U=>c({retentionDays:Number(U.target.value)})})),n.createElement("label",null,"Maximum indexed records",n.createElement("input",{type:"number",min:"100",max:"100000",value:i.maxRecords,"data-action":"view.update",onChange:U=>c({maxRecords:Number(U.target.value)})}))),n.createElement("p",{className:"a-caption"},"These limits apply to the local index and queued deliveries. Shared Context Intelligence events.jsonl files are preserved. Indexed: ",(k=r.local)!=null&&k.storageError&&((T=r.local)==null?void 0:T.records)==null?"unavailable":(((I=r.local)==null?void 0:I.records)??0)+" records",".",(F=r.local)!=null&&F.dropped||(z=r.local)!=null&&z.outboxDropped||(q=r.local)!=null&&q.expiredPending?` Dropped: ${r.local.dropped||0}; outbox limit: ${r.local.outboxDropped||0}; expired before delivery: ${r.local.expiredPending||0}.`:""),((W=r.local)==null?void 0:W.configurationError)&&n.createElement(nt,{phase:"error",message:"The saved diagnostics configuration could not be read. Capture and forwarding are disabled; save reviewed settings to restore them."}),((X=r.local)==null?void 0:X.storageError)&&n.createElement(nt,{phase:"error",message:"Local diagnostic storage needs attention. Conversations can continue."}),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"diagnostics.configure",onClick:p},"Save capture settings")),n.createElement("h4",null,"Destinations"),n.createElement("div",{className:"a-diagnostic-destinations"},i.destinations.map(U=>{var P;const _=(P=r.destinations)==null?void 0:P.find(G=>G.id===U.id);return n.createElement("button",{className:"a-settings-group-title","data-action":"view.update",key:U.id,onClick:()=>l({destinationId:U.id})},n.createElement("span",null,n.createElement("strong",null,U.name),n.createElement("small",null,U.enabled?"Sending selected streams":"Disabled"," · ",U.streams.length," streams",_!=null&&_.error?" · Needs attention":"")),n.createElement(mo,null))})),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{const U=qD();l({config:{...i,destinations:[...i.destinations,U]},destinationId:U.id})}},n.createElement(Ln,null),"Add server"),n.createElement("p",{className:"a-caption"},"Saving a changed destination cancels its old pending deliveries. Data already accepted or in flight cannot be recalled. Selecting another stream starts with new records; history is never uploaded automatically."),n.createElement(Xt,{name:"diagnostic-records",busy:a("diagnostics.records")},n.createElement("h4",null,"Inspect local records"),n.createElement("div",{className:"a-form-grid"},n.createElement("label",null,"Stream filter",n.createElement("input",{"data-action":"view.update",value:o.stream||"*",onChange:U=>l({stream:U.target.value}),placeholder:"* or updates"})),n.createElement("label",null,"Session ID (optional)",n.createElement("input",{"data-action":"view.update",value:o.sessionId||"",onChange:U=>l({sessionId:U.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"diagnostics.records",onClick:()=>t("diagnostics.records",{stream:o.stream||"*",...o.sessionId?{sessionId:o.sessionId}:{}})},"Read records"),(m==null?void 0:m.action)==="diagnostics.records"&&n.createElement(n.Fragment,null,n.createElement("button",{className:"a-soft","data-action":"diagnostics.export",onClick:()=>t("diagnostics.export")},n.createElement(wa,null),"Export this page"),m.nextBefore&&n.createElement("button",{className:"a-soft","data-action":"diagnostics.records",onClick:()=>t("diagnostics.records",{stream:o.stream||"*",...o.sessionId?{sessionId:o.sessionId}:{},before:m.nextBefore})},"Older records"))),(m==null?void 0:m.action)==="diagnostics.records"&&n.createElement("pre",{className:"a-state-view"},JSON.stringify(m.items,null,2)))),(m==null?void 0:m.action)!=="diagnostics.records"&&(m==null?void 0:m.action)!=="diagnostics.test"&&(m==null?void 0:m.action)!=="diagnostics.environment"&&n.createElement(nt,{phase:(m==null?void 0:m.phase)||"ready",message:m==null?void 0:m.message}))}const qf=1e6;async function jD(e,t={}){var r,o;if(!e)throw new Error("Choose a conversation export.");if(e.size>qf)throw new Error("Choose a conversation export smaller than 1 MB.");if(!/\.(json|jsonl)$/i.test(e.name||""))throw new Error("Choose a JSON or JSONL conversation export.");const a=await e.text();if(new TextEncoder().encode(a).length>qf)throw new Error("Choose a conversation export smaller than 1 MB.");if(!a.trim())throw new Error("The selected conversation export is empty.");return{content:a,format:/\.jsonl$/i.test(e.name)?"jsonl":"json",...(r=t.title)!=null&&r.trim()?{title:t.title.trim()}:{},...(o=t.bundle)!=null&&o.trim()?{bundle:t.bundle.trim()}:{}}}function $D({state:e,act:t}){var f,g,E,y,b,S,w;const a=v.useContext(Ju);v.useEffect(()=>{a==="notifications"&&t("notifications.get")},[a]);const r=(f=e.sessions)==null?void 0:f.find(N=>N.id===e.selectedSessionId),o=((g=e.view)==null?void 0:g.maintenanceDraft)||{},i=e.permissions||{};e.notificationSettings;const s=((E=e.management)==null?void 0:E.phase)==="working",l=N=>{var A,C;const x=(A=e.actionStatus)==null?void 0:A[N];return["queued","working"].includes(x==null?void 0:x.phase)&&(!((C=x.target)!=null&&C.sessionId)||x.target.sessionId===(r==null?void 0:r.id))},c=N=>t("view.update",{patch:{maintenanceDraft:{...o,...N}}}),u=o.scope||"global",d=o.resetParts||[],p=(y=e.maintenance)==null?void 0:y.resetPreview,m=p&&JSON.stringify([...d].sort())===JSON.stringify([...p.parts||[]].sort()),h=(N,x={})=>t(N,{...r?{sessionId:r.id}:{},...x});return n.createElement("div",{"data-part":"maintenance"},n.createElement(UD,{state:e,act:t}),n.createElement(Pa,{id:"history",title:"Conversation history",state:e,act:t},n.createElement("p",null,"Your CLI projects and conversations appear automatically in the workspace sidebar. Open a chat there to continue the same conversation, or export its transcript here."),r&&n.createElement("button",{className:"a-soft","aria-busy":l("history.export")||void 0,"data-action":"history.export",onClick:()=>h("history.export",{format:"jsonl"})},"Export runtime transcript"),n.createElement("div",{className:"a-selection-card"},n.createElement("h4",null,"Import a conversation file"),n.createElement("p",null,"Load a Unified JSON export or CLI JSONL transcript as a new conversation."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"history-import-title"},"Conversation title (optional)"),n.createElement("input",{id:"history-import-title",value:o.importTitle||"","data-action":"view.update",onChange:N=>c({importTitle:N.target.value})})),n.createElement("details",null,n.createElement("summary",null,"Advanced import options"),n.createElement("label",{htmlFor:"history-import-bundle"},"Bundle override (optional)"),n.createElement("input",{id:"history-import-bundle",value:o.importBundle||"","data-action":"view.update",onChange:N=>c({importBundle:N.target.value}),placeholder:"Use the export’s bundle"}))),n.createElement("label",{htmlFor:"history-import-file"},"Choose JSON or JSONL (up to 1 MB)"),n.createElement(Cg,{id:"history-import-file",accept:".json,.jsonl,application/json,application/x-ndjson",disabled:s,action:"history.importFile",label:"Choose a conversation",hint:"Drop JSON or JSONL here · up to 1 MB",onFile:async N=>{const x=await jD(N,{title:o.importTitle,bundle:o.importBundle});c({importError:""}),await t("history.importFile",x)}}),o.importError&&n.createElement("p",{className:"a-danger",role:"alert"},o.importError),n.createElement("p",{className:"a-caption"},"Original transcript entries are preserved. Imported jobs do not restart automatically.")),n.createElement("label",null,"Older than (days)",n.createElement("input",{type:"number",min:"1",value:o.cleanupDays||30,"data-action":"view.update",onChange:N=>c({cleanupDays:Number(N.target.value)})})),n.createElement("button",{className:"a-soft","aria-busy":l("history.cleanup")||void 0,"data-action":"history.cleanup",onClick:()=>t("history.cleanup",{days:o.cleanupDays||30})},"Preview cleanup"),e.cleanupPreview&&n.createElement(n.Fragment,null,n.createElement("p",null,e.cleanupPreview.sessions.length," inactive conversations eligible. Your selected conversation is kept."),n.createElement("label",null,n.createElement("input",{type:"checkbox","data-action":"view.update",checked:!!o.purge,onChange:N=>c({purge:N.target.checked})}),"Also remove retained legacy app files (shared CLI history is kept)"),n.createElement("button",{className:"a-soft a-danger","aria-busy":l("history.cleanup")||void 0,"data-action":"history.cleanup",disabled:!e.cleanupPreview.sessions.length,onClick:()=>t("history.cleanup",{days:o.cleanupDays||30,apply:!0,purge:!!o.purge})},"Clean up these conversations"))),n.createElement(Pa,{id:"permissions",title:"File access",state:e,act:t},n.createElement(Xt,{className:"a-settings-page-body",name:"permissions-preferences",busy:l("permissions.get")},n.createElement("p",null,"File tools can write within your project by default. Add other allowed locations below. Denied locations take precedence, and individual tools may apply stricter limits. Shell commands and other tools can have separate policies."),n.createElement("p",{className:"a-caption"},"These fields edit write overrides at the selected scope. Empty fields do not show all effective access: inherited settings and bundle restrictions can still apply."),n.createElement("label",null,"Edit overrides for",n.createElement("select",{value:u,"data-action":"view.update",onChange:N=>c({scope:N.target.value})},n.createElement("option",{value:"global"},"All projects"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This computer’s project settings"))),n.createElement("button",{className:"a-soft","aria-busy":l("permissions.get")||void 0,"data-action":"permissions.get",disabled:!r,onClick:()=>h("permissions.get",{scope:u})},"Load permissions"),n.createElement("label",{htmlFor:"allowed-folders"},"Allowed folders (one per line)"),n.createElement(Ma,{id:"allowed-folders",multiline:!0,directory:!0,state:e,act:t,value:o.allowed??(i.allowed||[]).join(` `),onChange:N=>c({allowed:N})}),n.createElement("label",{htmlFor:"denied-folders"},"Denied folders (one per line)"),n.createElement(Ma,{id:"denied-folders",multiline:!0,directory:!0,state:e,act:t,value:o.denied??(i.denied||[]).join(` `),onChange:N=>c({denied:N})}),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:!r||s,"aria-busy":l("permissions.save")||void 0,"data-action":"permissions.save",onClick:()=>h("permissions.save",{scope:u,allowed:(o.allowed??(i.allowed||[]).join(` `)).split(` @@ -850,16 +850,16 @@ container holding the app. Specify either width or maxWidth, and either height o `)).split(` `).filter(Boolean)})},"Save permissions")),i.detail&&n.createElement("p",null,i.detail))),n.createElement(Pa,{id:"notifications",title:"Notifications",state:e,act:t},n.createElement(FD,{state:e,act:t})),n.createElement(Pa,{id:"automation",title:"Terminal and automation",state:e,act:t},n.createElement("p",null,"Run a task without opening the web app. It uses the same Amplifier host, saved configuration, and tool permissions."),n.createElement("pre",{className:"a-state-view"},`amplifier-unified run "Summarize the changes in this workspace" amplifier-unified run "Review this project" --output-format json -amplifier-unified continue --resume SESSION_ID "Continue the work"`),n.createElement("p",{className:"a-caption"},"Use --bundle to choose a bundle and --provider / --model to select a model. JSON output is suitable for scripts; json-trace also includes execution events. Headless runs cannot answer an interactive approval prompt.")),n.createElement(Pa,{id:"repair",title:"Backup and repair",state:e,act:t},n.createElement("p",null,"Save a full private backup of your configuration, credentials, and conversations, or repair installed runtime dependencies. Repair waits until work is idle."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","aria-busy":l("maintenance.backup")||void 0,"data-action":"maintenance.backup",disabled:s,onClick:()=>t("maintenance.backup")},"Create full backup"),n.createElement("button",{className:"a-soft","aria-busy":l("maintenance.repair")||void 0,"data-action":"maintenance.repair",disabled:s,onClick:()=>t("maintenance.repair")},"Repair runtime")),n.createElement("p",{className:"a-caption"},"Backups contain credentials and are not encrypted. Keep them private."),((b=e.maintenance)==null?void 0:b.backup)&&n.createElement("p",{className:"a-caption a-wrap"},"Saved backup: ",e.maintenance.backup),((S=e.maintenance)==null?void 0:S.detail)&&n.createElement("p",null,e.maintenance.detail)),n.createElement(Pa,{id:"reset",title:"Advanced recovery",state:e,act:t},n.createElement("p",null,"Reset selected app data when ordinary repair is not enough. Your workspace files and original CLI data are kept."),[["runtime","Rebuild installed runtime"],["cache","Clear downloaded bundle and module caches"],["settings","Reset app configuration and credentials"],["conversations","Remove saved conversations from the app"]].map(([N,x])=>n.createElement("label",{className:"a-inline-checkbox",key:N},n.createElement("input",{type:"checkbox",checked:d.includes(N),"data-action":"view.update",onChange:A=>c({resetParts:A.target.checked?[...d,N]:d.filter(C=>C!==N),resetConfirmation:""})}),x)),n.createElement("button",{className:"a-soft",disabled:s||!d.length,"aria-busy":l("maintenance.reset")||void 0,"data-action":"maintenance.reset",onClick:()=>t("maintenance.reset",{parts:d})},"Preview selected reset"),m&&n.createElement("div",{className:"a-selection-card"},n.createElement("p",null,"These locations will be moved into a recovery folder:"),n.createElement("ul",{className:"a-catalog-list"},(p.paths||[]).map((N,x)=>n.createElement("li",{className:"a-wrap",key:x},n.createElement("code",null,typeof N=="string"?N:JSON.stringify(N))))),n.createElement("label",{htmlFor:"reset-confirmation"},"Type RESET to apply this selection"),n.createElement("input",{id:"reset-confirmation",value:o.resetConfirmation||"","data-action":"view.update",onChange:N=>c({resetConfirmation:N.target.value})}),n.createElement("button",{className:"a-soft a-danger",disabled:s||o.resetConfirmation!=="RESET","aria-busy":l("maintenance.reset")||void 0,"data-action":"maintenance.reset",onClick:()=>t("maintenance.reset",{parts:d,apply:!0,confirmation:o.resetConfirmation})},"Apply selected reset")),((w=e.maintenance)==null?void 0:w.retained)&&n.createElement("p",{className:"a-caption a-wrap"},"Original files retained at: ",e.maintenance.retained)))}function BD(e={},t={}){var b,S,w,N,x,A,C,O,k,T,I,F,z,U;const a=e.application||(e.items||[]).find(H=>H.kind==="app")||{},r=e.sequence||{},o=(e.items||[]).filter(H=>H.kind!=="app"&&H.id!=="application"),i=o.filter(H=>["check_failed","local_changes"].includes(H.status)),s=Math.max(o.filter(H=>H.status==="update").length,(((b=r.included)==null?void 0:b.available)||0)+(((S=r.other)==null?void 0:S.available)||0)),l=a.status==="update",c=l||s>0||!!e.pendingApp||!!e.pendingRelease,u=l&&a.canInstall===!1||e.pendingReplacement!=null||!!e.pendingRestart||!!(r.stage==="included"&&((w=r.included)!=null&&w.issues)),d=e.pendingReplacement!=null||!!e.error||["error","interrupted"].includes(e.phase)||((N=e.pendingRestart)==null?void 0:N.requestStatus)==="rejected"||a.status==="check_failed"||!!(r.stage==="included"&&((x=r.included)!=null&&x.issues)),p=["checking","staging","validating","activating"].includes(e.phase),m=r.nextStage||r.stage||"application",h=(A=e.diagnostics)==null?void 0:A.batch,f=(h==null?void 0:h.attemptId)===((C=e.diagnostics)==null?void 0:C.attemptId)?h:null,g=e.probeProgress,y=f&&(g==null?void 0:g.attemptId)===f.attemptId&&e.phase==="validating"&&Number.isInteger(g.total)&&Number.isInteger(g.completed)&&g.total>=0&&g.completed>=0&&g.completed<=g.total?g:null,E={stage:m,installable:c,blocked:u,busy:p||!!r.nextStage||e.pendingReplacement!=null,continuing:!!r.install,currentBatch:f,currentProgress:y,completedBatches:(((O=e.diagnostics)==null?void 0:O.completedBatches)||[]).slice(-5),title:"Check for updates",detail:"We’ll check Amplifier and the components it uses.",tone:"neutral"};if(d)return{...E,title:"Updates need attention",tone:"error",detail:e.pendingReplacement!=null?"The installation needs verification before work can continue. Open details for the recovery steps.":e.pendingRestart?"The app update needs help finishing its restart. Open details for the next step.":(k=r.included)!=null&&k.issues?"Some required components could not be updated. Your existing configuration is preserved. Review the issue below.":"The update could not finish. Review the issue below before trying again."};if(e.pendingRestart)return{...E,title:e.pendingRestart.requestStatus==="uncertain"?"Waiting for restart confirmation":"Restarting Amplifier",detail:"Waiting for a healthy restarted app before continuing with the remaining updates.",tone:"working"};if(e.pendingApp||e.pendingRelease||(T=e.pendingSmartTools)!=null&&T.length)return{...E,title:"Waiting for your work to finish",detail:"The update is ready. It will continue automatically when conversations, tools, and calls are idle.",tone:"working"};if(p){const H=y?`${y.phase==="prepare"?"Preparing":"Checking"} configurations: ${y.completed} of ${y.total} completed. Failed checks do not count as completed.`:null;return{...E,title:e.phase==="checking"?"Checking for updates":(f==null?void 0:f.kind)==="smart-tools"?"Updating Smart Tools":m==="application"?"Updating Amplifier":m==="included"?"Updating included components":"Updating other components",detail:H||e.detail||(e.phase==="checking"?m==="application"?"Checking for a new app version first.":m==="included"?"Checking included components…":"Checking other components…":"Preparing and verifying the update…"),tone:"working"}}return r.nextStage||r.install&&c?{...E,title:"Updating Amplifier",detail:m==="included"?"Continuing with included components…":"Continuing with other components…",tone:"working"}:c?{...E,title:"Updates available",detail:(l?String(a.current||"").replace(/^v/,"")===String(a.latest||"").replace(/^v/,"")?"App component updates are ready. ":"A new app version is ready. ":"")+(s?`${s} component ${s===1?"update is":"updates are"} ${l?"also ":""}ready. `:"")+(t.autoInstall!==!1?"They’ll install automatically when work is idle.":"One update request handles the app and all eligible components."),tone:"available"}:i.length||(I=r.included)!=null&&I.issues||(F=r.other)!=null&&F.issues?{...E,title:"Some updates need attention",detail:"No installable updates remain, but some checks or local changes need review.",tone:"error"}:r.stage==="complete"?{...E,title:"You’re up to date",detail:(z=r.included)!=null&&z.protected||(U=r.other)!=null&&U.protected?"All eligible updates are complete. Pinned versions and local overrides were kept.":"Amplifier and its eligible components are up to date.",tone:"ready"}:a.status==="release_channel_needed"?{...E,title:"Automatic app updates aren’t configured",detail:"This installation needs a release channel. Component updates and technical details are available below."}:e.lastCheck?{...E,title:"App checked · components not fully checked",detail:"Run a check to confirm the full update status."}:E}const HD={"candidate-install":"Prepare application","candidate-probe":"Check candidate package","candidate-version":"Check candidate version","candidate-record":"Save candidate validation","target-discovery":"Find active installation","runtime-close":"Stop idle runtimes","recovery-record":"Save recovery reference","replacement-install":"Install application","replacement-probe":"Check installed package","replacement-version":"Check installed version","restart-configuration":"Prepare restart settings","restart-helper-file":"Prepare restart helper","restart-helper":"Start restart helper","service-restart":"Restart system service","service-restart-request":"Request service restart","restart-request":"Request restart","restart-readiness":"Check restarted host readiness","restart-ack":"Confirm restarted version","restart-reconcile":"Verify current installation","activation-validation":"Check staged release","ecosystem-copy":"Prepare ecosystem copy","ecosystem-source-preflight":"Check cached source changes","ecosystem-runtime-preflight":"Check installed worker sources","ecosystem-runtime-lock":"Resolve worker dependencies","ecosystem-runtime-policy":"Prepare worker installer policy","ecosystem-runtime-freeze":"Record qualified worker","ecosystem-runtime-freeze-install":"Verify recorded worker","ecosystem-validation":"Validate ecosystem","ecosystem-fetch":"Fetch source update","ecosystem-checkout":"Switch staged source","ecosystem-probe":"Check bundles and modules","ecosystem-prepare":"Prepare bundle dependencies","ecosystem-compatibility":"Check frozen bundle compatibility","smart-tool-stage":"Prepare Smart Tool update","smart-tool-activate":"Verify and activate Smart Tool","ecosystem-activation":"Activate ecosystem","ecosystem-stage":"Prepare ecosystem",stage:"Prepare application update"},Uf={"host-component-conflict":"App behavior module identities conflict. Review duplicate module declarations and instance IDs in Bundles & modules; the current ecosystem is preserved.","module-prepare-failed":"A module could not be prepared in the new worker. The current ecosystem is preserved; review its dependencies before retrying.","bundle-not-found":"A configured bundle could not be found. Review its registration in Bundles & modules.","bundle-load-failed":"A configured bundle could not be loaded. Review its source and dependencies in Bundles & modules.","bundle-validation-failed":"A configured bundle did not pass validation. Review its configuration before retrying.","bundle-dependency-failed":"A bundle dependency could not be prepared. Review its source and dependency configuration.","protected-runtime-source":"Local source changes or an explicit dependency override were preserved. Review this module in Bundles & modules and preserve its source configuration before checking for updates again.","runtime-source-changed":"Worker sources changed while checking. Let source changes finish, then check for updates again."},VD={started:"Running",accepted:"Accepted",rejected:"Rejected",uncertain:"Unconfirmed",succeeded:"Succeeded",failed:"Failed",interrupted:"Interrupted"},jf=["failed","interrupted","rejected"],As=e=>HD[e]||(e==null?void 0:e.replaceAll("-"," "))||"Update";function WD(e,t){const a=["id","at","attemptId","kind","phase","status","revision","commandId","durationMs","exitCode","stdoutBytes","stderrBytes","errorType","timedOut","expectedVersion","observedVersion","expectedRevision","observedRevision","reason","package"],r=i=>{if(!i)return;const s=Object.fromEntries(a.filter(l=>i[l]!==void 0).map(l=>[l,i[l]]));return i.probe&&(s.probe=Object.fromEntries(["ok","isolated","packageInEnvironment","frontendPresent","loginAvailable","standalone","providersPresent","cliAbsent","dependenciesPrepared","stage","errorType","version","pythonVersion","reason"].filter(l=>i.probe[l]!==void 0).map(l=>[l,i.probe[l]]))),s},o=t?Object.fromEntries(["attemptId","version","revision","verifiedAt"].filter(i=>t[i]!==void 0).map(i=>[i,t[i]])):void 0;return JSON.stringify({attemptId:e.attemptId,lastFailure:r(e.lastFailure),reconciliation:o,events:(e.events||[]).slice(-50).map(r)},null,2)}function nk(e){var o;const t=e.reconciliation,a=(o=e.diagnostics)==null?void 0:o.lastFailure,r=e.application||(e.items||[]).find(i=>i.kind==="app")||{};return!!(a!=null&&a.attemptId&&(t==null?void 0:t.attemptId)===a.attemptId&&Number.isFinite(t.verifiedAt)&&t.verifiedAt>0&&typeof t.version=="string"&&t.version===r.current&&(!r.runningRevision||t.revision===r.runningRevision)&&!e.error&&!e.pendingRestart&&!e.pendingApp&&e.pendingReplacement==null)}function di(e){var a,r,o,i;const t=[];return e.package&&t.push(e.package),Uf[e.reason||((a=e.probe)==null?void 0:a.reason)]&&t.push(Uf[e.reason||((r=e.probe)==null?void 0:r.reason)]),(o=e.probe)!=null&&o.errorType?t.push(e.probe.errorType):e.errorType&&t.push(e.errorType),(i=e.probe)!=null&&i.stage&&e.probe.stage!=="complete"&&t.push("Probe: "+e.probe.stage),e.timedOut&&t.push("Timed out"),e.exitCode!==void 0&&t.push("Exit "+e.exitCode),e.expectedVersion&&t.push("Expected "+e.expectedVersion),e.observedVersion&&t.push("Found "+e.observedVersion),e.expectedRevision&&t.push("Expected revision "+e.expectedRevision.slice(0,12)),e.observedRevision&&t.push("Found revision "+e.observedRevision.slice(0,12)),e.durationMs!==void 0&&t.push(e.durationMs<1e3?e.durationMs+" ms":(e.durationMs/1e3).toFixed(1)+" s"),t.join(" · ")}function ZD({state:e}){var o,i;const t=e.updates||{},a=(o=t.diagnostics)==null?void 0:o.lastFailure;return!a||nk(t)?null:a.attemptId&&((i=t.diagnostics)==null?void 0:i.attemptId)&&a.attemptId!==t.diagnostics.attemptId&&!t.error&&["checking","staging","validating","staged","activating"].includes(t.phase)?n.createElement("p",{className:"a-caption",role:"status"},"A previous attempt failed. This is a different update attempt; its progress is shown above. The earlier failure remains in update details."):n.createElement("div",{className:"a-update-failure",role:"alert"},n.createElement(zn,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,"Last update did not finish: ",As(a.phase)),n.createElement("p",null,a.phase==="target-discovery"?"This installation cannot be replaced by the in-app updater. Ask the person who runs Amplifier to update this installation.":di(a)||"Open Component updates & details for the failure receipt.")))}function JD({state:e,act:t}){var m,h;const a=e.updates||{},r=a.diagnostics||{},o=r.lastFailure,i=r.events||[];if(!i.length&&!o)return null;const s=!!((h=(m=e.view)==null?void 0:m.maintenanceDraft)!=null&&h.updateDiagnosticsExpanded),l=i.filter(f=>f.attemptId===r.attemptId),c=l.filter(f=>f.status!=="started"||!l.some(g=>g.commandId&&g.commandId===f.commandId&&g.status!=="started")),u=nk(a),d=i.find(f=>f.attemptId===((o==null?void 0:o.attemptId)||r.attemptId)&&jf.includes(f.status))||o,p=u?Pt:zn;return n.createElement("div",{className:"a-update-diagnostics","data-part":"update-diagnostics"},o&&n.createElement("div",{className:"a-update-failure"+(u?" resolved":""),role:"status"},n.createElement(p,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,u?"Previous update issue resolved":"Last update issue",": ",As(o.phase)),n.createElement("p",null,u?"The current installation is verified healthy. The original failure remains in the receipt for reference.":di(o)||"The phase did not finish. Review the receipt before retrying."),n.createElement("span",{className:"a-caption"},"Attempt ",n.createElement("code",null,o.attemptId||"Not recorded")))),n.createElement("button",{type:"button",className:"a-link a-update-diagnostics-toggle","data-action":"view.update","aria-expanded":s,onClick:()=>{var f;return t("view.update",{patch:{maintenanceDraft:{...(f=e.view)==null?void 0:f.maintenanceDraft,updateDiagnosticsExpanded:!s}}})}},s?n.createElement(el,null):n.createElement(en,null),s?"Hide update details":"View update details"),s&&n.createElement("div",{className:"a-update-diagnostic-details"},d&&d.id!==(o==null?void 0:o.id)&&n.createElement("p",{className:"a-caption"},u?"First historical issue":"First recorded issue",": ",As(d.phase)," · ",di(d)),r.attemptId&&n.createElement("p",{className:"a-caption"},"Latest attempt ",n.createElement("code",null,r.attemptId)),n.createElement("ol",{className:"a-update-phase-list"},c.map(f=>{const g=jf.includes(f.status),y=u&&g&&f.attemptId===o.attemptId,E=f.status==="succeeded"?Pt:g?zn:Ps;return n.createElement("li",{key:f.id,className:f.status+(y?" historical":"")},n.createElement("div",null,n.createElement(E,{"aria-hidden":"true"}),n.createElement("span",null,As(f.phase)),n.createElement("span",{className:"a-update-phase-status"},VD[f.status]||f.status,y?" (historical)":"")),di(f)&&n.createElement("p",{className:"a-caption"},di(f)))})),n.createElement("label",{className:"a-caption",htmlFor:"update-diagnostic-receipt"},"Sanitized receipt — select and copy to share"),n.createElement("textarea",{id:"update-diagnostic-receipt",className:"a-update-receipt",readOnly:!0,rows:5,spellCheck:!1,value:WD(r,a.reconciliation)}),n.createElement("p",{className:"a-caption"},"Includes phase, timing, exit code and probe results. Command output, credentials, environment values and local paths are excluded.")))}const _u=(e,t)=>`release-notice:${e.version}:${t.id}`,$f=e=>String(e||"").replace(/^v/,"").split(".").map(Number),ak=(e,t)=>{const a=$f(e),r=$f(t);for(let o=0;o<3;o++)if(a[o]!==r[o])return a[o]>r[o];return!1},rk=(e,t)=>e.version===t.current?"Installed":ak(e.version,t.current)?"Upcoming":"Earlier release";function ok({notice:e}){return n.createElement(n.Fragment,null,n.createElement("strong",null,e.title),n.createElement("p",null,e.detail),n.createElement("p",null,n.createElement("b",null,"What to do:")," ",e.action))}function KD({application:e,state:t,act:a}){var i;const r=new Map((((i=t.attention)==null?void 0:i.items)||[]).map(s=>[s.id,s])),o=(e.releaseNotes||[]).flatMap(s=>s.notices.map(l=>({release:s,notice:l,item:r.get(_u(s,l))}))).filter(({item:s})=>s);return o.length?n.createElement("section",{className:"a-release-notices","aria-label":"High-impact changes"},n.createElement("h4",null,n.createElement(zn,{"aria-hidden":"true"}),"High-impact changes"),n.createElement("p",{className:"a-caption"},"Changes that may affect your settings or workflow. Notices are marked read as you view them."),o.map(({release:s,notice:l,item:c})=>n.createElement("article",{key:c.id,className:"a-release-notice"},n.createElement("span",{className:"a-caption"},"Version ",s.version," · ",rk(s,e)),n.createElement(Ui,{item:c,act:a},n.createElement(ok,{notice:l}))))):null}function YD({application:e,state:t,act:a}){var s;const r=e.releaseNotes||[],o=new Set((((s=t.attention)==null?void 0:s.items)||[]).filter(l=>l.read).map(l=>l.id)),i=/^v?\d+\.\d+\.\d+$/.test(e.latest||"")?e.latest:null;return n.createElement("section",{className:"a-release-history","aria-label":"Changelog"},n.createElement("details",{className:"a-update-disclosure"},n.createElement("summary",null,"Changelog"),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement("p",{className:"a-caption"},"Application release history · installed notes are available offline."),e.releaseNotesWarning&&n.createElement("p",{className:"a-release-notes-warning",role:"status"},e.releaseNotesWarning," ",i&&n.createElement("a",{href:"https://github.com/microsoft/amplifier-unified/releases/tag/"+i,target:"_blank",rel:"noreferrer"},"View published release")),!r.length&&n.createElement("p",{className:"a-caption"},"No release notes are included with this installation."),r.map(l=>n.createElement("details",{key:l.version,className:"a-release-entry",open:l.version===e.current||ak(l.version,e.current)},n.createElement("summary",null,n.createElement("strong",null,l.version," · ",l.title),n.createElement("span",{className:"a-caption"},rk(l,e)),l.notices.length>0&&n.createElement("span",{className:"a-release-impact"},"High impact")),n.createElement("ul",null,l.changes.map((c,u)=>n.createElement("li",{key:u},c))),l.notices.map(c=>{var u;return n.createElement("div",{key:c.id,className:"a-release-notice archived"},n.createElement(Ui,{item:(((u=t.attention)==null?void 0:u.items)||[]).find(d=>d.id===_u(l,c)),act:a},n.createElement(ok,{notice:c})),o.has(_u(l,c))&&n.createElement("span",{className:"a-release-reviewed"},n.createElement(Pt,{"aria-hidden":"true"}),"Reviewed"))}))))))}const Pu=e=>e.label.split("/").pop().replace(/^amplifier-(bundle-|module-)/,""),ik=(e,t)=>Pu(e).localeCompare(Pu(t),void 0,{sensitivity:"base",numeric:!0})||e.label.localeCompare(t.label)||String(e.ref||"").localeCompare(String(t.ref||""))||String(e.current||"").localeCompare(String(t.current||"")),Pc={update:"Update available",current:"Current",pinned:"Pinned",check_failed:"Check failed",local_changes:"Local changes",not_checked:"Not checked",release_channel_needed:"Release channel not configured",historical:"Older saved configuration"};function ri({items:e,state:t,act:a,id:r}){const[o,i,s]=xa(t,a,r,[...e].sort(ik),l=>[l.label,l.id,l.kind,l.status,l.ref,l.detail,l.usage,...l.usageEvidence||[],...(l.members||[]).flatMap(c=>[c.package,c.subdirectory,c.kind])],"Filter update sources");return n.createElement(n.Fragment,null,(e.length>6||s)&&i,n.createElement("ul",{id:r+"-list",className:"a-update-list a-source-list"},o.map(l=>{var p,m,h,f,g,y,E;const c=["check_failed","local_changes"].includes(l.status),u=l.status==="historical"?Ps:c?zn:l.status==="update"?jc:l.status==="pinned"?qu:Pt,d=(m=(p=t.attention)==null?void 0:p.items)==null?void 0:m.some(b=>b.id==="source:"+l.id&&!b.read);return n.createElement("li",{key:l.id},n.createElement("div",{className:"a-source-line"},n.createElement(u,{className:c?"a-source-warning":"a-source-status","aria-label":Pc[l.status]||l.status},n.createElement("title",null,l.detail||Pc[l.status]||l.status)),d&&n.createElement("span",{className:"a-unread-dot","aria-label":"Unread"}),n.createElement(Ui,{item:(f=(h=t.attention)==null?void 0:h.items)==null?void 0:f.find(b=>b.id==="source:"+l.id),act:a},n.createElement("strong",{title:l.label},Pu(l))),l.cacheCopies>1&&n.createElement("span",{title:"Source cache copies"},"×",l.cacheCopies),n.createElement("span",{className:"a-source-ref"},l.ref||l.kind),n.createElement("code",{title:l.current&&l.latest?l.current+" → "+l.latest:void 0},(g=l.current)==null?void 0:g.slice(0,7),l.latest&&l.latest!==l.current?" → "+l.latest.slice(0,7):"")),(((y=l.members)==null?void 0:y.length)>1||l.package)&&n.createElement("details",{className:"a-source-roles"},n.createElement("summary",null,l.packageCount?`${l.packageCount} package${l.packageCount===1?"":"s"} · `:"","Source details"),n.createElement("p",{className:"a-caption"},l.label),n.createElement("ul",null,(l.members||[l]).map(b=>n.createElement("li",{key:b.id},n.createElement("strong",null,b.package||"Source cache"),b.subdirectory&&n.createElement("code",null,b.subdirectory),n.createElement("span",null,b.kind,b.usage==="unknown"?" · Usage unknown":""))))),l.usage&&n.createElement("p",{className:"a-caption"},l.usage==="configured"?"Configured: "+(l.usageEvidence||[]).join(", "):"Usage unknown; it may still be needed."),(c||l.kind==="history")&&n.createElement(nt,{phase:l.status==="check_failed"?"error":"neutral",message:l.detail||Pc[l.status]}),((E=l.sourceIssues)==null?void 0:E.length)>0&&n.createElement("ul",null,l.sourceIssues.map((b,S)=>n.createElement("li",{key:S,style:{overflowWrap:"anywhere"}},n.createElement("strong",null,b.reference||"Settings"),n.createElement("p",null,b.reason),b.workspace&&n.createElement("p",null,b.workspace),b.sessionId&&n.createElement("p",null,"Session ID: ",n.createElement("code",null,b.sessionId)),b.appSessionId&&n.createElement("button",{type:"button",className:"a-soft","data-action":"session.select",onClick:async()=>{const w=await a("session.select",{id:b.appSessionId});w&&w.accepted!==!1&&await a("view.update",{patch:{panel:null}})}},"Open conversation")))))})))}function GD({updates:e,items:t,busy:a}){const r=e.sequence||{};return n.createElement("div",{className:"a-update-summary","aria-label":"Component update summary"},[["included","Included components"],["other","Other components"]].map(([o,i])=>{const s=t.filter(d=>(d.updateTier||"other")===o),l=r[o]||{status:e.lastCheck?"current":"waiting",available:s.filter(d=>d.status==="update").length,issues:s.filter(d=>["check_failed","local_changes"].includes(d.status)).length},u=a&&e.phase==="checking"&&r.stage===o?"Checking…":l.available?`${l.available} available${l.missing?` · ${l.missing} to install`:""}${l.issues?` · ${l.issues} need attention`:""}`:l.status==="waiting"?r.stage==="application"?"After app update":o==="other"?"After included components":"Not checked":l.issues?`${l.issues} need attention`:l.protected?`${l.protected} kept as configured`:"Up to date";return n.createElement("div",{key:o},n.createElement("span",null,i),n.createElement("strong",null,u))}))}function QD({state:e,act:t}){var j,_,P,G,W,D,ne;const a=(((j=e.attention)==null?void 0:j.items)||[]).filter(q=>q.page==="updates"&&!q.read),r=a.filter(q=>q.id.startsWith("release-notice:")),o=a.filter(q=>!q.id.startsWith("release-notice:")),i=e.updates||{},s=((_=e.settings)==null?void 0:_.updates)||{},l=i.pendingReplacement!=null,c=l||["checking","staging","validating","activating"].includes(i.phase),u=s.intervalHours??4,d=![1,4,8,24].includes(u),p=i.application||(i.items||[]).find(q=>q.kind==="app")||{},m=(i.items||[]).filter(q=>q.kind!=="app"&&q.id!=="application"),h=m.filter(q=>q.status==="update").sort(ik),f=m.filter(q=>["check_failed","local_changes"].includes(q.status)),g=m.filter(q=>q.usage==="unknown"),y=f.filter(q=>q.usage!=="unknown"),E=g.filter(q=>["check_failed","local_changes"].includes(q.status)),b=[["check_failed","check failed"],["local_changes","with local changes"],["update","with updates"],["pinned","pinned"],["current","current"],["not_checked","not checked"]].map(([q,Z])=>[g.filter(ie=>ie.status===q).length,Z]).filter(([q])=>q).map(([q,Z])=>`${q} ${Z}`).join(", ");p.status;const S=i.pendingApp||i.pendingRelease||i.pendingRestart,w=!!i.pendingRestart&&(!!i.error||["error","interrupted"].includes(i.phase)||i.pendingRestart.requestStatus==="rejected"),N=((P=i.pendingRestart)==null?void 0:P.requestStatus)==="uncertain",x=l?"failed":i.pendingRestart?w?"failed":N?"restart_pending":"restarting":i.pendingApp?i.error?"failed":"staged":p.status==="check_failed"?"failed":p.releaseBehind?"ahead":p.status||"not_checked",A={restarting:"Restarting",restart_pending:"Awaiting restarted host",staged:"Ready to restart",update:"Update available",current:"Latest release installed",failed:"Needs attention",ahead:"Ahead of published release",not_checked:"Not checked",release_channel_needed:"Release channel not configured",historical:"Older saved configuration"},C=x==="current"?Pt:x==="update"?jc:x==="failed"?zn:Ps,O=l?i.error||i.detail||"The installation outcome is unknown. Work remains paused until the qualified app and dependencies are verified on a new host.":i.pendingRestart?i.error||i.detail||(w?"The app installed, but its restart did not complete. Restart Amplifier Unified manually to continue.":"The app is installed. Waiting for a healthy restarted host before resuming work."):i.pendingApp?i.error||"The app passed validation and will restart when conversations, worker lanes, smart tools, and calls are idle.":p.detail,k=w||i.error||["error","interrupted"].includes(i.phase)?"error":i.pendingRestart||c?"working":i.phase==="installed"?"success":"neutral",T=i.error||(["error","interrupted"].includes(i.phase)?i.detail||"The update did not finish.":c||S||i.phase==="installed"?i.detail:""),I=BD(i,s),F=n.useRef(null);xg(a.filter(q=>q.id==="updates:pending"||q.id==="source:application"),t,F);const z=!!((W=(G=e.view)==null?void 0:G.maintenanceDraft)!=null&&W.updatesExpanded),U=c||I.busy,H=U||S?I.detail:I.blocked?"App updates for this development preview are managed by its owner.":"",te=q=>t("settings.update",{patch:{updates:q}});return n.createElement(Xt,{as:"section",name:"updates",busy:c,className:"a-updates","data-part":"updates"},n.createElement("div",{ref:F,className:"a-app-update","data-part":"application-update","aria-label":"Overall update status",role:"status","aria-live":"polite"},n.createElement("div",{className:"a-update-overall"},I.tone==="error"?n.createElement(zn,null):I.tone==="ready"?n.createElement(Pt,null):I.tone==="available"?n.createElement(jc,null):n.createElement(Ps,null),n.createElement("div",null,n.createElement("h4",null,I.title),n.createElement("p",null,I.detail))),(I.tone==="working"||I.tone==="available")&&n.createElement("div",{className:"a-update-progress","aria-label":"Update order"},[["application","App"],["included","Included components"],["other","Other components"]].map(([q,Z],ie)=>n.createElement("span",{key:q,"data-active":I.stage===q},ie>0&&"→ ",Z))),n.createElement("p",{className:"a-update-version-line"},"Amplifier ",p.current||"version not reported",p.latest&&p.latest.replace(/^v/,"")!==((D=p.current)==null?void 0:D.replace(/^v/,""))?" · Latest "+p.latest:"",i.lastCheck?" · Checked "+new Date(i.lastCheck*1e3).toLocaleString():""),I.currentBatch&&I.tone==="working"&&n.createElement("p",{className:"a-caption","data-part":"update-batch"},"Current batch: ",((ne=I.currentBatch.components)==null?void 0:ne.join(", "))||I.currentBatch.kind,I.currentBatch.componentCount>5?` and ${I.currentBatch.componentCount-5} more`:"",". Started ",new Date(I.currentBatch.startedAt*1e3).toLocaleTimeString(),"."),!!I.completedBatches.length&&n.createElement("div",{"data-part":"update-completed-batches"},n.createElement("h5",null,"Recently installed"),n.createElement("ul",null,I.completedBatches.map(q=>{var Z;return n.createElement("li",{key:q.attemptId},q.tier==="included"?"Included components":q.kind==="smart-tools"?"Smart Tools":q.kind==="application"?"App":"Other components"," installed at ",new Date(q.completedAt*1e3).toLocaleTimeString(),(Z=q.components)!=null&&Z.length?`: ${q.components.join(", ")}`:"",".")})),n.createElement("p",{className:"a-caption"},"Completed batches stay listed while any newly detected updates are prepared."))),I.tone!=="working"&&n.createElement(Ui,{item:a.find(q=>q.id==="updates:error"),act:t},n.createElement(nt,{phase:k,message:T})),n.createElement(ZD,{state:e}),n.createElement(Hw,null),p.canInstall===!1&&n.createElement("p",{className:"a-ai-hint",role:"status"},"This is a development preview. App updates are deployed by its owner; this preview cannot replace the installed app."),i.checkTiming&&n.createElement("p",{className:"a-caption"},"Last check: ",(i.checkTiming.elapsedMs/1e3).toFixed(1),"s · ",i.checkTiming.requests||0," lookups · ",i.checkTiming.cached||0," cached results"),n.createElement("div",{className:"a-update-controls","data-part":"update-controls"},n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:I.installable?"a-soft":"a-primary",disabled:U||!!S,"aria-describedby":H?"update-action-status":void 0,"data-action":"updates.check",onClick:()=>t("updates.check")},n.createElement(Mt,{className:U?"a-progress-spinner":void 0}),U?i.phase==="checking"?"Checking…":"Update in progress…":S?"Waiting for update…":"Check for updates"),I.installable&&(!I.continuing||I.tone==="error")&&n.createElement("button",{className:"a-primary",disabled:U||I.blocked,"aria-describedby":H?"update-action-status":void 0,"data-action":"updates.install",onClick:()=>t("updates.install")},n.createElement(wa,null),"Update Amplifier")),H&&n.createElement("p",{id:"update-action-status",role:"status",className:"a-caption"},H," ",U?"You can keep working; this page will update automatically.":""),n.createElement("p",{className:"a-caption"},"One request handles everything in order. Updates wait for work and calls to finish; an app update may restart the server."),n.createElement("div",{className:"a-update-simple-options"},n.createElement("label",null,n.createElement("input",{type:"checkbox","data-action":"settings.update",checked:s.autoCheck!==!1&&s.autoInstall!==!1,onChange:q=>te(q.target.checked?{autoCheck:!0,autoInstall:!0}:{autoInstall:!1})}),"Keep Amplifier up to date automatically"),n.createElement("p",{className:"a-caption"},"Install eligible app and component updates when work is idle. Existing pins and local edits are kept.")),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Update preferences"),n.createElement("div",{className:"a-update-options"},n.createElement("label",null,n.createElement("input",{type:"checkbox","data-action":"settings.update",checked:s.autoCheck!==!1,onChange:q=>te({autoCheck:q.target.checked,...q.target.checked?{}:{autoInstall:!1}})}),"Automatically check for updates"),n.createElement("label",{htmlFor:"update-frequency"},"Check for updates"),n.createElement("select",{id:"update-frequency","data-action":"settings.update",value:d?"":u,"aria-describedby":d?"update-frequency-saved":void 0,onChange:q=>te({intervalHours:Number(q.target.value)})},d&&n.createElement("option",{value:"",disabled:!0},"Choose a new interval"),n.createElement("option",{value:"1"},"Every 1 hour"),n.createElement("option",{value:"4"},"Every 4 hours"),n.createElement("option",{value:"8"},"Every 8 hours"),n.createElement("option",{value:"24"},"Daily")),d&&n.createElement("p",{id:"update-frequency-saved",className:"a-caption"},"Your saved schedule checks every ",u," hours. It stays in effect until you choose a new interval.")))),n.createElement("details",{className:"a-update-disclosure","data-part":"ecosystem-update-details",open:I.tone==="error"||void 0},n.createElement("summary",null,I.tone==="error"?"Review update issue":"Component updates & details",n.createElement(Da,{count:o.length})),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement(zs,{state:e,act:t,page:"updates",items:o,showItems:!0}),n.createElement(GD,{updates:i,items:m,busy:c}),n.createElement("div",{className:"a-app-update-heading"},n.createElement("h4",null,"App release"),n.createElement("span",{className:"a-app-update-status "+x},n.createElement(C,{"aria-hidden":"true"}),A[x]||x)),O&&(x==="failed"?n.createElement(nt,{phase:"error",message:O}):n.createElement("p",{className:"a-caption a-wrap"},O)),n.createElement(JD,{state:e,act:t}),i.canRollback&&n.createElement("button",{className:"a-soft",disabled:c||!!S,"data-action":"updates.rollback",onClick:()=>t("updates.rollback")},n.createElement(bx,null),"Roll back ecosystem"),n.createElement("div",{"data-part":"available-updates"},n.createElement("h4",null,"Ecosystem updates ",h.length>0&&n.createElement("span",{className:"a-update-count"},h.length," available")),h.length?n.createElement(ri,{items:h,state:e,act:t,id:"available-updates"}):n.createElement("p",{className:"a-caption"},I.stage!=="complete"?"Remaining components are checked after the preceding update stage.":"No eligible component updates remain.")),!!y.length&&n.createElement("div",null,n.createElement("h4",null,"Needs attention"),n.createElement(ri,{items:y,state:e,act:t,id:"update-issues"})),!!g.length&&n.createElement("div",null,n.createElement("h4",null,"Other cached sources"),n.createElement("p",{className:"a-caption"},g.length," sources: ",b,". Usage is unknown; these files may still be needed and are kept."),!!E.length&&n.createElement(ri,{items:E,state:e,act:t,id:"unknown-source-issues"})),!!m.length&&n.createElement("div",null,n.createElement("button",{className:"a-link","aria-expanded":z,"data-action":"view.update",onClick:()=>{var q;return t("view.update",{patch:{maintenanceDraft:{...(q=e.view)==null?void 0:q.maintenanceDraft,updatesExpanded:!z}}})}},z?"Hide all sources":"Show all "+m.length+" "+(m.length===1?"source":"sources")),z&&n.createElement(ri,{items:m,state:e,act:t,id:"update-sources"})))),n.createElement("details",{className:"a-update-disclosure"},n.createElement("summary",null,"Release notices",n.createElement(Da,{count:r.length})),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement(zs,{state:e,act:t,page:"updates",items:r}),n.createElement(KD,{application:p,state:e,act:t}))),m.some(q=>q.kind==="history")&&n.createElement("details",{className:"a-update-disclosure","data-part":"historical-source-settings"},n.createElement("summary",null,"Older conversation settings"),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement(ri,{items:m.filter(q=>q.kind==="history"),state:e,act:t,id:"historical-source-settings"}))),n.createElement(YD,{application:p,state:e,act:t}))}function XD({state:e,act:t}){var h;const a=(h=e.runtime)==null?void 0:h.retention,[r,o]=v.useState("32"),[i,s]=v.useState("12"),[l,c]=v.useState(!0),[u,d]=v.useState(!1);if(v.useEffect(()=>{a&&(o(String(a.max_warm_workers)),s(String(a.idle_timeout_hours)),c(a.prewarm_on_select))},[a==null?void 0:a.max_warm_workers,a==null?void 0:a.idle_timeout_hours,a==null?void 0:a.prewarm_on_select]),!a)return null;const p=r!==""&&i!==""&&Number.isInteger(Number(r))&&Number(r)>=0&&Number.isFinite(Number(i))&&Number(i)>=0;async function m(f){if(f.preventDefault(),!(!p||u)){d(!0);try{await t("runtime.retention.update",{patch:{max_warm_workers:Number(r),idle_timeout_hours:Number(i),prewarm_on_select:l}})}finally{d(!1)}}}return n.createElement("form",{id:"settings-readiness-form","aria-label":"Ready conversations",onSubmit:m},n.createElement("p",null,"Keep recently used conversations ready for their next message. These limits apply to idle conversations on this host; work in progress and pending interactions stay protected."),n.createElement("label",{htmlFor:"warm-worker-count"},"Conversations to keep ready"),n.createElement("input",{id:"warm-worker-count",type:"number",min:"0",step:"1",value:r,onChange:f=>o(f.target.value)}),n.createElement("label",{htmlFor:"warm-worker-hours"},"Hours to keep an idle conversation ready"),n.createElement("input",{id:"warm-worker-hours",type:"number",min:"0",step:"any",value:i,onChange:f=>s(f.target.value)}),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:l,onChange:f=>c(f.target.checked)}),"Prepare a conversation in the background when I select it"),n.createElement("p",{className:"a-caption"},"Setting either limit to zero releases idle conversations as soon as they settle and disables background preparation. Saved history remains available."),n.createElement(Rn,null,n.createElement("button",{form:"settings-readiness-form",type:"submit",className:"a-primary","data-action":"runtime.retention.update",disabled:!p||u},u?"Saving…":"Save readiness settings")))}function eF({results:e,run:t,busy:a,active:r}){var i;const o=e["native.status"]||e["native.compact"];return n.createElement("section",{className:"a-settings-section","data-part":"native-provider-settings"},n.createElement("h3",null,"Live direction & saved context"),n.createElement("p",null,"Check whether this model can apply new direction during a response. Other models receive it at the next request."),n.createElement("button",{className:"a-soft",disabled:a,"data-action":"runtime.control",onClick:()=>t("native.status")},"Check provider support"),o&&n.createElement(n.Fragment,null,n.createElement("p",null,o.supported?"Native direction is available for this selected model.":o.reason||"Direction is delivered at the next request."),((i=o.receipt)==null?void 0:i.outcome)==="unknown"&&n.createElement("p",{role:"alert"},"The previous request’s outcome is unknown. It was not replayed."),o.checkpoint&&n.createElement("p",null,"Saved provider context: ",o.checkpoint,"."),n.createElement("button",{className:"a-soft",disabled:a||r||!o.compactAvailable,"data-action":"runtime.control",onClick:()=>t("native.compact")},"Compact provider context"),n.createElement("p",{className:"a-caption"},"Original conversation history stays intact. Compaction makes a model request; its private provider state is never displayed.")))}const hs=e=>(e==null?void 0:e.value)==null?"Unknown":e.value.toLocaleString(void 0,{maximumFractionDigits:6});function tF({session:e,act:t}){var w,N;const[a,r]=v.useState(null),[o,i]=v.useState(null),[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(0),[m,h]=v.useState({enabled:!1,maxTotalTokens:"",maxCostUsd:"",warningFraction:.8,unknownPolicy:"pause",includeEstimatedCost:!1}),f=(x,A=!0)=>{if(r(x),!A)return;const C=x.budget;p(C.revision),h({enabled:!!C.enabled,maxTotalTokens:C.maxTotalTokens??"",maxCostUsd:C.maxCostUsd??"",warningFraction:C.warningFraction??.8,unknownPolicy:C.unknownPolicy??"pause",includeEstimatedCost:!!C.includeEstimatedCost})},g=async(x,A={})=>{l(!0),u("");try{const C=await t(x,{sessionId:e.id,...A});C!=null&&C.result?x==="capacity.quota"?i(C.result):f(C.result):C!=null&&C.error&&u(C.error)}catch(C){u(C.message)}finally{l(!1)}},y=x=>h(A=>({...A,...x})),E=(((w=e.execution)==null?void 0:w.nodes)||[]).filter(x=>x.kind==="llm").map(x=>`${x.id}:${x.revision||0}:${x.phase}`).join("|");v.useEffect(()=>{if(!a)return;let x=!1;return t("capacity.read",{sessionId:e.id}).then(A=>{!x&&(A!=null&&A.result)&&f(A.result,!1)}).catch(()=>{}),()=>{x=!0}},[E]);const b=((N=a==null?void 0:a.usage)==null?void 0:N.metrics)||{},S=!m.maxTotalTokens&&!m.maxCostUsd&&m.enabled||m.maxTotalTokens!==""&&(!Number.isInteger(Number(m.maxTotalTokens))||Number(m.maxTotalTokens)<=0)||m.maxCostUsd!==""&&!(Number(m.maxCostUsd)>0);return n.createElement("section",{className:"a-settings-section","aria-label":"Task usage and budget","data-part":"capacity-controls"},n.createElement("h3",null,"Task usage & budget"),n.createElement("p",null,"Track this conversation and its observed workers. Existing calls may finish and exceed a limit; new model calls wait when the budget is reached."),n.createElement("button",{className:"a-soft",disabled:s,"data-action":"capacity.read",onClick:()=>g("capacity.read")},"Inspect task usage"),c&&n.createElement("p",{role:"alert"},c),a&&n.createElement(n.Fragment,null,n.createElement("p",{role:"status"},"Budget ",a.admission.state," · ",a.usage.calls," recorded model calls"),a.admission.reasons.map(x=>n.createElement("p",{key:x},x)),a.admission.warnings.map(x=>n.createElement("p",{key:x},x)),n.createElement("dl",{className:"a-capability-counts"},n.createElement("div",null,n.createElement("dt",null,"Total tokens including cache writes"),n.createElement("dd",null,hs(b.grossTotalTokens)," · ",b.grossTotalTokens.status)),n.createElement("div",null,n.createElement("dt",null,"Cost (USD)"),n.createElement("dd",null,hs(b.costUsd)," · ",b.costUsd.status,b.costUsd.estimatedCalls>0?" · includes estimates":""))),n.createElement("p",{className:"a-caption"},b.grossTotalTokens.unknownCalls," calls with unknown token totals · ",b.costUsd.unknownCalls," calls with unknown cost · ",a.admission.inFlightCalls," in flight. Totals cover observed calls; missing telemetry is not zero."),n.createElement("details",null,n.createElement("summary",null,"Model breakdown and receipts"),a.usage.providers.map(x=>n.createElement("p",{key:x.provider+"|"+x.model},x.provider," / ",x.model," · ",x.calls," calls · ",hs(x.metrics.grossTotalTokens)," tokens · ",hs(x.metrics.costUsd)," USD")),n.createElement("p",{className:"a-caption"},"Receipts ",a.usage.offset+1,"–",a.usage.offset+a.usage.receipts.length," of ",a.usage.receiptCount,". Observed ",new Date(a.observedAt*1e3).toLocaleTimeString(),"."),n.createElement("pre",{className:"a-state-view"},JSON.stringify(a.usage.receipts,null,2)),a.usage.nextOffset!=null&&n.createElement("button",{className:"a-soft",disabled:s,"data-action":"capacity.read",onClick:()=>g("capacity.read",{offset:a.usage.nextOffset})},"Next receipts")),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:m.enabled,onChange:x=>y({enabled:x.target.checked})}),"Enable cumulative task budget"),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"capacity-tokens"},"Total token limit"),n.createElement("input",{id:"capacity-tokens",type:"number",min:"1",value:m.maxTotalTokens,onChange:x=>y({maxTotalTokens:x.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"capacity-cost"},"Cost limit (USD)"),n.createElement("input",{id:"capacity-cost",type:"number",min:"0.000001",step:"any",value:m.maxCostUsd,onChange:x=>y({maxCostUsd:x.target.value})}))),n.createElement("label",{htmlFor:"capacity-warning"},"Warn at percentage"),n.createElement("input",{id:"capacity-warning",type:"number",min:"1",max:"100",value:Math.round(m.warningFraction*100),onChange:x=>y({warningFraction:Number(x.target.value)/100})}),n.createElement("label",{htmlFor:"capacity-unknown"},"When settled usage is unknown"),n.createElement("select",{id:"capacity-unknown",value:m.unknownPolicy,onChange:x=>y({unknownPolicy:x.target.value})},n.createElement("option",{value:"pause"},"Pause future model calls"),n.createElement("option",{value:"allow"},"Allow calls with incomplete totals")),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:m.includeEstimatedCost,onChange:x=>y({includeEstimatedCost:x.target.checked})}),"Include attributed estimates in the cost limit"),d!==a.budget.revision&&n.createElement("p",{role:"alert"},"This budget changed. Inspect usage again before saving your changes."),n.createElement("button",{className:"a-primary",disabled:d!==a.budget.revision||s||S||!(m.warningFraction>0&&m.warningFraction<=1),"data-action":"capacity.set",onClick:()=>g("capacity.set",{...m,expectedRevision:d,maxTotalTokens:m.maxTotalTokens===""?null:Number(m.maxTotalTokens),maxCostUsd:m.maxCostUsd===""?null:Number(m.maxCostUsd)})},"Save budget"),n.createElement("p",{className:"a-caption"},"Saving updates the next admission check. It does not send a message or resume a separately paused task. Revision ",a.budget.revision,".")),n.createElement("button",{className:"a-soft",disabled:s,"data-action":"capacity.quota",onClick:()=>g("capacity.quota")},"Inspect provider quota"),o&&n.createElement("div",null,!o.providers.length&&n.createElement("p",null,"No provider quota capability is available."),o.providers.map(x=>n.createElement("div",{key:x.provider},n.createElement("p",null,x.provider,": ",x.status,x.status==="unsupported"?" · remaining capacity and reset time unknown":""),x.windows&&n.createElement("pre",{className:"a-state-view"},JSON.stringify(x.windows,null,2))))))}const nF=(e,t)=>Object.fromEntries(new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(new Date(e)).map(a=>[a.type,a.value])),Bf=(e,t)=>{const a=nF(e,t);return{startDate:`${a.year}-${a.month}-${a.day}`,localTime:`${a.hour}:${a.minute}`}};function aF({session:e,act:t}){const a=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",r=()=>({prompt:"",destination:"same_task",newTaskTitle:"Scheduled task",newTaskMaxTurns:1,kind:"monitor",recurrence:"daily",timezone:a,...Bf(Date.now()+36e5,a),intervalMinutes:60,weekdays:[0],missedRunPolicy:"latest",notificationPolicy:"changes"}),o=v.useRef(0),[i,s]=v.useState(r),[l,c]=v.useState(null),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=w=>{o.current++,s(N=>({...N,...w})),d(null)},y=()=>({prompt:i.prompt,destination:i.destination,...i.destination==="new_task"?{newTaskTitle:i.newTaskTitle,newTaskMaxTurns:Number(i.newTaskMaxTurns)}:{},kind:i.kind,missedRunPolicy:i.missedRunPolicy,notificationPolicy:i.notificationPolicy,spec:{kind:i.recurrence,timezone:i.timezone,startDate:i.startDate,localTime:i.localTime,...i.recurrence==="interval"?{intervalSeconds:Number(i.intervalMinutes)*60}:{},...i.recurrence==="weekly"?{weekdays:i.weekdays}:{}}}),E=async(w,N={})=>{m(!0);try{return await t(w,{sessionId:e.id,...N})}finally{m(!1)}},b=w=>{o.current++,c(w),d(null),s({prompt:w.prompt,destination:w.destination||"same_task",newTaskTitle:w.newTaskTitle||"Scheduled task",newTaskMaxTurns:w.newTaskMaxTurns||1,kind:w.kind,recurrence:w.spec.kind,timezone:w.spec.timezone,...w.spec.startAt?Bf(w.spec.startAt,w.spec.timezone):{startDate:w.spec.startDate,localTime:w.spec.localTime},intervalMinutes:(w.spec.intervalSeconds||3600)/60,weekdays:w.spec.weekdays||[0],missedRunPolicy:w.missedRunPolicy,notificationPolicy:w.notificationPolicy})},S=async()=>{const w=o.current,N=await E(l?"schedule.update":"schedule.create",{...y(),...l?{id:l.id}:{},expectedRevision:(l==null?void 0:l.revision)||0,previewHash:u.previewHash});N!=null&&N.accepted&&o.current===w&&(c(null),d(null),s(r()))};return n.createElement("section",{className:"a-settings-section","aria-label":"Scheduled work","data-part":"schedules"},n.createElement("h3",null,"Scheduled work"),n.createElement("p",null,"Continue this task or create a new task for each run. Each run uses normal tool permissions. Stops and changes to the reviewed configuration require schedule review."),n.createElement("button",{className:"a-soft","data-action":"schedule.list",disabled:p,onClick:()=>E("schedule.list")},"Refresh schedules"),(e.schedules||[]).map(w=>{var N;return n.createElement("article",{className:"a-selection-card",key:w.id,"data-schedule-id":w.id},n.createElement("p",null,n.createElement("strong",null,w.prompt)),n.createElement("p",null,w.destination==="new_task"?"Creates a new task for each run":"Continues this saved task"),n.createElement("p",{role:"status"},"Schedule ",w.status.replaceAll("_"," ")),w.nextDue&&w.status==="active"&&n.createElement("p",null,"Next: ",new Date(w.nextDue*1e3).toLocaleString(void 0,{timeZone:w.spec.timezone})," (",w.spec.timezone,")"),w.status==="needs_review"&&w.reviewReason&&n.createElement("p",{role:"alert"},w.reviewReason),n.createElement("p",{className:"a-caption"},"Notifications: ",w.notificationPolicy==="changes"?"changes and failures":w.notificationPolicy==="always"?"every result and failure":"failures only"," · Missed runs: ",w.missedRunPolicy==="skip"?"skip after one minute":"run only the latest occurrence"),n.createElement("div",{className:"a-dialog-actions"},w.status!=="cancelled"&&n.createElement(n.Fragment,null,n.createElement("button",{className:"a-soft",onClick:()=>b(w)},"Review schedule"),w.status==="active"&&n.createElement("button",{className:"a-soft","data-action":"schedule.pause",disabled:p,onClick:()=>E("schedule.pause",{id:w.id,expectedRevision:w.revision})},"Pause schedule"),n.createElement("button",{className:"a-soft","data-action":"schedule.cancel",disabled:p,onClick:()=>E("schedule.cancel",{id:w.id,expectedRevision:w.revision})},"Cancel schedule"))),((N=w.runs)==null?void 0:N.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Recent runs (",w.runs.length,")"),w.runs.map(x=>n.createElement("div",{key:x.id,"data-run-id":x.id},n.createElement("p",null,n.createElement("strong",null,x.phase)," · ",new Date(x.dueAt*1e3).toLocaleString()),n.createElement("p",null,x.detail),x.destinationSessionId&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Reserved task: ",x.destinationSessionId),x.creationConfirmed&&n.createElement("button",{className:"a-soft","data-action":"session.select",onClick:()=>t("session.select",{id:x.destinationSessionId})},"Open new task")),x.notificationDecision&&n.createElement("p",{className:"a-caption"},x.notificationDecision.notify?"Notification requested":"Stayed quiet"," · evidence: ",x.notificationDecision.source.replaceAll("_"," ")),x.report&&n.createElement("details",null,n.createElement("summary",null,"Reported evidence"),n.createElement("p",null,x.report.detail),"values"in x.report&&n.createElement("pre",{className:"a-state-view"},JSON.stringify(x.report.values,null,2))),x.phase==="unknown"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"schedule-evidence-"+w.id},"Reconciliation evidence"),n.createElement("textarea",{id:"schedule-evidence-"+w.id,value:h,onChange:A=>f(A.target.value)}),n.createElement("p",{className:"a-caption"},"These actions record your finding and never send the old input again. Review the schedule separately to enable future runs."),n.createElement("div",{className:"a-dialog-actions"},["abandoned","completed"].map(A=>n.createElement("button",{className:"a-soft",key:A,disabled:p||!h.trim(),"data-action":"schedule.reconcile",onClick:()=>E("schedule.reconcile",{runId:x.id,expectedRevision:x.revision,resolution:A,evidence:h.trim()})},"Mark run ",A))))))))}),n.createElement("h4",null,l?"Review this schedule":"New schedule"),n.createElement("label",{htmlFor:"schedule-destination"},"Where to run"),n.createElement("select",{id:"schedule-destination",value:i.destination,onChange:w=>g({destination:w.target.value})},n.createElement("option",{value:"same_task"},"Continue this task"),n.createElement("option",{value:"new_task"},"Create a new task for each run")),i.destination==="new_task"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"schedule-title"},"New task title"),n.createElement("input",{id:"schedule-title",value:i.newTaskTitle,onChange:w=>g({newTaskTitle:w.target.value})}),n.createElement("label",{htmlFor:"schedule-turns"},"Maximum turns in each new task"),n.createElement("input",{id:"schedule-turns",type:"number",min:"1",max:"100",value:i.newTaskMaxTurns,onChange:w=>g({newTaskMaxTurns:w.target.value})}),n.createElement("p",{className:"a-caption"},"Uses this task’s reviewed workspace, bundle and model configuration. Starts fresh without copying its conversation or objective.")),n.createElement("label",{htmlFor:"schedule-prompt"},"Saved instructions"),n.createElement("textarea",{id:"schedule-prompt",value:i.prompt,onChange:w=>g({prompt:w.target.value})}),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-kind"},"Purpose"),n.createElement("select",{id:"schedule-kind",value:i.kind,onChange:w=>g({kind:w.target.value})},n.createElement("option",{value:"monitor"},"Monitor changes"),n.createElement("option",{value:"task"},"Work on the saved instructions"))),n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-recurrence"},"Repeat"),n.createElement("select",{id:"schedule-recurrence",value:i.recurrence,onChange:w=>g({recurrence:w.target.value})},n.createElement("option",{value:"once"},"Once"),n.createElement("option",{value:"daily"},"Daily"),n.createElement("option",{value:"weekly"},"Weekly"),n.createElement("option",{value:"interval"},"At an interval"))),n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-date"},"Start date"),n.createElement("input",{id:"schedule-date",type:"date",value:i.startDate,onChange:w=>g({startDate:w.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-time"},"Local time"),n.createElement("input",{id:"schedule-time",type:"time",value:i.localTime,onChange:w=>g({localTime:w.target.value})}))),n.createElement("label",{htmlFor:"schedule-zone"},"Timezone"),n.createElement("input",{id:"schedule-zone",value:i.timezone,onChange:w=>g({timezone:w.target.value})}),i.recurrence==="interval"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"schedule-interval"},"Repeat every (minutes)"),n.createElement("input",{id:"schedule-interval",type:"number",min:"1",value:i.intervalMinutes,onChange:w=>g({intervalMinutes:w.target.value})})),i.recurrence==="weekly"&&n.createElement("div",null,["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map((w,N)=>n.createElement("label",{className:"a-inline-checkbox",key:w},n.createElement("input",{type:"checkbox",checked:i.weekdays.includes(N),onChange:x=>g({weekdays:x.target.checked?[...i.weekdays,N]:i.weekdays.filter(A=>A!==N)})}),w))),n.createElement("label",{htmlFor:"schedule-missed"},"If the app misses a run"),n.createElement("select",{id:"schedule-missed",value:i.missedRunPolicy,onChange:w=>g({missedRunPolicy:w.target.value})},n.createElement("option",{value:"latest"},"Run only the latest missed occurrence"),n.createElement("option",{value:"skip"},"Skip occurrences more than a minute late")),n.createElement("label",{htmlFor:"schedule-notify"},"Notify me"),n.createElement("select",{id:"schedule-notify",value:i.notificationPolicy,onChange:w=>g({notificationPolicy:w.target.value})},n.createElement("option",{value:"changes"},"For changes and failures"),n.createElement("option",{value:"always"},"After every result and failure"),n.createElement("option",{value:"failures_only"},"For failures only")),n.createElement("button",{className:"a-soft",disabled:p||!i.prompt.trim(),"data-action":"schedule.preview",onClick:async()=>{const w=o.current,N=await E("schedule.preview",y());o.current===w&&d((N==null?void 0:N.result)||null)}},"Preview schedule"),u&&n.createElement("div",{className:"a-selection-card","data-part":"schedule-preview"},n.createElement("h4",null,"Confirm scheduled work"),n.createElement("p",null,u.binding.prompt),u.binding.destination==="new_task"?n.createElement("div",{"data-part":"schedule-destination-preview"},n.createElement("p",null,"Create a new task for each run: ",u.binding.newTaskTitle),n.createElement("p",null,"Workspace: ",u.binding.newTaskConfiguration.workspace),n.createElement("p",null,"Bundle: ",u.binding.newTaskConfiguration.bundle),n.createElement("p",null,"Model configuration: ",JSON.stringify(u.binding.newTaskConfiguration.selection||"Bundle defaults")),n.createElement("p",null,"Maximum turns: ",u.binding.newTaskMaxTurns)):n.createElement("p",null,"Continue this saved task."),n.createElement("ul",null,u.occurrences.map(w=>n.createElement("li",{key:w.utc},new Date(w.dueAt*1e3).toLocaleString(void 0,{timeZone:u.binding.spec.timezone})," (",u.binding.spec.timezone,")"))),n.createElement("p",{className:"a-caption"},u.daylightSaving),n.createElement("p",null,"Approval applies to this saved prompt and schedule. Normal tool permissions still apply during each run."),n.createElement("button",{className:"a-primary","data-action":l?"schedule.update":"schedule.create",disabled:p||!u.occurrences.length,onClick:S},"Save and activate schedule")))}function rF({state:e,session:t,act:a}){var x,A,C,O,k;const r=((A=(x=e.runtimeControl)==null?void 0:x[t.id])==null?void 0:A["task.get"])||{},o=r.task||t.task,i=r.continuity||t.continuity,[s,l]=v.useState(""),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(""),[y,E]=v.useState(!1),[b,S]=v.useState(""),w=async(T,I={})=>{E(!0),S("");try{await a(T,{sessionId:t.id,...T==="task.get"?{}:{expectedRevision:(o==null?void 0:o.revision)||0},...I})}catch(F){S(F.message||String(F))}finally{E(!1)}},N=o&&o.status!=="completed";return n.createElement("section",{className:"a-settings-section","data-part":"task-continuity","aria-label":"Saved task"},n.createElement("h3",null,"Saved task"),n.createElement("p",null,"Keep the objective, corrections, and evidence across restarts and long conversations. Saving a task does not send a message."),n.createElement("button",{className:"a-soft",disabled:y,"data-action":"task.get",onClick:()=>w("task.get")},"Load saved task"),o&&n.createElement("div",{className:"a-selection-card"},n.createElement("p",null,n.createElement("strong",null,o.objective)),n.createElement("p",{role:"status"},"Task ",o.status," · revision ",o.revision,o.appliedRevision!==o.revision?" · applies at the next request":""),((C=o.constraints)==null?void 0:C.length)>0&&n.createElement("ul",null,o.constraints.map((T,I)=>n.createElement("li",{key:I},T))),o.status==="blocked"&&o.blockedReason&&n.createElement("p",null,"Waiting because: ",o.blockedReason),((O=o.corrections)==null?void 0:O.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Saved corrections (",o.corrections.length,")"),n.createElement("ul",null,o.corrections.map((T,I)=>n.createElement("li",{key:I},T.text)))),((k=o.completionEvidence)==null?void 0:k.length)>0&&n.createElement("ul",null,o.completionEvidence.map((T,I)=>n.createElement("li",{key:I},T))),n.createElement("details",null,n.createElement("summary",null,"Linked questions, operations, and artifacts"),["questionIds","operationIds","artifactRefs"].map(T=>{var I;return n.createElement("p",{key:T},T==="questionIds"?"Questions":T==="operationIds"?"Operations":"Artifacts",": ",((I=o[T])==null?void 0:I.join(", "))||"None")}))),!N&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"task-objective"},"Task objective"),n.createElement("textarea",{id:"task-objective",value:s,onChange:T=>l(T.target.value)}),n.createElement("label",{htmlFor:"task-constraints"},"Constraints (one per line)"),n.createElement("textarea",{id:"task-constraints",value:c,onChange:T=>u(T.target.value)}),n.createElement("button",{className:"a-primary","data-action":"task.create",disabled:y||!s.trim(),onClick:()=>w("task.create",{objective:s.trim(),constraints:c.split(` -`).map(T=>T.trim()).filter(Boolean)})},"Save task")),N&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"task-correction"},"Correction to retain"),n.createElement("textarea",{id:"task-correction",value:d,onChange:T=>p(T.target.value)}),n.createElement("button",{className:"a-soft","data-action":"task.update",disabled:y||!d.trim(),onClick:()=>w("task.update",{correction:d.trim()})},"Save correction"),n.createElement("div",{className:"a-dialog-actions"},o.status==="active"?n.createElement("button",{className:"a-soft","data-action":"task.pause",disabled:y,onClick:()=>w("task.pause")},"Pause task"):n.createElement("button",{className:"a-primary","data-action":"task.resume",disabled:y,onClick:()=>w("task.resume")},"Resume task")),n.createElement("p",{className:"a-caption"},"Pause stops future automatic continuation. Current work can finish. Resume does not send a message or answer a pending question."),n.createElement("details",null,n.createElement("summary",null,"Record a blocker or completion"),n.createElement("label",{htmlFor:"task-blocker"},"What is blocking this task?"),n.createElement("input",{id:"task-blocker",value:m,onChange:T=>h(T.target.value)}),n.createElement("button",{className:"a-soft","data-action":"task.block",disabled:y||!m.trim(),onClick:()=>w("task.block",{reason:m.trim()})},"Mark blocked"),n.createElement("label",{htmlFor:"task-evidence"},"Evidence that the objective is complete (one per line)"),n.createElement("textarea",{id:"task-evidence",value:f,onChange:T=>g(T.target.value)}),n.createElement("button",{className:"a-soft","data-action":"task.complete",disabled:y||!f.trim(),onClick:()=>w("task.complete",{condition:o.objective,evidence:f.split(` -`).map(T=>T.trim()).filter(Boolean)})},"Complete task with evidence"))),o&&r.continuationSupported===!1&&n.createElement("p",{role:"alert"},"This runtime cannot automatically continue saved tasks. Update its task support before resuming."),i&&n.createElement("p",{className:"a-caption"},"Conversation continuity: ",i.supported?i.status:"not available in this context module",i.reason?` — ${i.reason}`:"",". The original transcript remains available."),b&&n.createElement("p",{role:"alert",className:"a-danger"},b))}function oF({session:e,act:t}){var b,S;const[a,r]=v.useState("HEAD"),[o,i]=v.useState(""),[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(!1),f=async(w,N={})=>{h(!0);try{return await t(w,{sessionId:e.id,...N})}finally{h(!1)}},g=e.worktreeInspection,y=e.workingDirectory||e.workspace,E=w=>f("worktree.handoff",{id:w,expectedExecutionRevision:e.executionRevision||0});return n.createElement("section",{className:"a-settings-section","aria-label":"Task worktrees","data-part":"worktrees"},n.createElement("h3",null,"Task execution folder"),n.createElement("p",null,"Run this task in a separate Git checkout while keeping its saved conversation, voice history, artifacts and settings in their original home."),n.createElement("dl",null,n.createElement("dt",null,"Saved history and settings home"),n.createElement("dd",{className:"a-state-view"},e.workspace),n.createElement("dt",null,"Execution host"),n.createElement("dd",{"data-part":"execution-host"},((b=g==null?void 0:g.executionHost)==null?void 0:b.label)||((S=e.executionHost)==null?void 0:S.label)||"Inspect to identify this local host"),n.createElement("dt",null,"Execution folder"),n.createElement("dd",{className:"a-state-view","data-part":"execution-directory"},y)),n.createElement("button",{className:"a-soft",disabled:m,"data-action":"worktree.inspect",onClick:()=>f("worktree.inspect")},"Inspect repository"),y!==e.workspace&&n.createElement("button",{className:"a-soft",disabled:m||e.configurationBusy,"data-action":"worktree.handoff",onClick:()=>E(null)},"Return execution to home"),(g==null?void 0:g.repository)&&n.createElement(n.Fragment,null,n.createElement("p",null,g.repository.branch||"Detached commit"," · ",g.repository.dirty?"Uncommitted changes present":"Checkout clean"),n.createElement("details",null,n.createElement("summary",null,"Source changes"),n.createElement("pre",{className:"a-state-view"},g.repository.status||"No changes")),n.createElement("h4",null,"Create a checkout"),n.createElement("label",{htmlFor:"worktree-ref"},"Starting Git ref or commit"),n.createElement("input",{id:"worktree-ref",value:a,onChange:w=>r(w.target.value)}),n.createElement("label",{htmlFor:"worktree-branch"},"New branch (optional)"),n.createElement("input",{id:"worktree-branch",value:o,onChange:w=>i(w.target.value)}),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:s,onChange:w=>l(w.target.checked)}),"Include my uncommitted changes"),n.createElement("p",{className:"a-caption"},s?"Copy staged, unstaged and untracked files with an inspectable manifest. Ignored files are excluded. Repositories with submodules need separate handling; the source stays intact.":"Start from the committed ref in a clean checkout. Your current uncommitted changes stay in the source."),n.createElement("button",{className:"a-primary",disabled:m||!a.trim(),"data-action":"worktree.create",onClick:()=>f("worktree.create",{sourceRevision:g.repository.sourceRevision,ref:a.trim(),...o.trim()?{branch:o.trim()}:{},mode:s?"carry_dirty":"clean"})},"Create managed checkout")),n.createElement("details",null,n.createElement("summary",null,"Attach an existing checkout"),n.createElement("label",{htmlFor:"worktree-path"},"Existing worktree path"),n.createElement("input",{id:"worktree-path",value:c,onChange:w=>u(w.target.value)}),n.createElement("button",{className:"a-soft",disabled:m||!c.trim(),"data-action":"worktree.attach",onClick:()=>f("worktree.attach",{path:c.trim()})},"Attach checkout"),n.createElement("p",{className:"a-caption"},"The folder must belong to this repository. Attaching does not start work or grant cleanup ownership.")),(e.worktrees||[]).map(w=>{var N;return n.createElement("article",{className:"a-selection-card",key:w.id,"data-worktree-id":w.id},n.createElement("p",{className:"a-state-view"},w.path),n.createElement("p",{role:"status"},"Checkout ",w.status),n.createElement("p",null,"Local host: ",((N=w.executionHost)==null?void 0:N.label)||"Not recorded for this checkout"),w.error&&n.createElement("p",{role:"alert"},w.error),n.createElement("p",null,w.branch||"Detached commit"," · ",w.mode==="carry_dirty"?"Changes copied":w.mode==="attached"?"Existing checkout":"Committed source"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:m,"data-action":"worktree.status",onClick:()=>f("worktree.status",{id:w.id})},"Inspect checkout and manifest"),w.status==="ready"&&n.createElement("button",{className:"a-primary",disabled:m||e.configurationBusy||y===w.path,"data-action":"worktree.handoff",onClick:()=>E(w.id)},"Move execution here"),w.owned&&w.status!=="removed"&&n.createElement("button",{className:"a-soft",disabled:m||y===w.path||e.configurationBusy,"data-action":"worktree.remove",onClick:()=>f("worktree.remove",{id:w.id,expectedRevision:w.revision})},"Remove clean checkout")))}),e.worktreeStatus&&n.createElement("details",{open:!0},n.createElement("summary",null,"Checkout inspection"),n.createElement("pre",{className:"a-state-view"},JSON.stringify(e.worktreeStatus,null,2))),(e.worktreeHandoffs||[]).map(w=>{var N;return n.createElement("article",{className:"a-selection-card",key:w.id,"data-handoff-id":w.id},n.createElement("p",{role:"status"},"Handoff ",w.phase),n.createElement("p",null,"Local host: ",((N=w.executionHost)==null?void 0:N.label)||"Not recorded for this receipt"),n.createElement("p",null,w.detail),w.phase==="unknown"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"handoff-evidence-"+w.id},"What did you verify?"),n.createElement("textarea",{id:"handoff-evidence-"+w.id,value:d,onChange:x=>p(x.target.value)}),n.createElement("p",{className:"a-caption"},"Confirm saved writer release again and choose the execution folder. Neither choice sends a message or replays work."),n.createElement("div",{className:"a-dialog-actions"},["source","target"].map(x=>n.createElement("button",{className:"a-soft",key:x,disabled:m||!d.trim(),"data-action":"worktree.reconcile",onClick:()=>f("worktree.reconcile",{id:w.id,expectedRevision:w.revision,destination:x,evidence:d.trim()})},"Use ",x," folder")))))}))}function Hf({state:e,session:t,act:a}){var T,I,F;const[r,o]=v.useState(null),[i,s]=v.useState(""),[l,c]=v.useState(!1),[u,d]=v.useState(!1),[p,m]=v.useState(""),[h,f]=v.useState(""),[g,y]=v.useState(""),[E,b]=v.useState(""),[S,w]=v.useState(!1),[N,x]=v.useState(""),A=((T=e.portability)==null?void 0:T.receipts)||((I=t==null?void 0:t.portability)==null?void 0:I.receipts)||[],C=async(z,U={})=>{w(!0),x("");try{const H=await a(z,U);return z==="portability.inspect"&&o(H==null?void 0:H.result),H}catch(H){x(H.message||"Transfer could not finish. Inspect the saved receipt.")}finally{w(!1)}},O=()=>C("portability.inspect",t?{sessionId:t.id}:{}),k=(F=t==null?void 0:t.worktreeInspection)==null?void 0:F.repository;return n.createElement("section",{className:"a-settings-section","aria-label":"Move task between hosts","data-part":"portability"},n.createElement("h3",null,"Move task between hosts"),n.createElement("p",null,"Stage a private transfer, verify the destination, then release this host. Your task keeps its saved history and outputs. Moving never sends a message or retries unfinished work."),n.createElement("button",{className:"a-soft",disabled:S,"data-action":"portability.inspect",onClick:O},"Inspect hosts and transfers"),r&&n.createElement(n.Fragment,null,n.createElement("p",null,"This host: ",r.host.label),!Object.keys(r.peers||{}).length&&n.createElement("p",{role:"status"},"No hosts are paired. Configure trusted host keys and upgrade Foundation on both hosts before transferring.")),t&&n.createElement("details",null,n.createElement("summary",null,"Export this task"),n.createElement("p",null,"Inspect the repository above, then choose a paired destination."),n.createElement("label",{htmlFor:"portability-destination"},"Destination"),n.createElement("select",{id:"portability-destination",value:i,onChange:z=>s(z.target.value)},n.createElement("option",{value:""},"Choose a paired host"),Object.entries((r==null?void 0:r.peers)||{}).map(([z,U])=>n.createElement("option",{key:z,value:z},U.label||z))),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:l,onChange:z=>c(z.target.checked)}),"Include staged, unstaged and untracked work"),n.createElement("p",{className:"a-caption"},"Ignored files and local settings stay here. Export stops if a bound is exceeded or recognizable credentials are found. Review the selected history, outputs and files for private credentials before continuing."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:u,onChange:z=>d(z.target.checked)}),"I reviewed this task’s transfer contents"),n.createElement("button",{className:"a-primary",disabled:S||!i||!k||!u||t.configurationBusy,"data-action":"portability.export",onClick:()=>C("portability.export",{sessionId:t.id,destination:i,sourceRevision:k.sourceRevision,expectedExecutionRevision:t.executionRevision||0,mode:l?"carry_dirty":"clean",reviewedContent:!0})},"Stage export and stop execution here")),n.createElement("details",null,n.createElement("summary",null,"Import a staged task"),n.createElement("p",null,"Copy the private signed package over your authenticated host connection. The destination repository must already contain its exact commit. A small provider check uses this host’s credentials."),n.createElement("label",{htmlFor:"portability-package"},"Package path on this host"),n.createElement("input",{id:"portability-package",value:p,onChange:z=>m(z.target.value)}),n.createElement("label",{htmlFor:"portability-repository"},"Destination repository"),n.createElement("input",{id:"portability-repository",value:h,onChange:z=>f(z.target.value)}),n.createElement("button",{className:"a-soft",disabled:S||!p||!h,"data-action":"portability.stage",onClick:()=>C("portability.stage",{path:p,repository:h})},"Verify and stage import")),!!A.length&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"portability-receipt"},"Signed receipt path copied from the other host"),n.createElement("input",{id:"portability-receipt",value:g,onChange:z=>y(z.target.value)}),n.createElement("label",{htmlFor:"portability-evidence"},"What did you verify?"),n.createElement("input",{id:"portability-evidence",value:E,onChange:z=>b(z.target.value),placeholder:"Reason to cancel an unreleased export"})),A.map(z=>n.createElement("article",{className:"a-selection-card",key:z.id,"data-transfer-id":z.id},n.createElement("p",{role:"status"},z.direction==="outgoing"?"Export":"Import"," · ",z.phase),n.createElement("p",{className:"a-state-view"},"Task ",z.sessionId),z.package&&n.createElement("p",{className:"a-state-view"},"Package: ",z.package),z.receiptPath&&n.createElement("p",{className:"a-state-view"},"Receipt: ",z.receiptPath),z.detail&&n.createElement("p",null,z.detail),(z.phase==="prepared"||z.phase==="releasing"||z.phase==="unknown"&&z.previousPhase==="releasing")&&n.createElement("button",{className:"a-primary",disabled:S||!g,"data-action":"portability.release",onClick:()=>C("portability.release",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,path:g})},"Release source ownership"),z.direction==="incoming"&&["ready","active"].includes(z.phase)&&n.createElement("button",{className:"a-primary",disabled:S||!g,"data-action":"portability.activate",onClick:()=>C("portability.activate",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,path:g})},z.phase==="active"?"Verify activation receipt":"Activate on this host"),z.phase==="unknown"&&n.createElement("p",null,"Inspect both hosts before any further action. Original data remains preserved; no work was replayed."))),A.filter(z=>z.direction==="outgoing"&&(z.phase==="prepared"||z.phase==="unknown"&&z.previousPhase==="preparing")).map(z=>n.createElement("button",{key:"cancel-"+z.id,className:"a-soft",disabled:S||!E.trim(),"data-action":"portability.cancel",onClick:()=>C("portability.cancel",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,evidence:E})},"Cancel unreleased export")),A.filter(z=>z.direction==="incoming"&&["ready","unknown"].includes(z.phase)&&!z.releaseCertificate).map(z=>n.createElement("button",{key:"discard-"+z.id,className:"a-soft",disabled:S||!g,"data-action":"portability.discard",onClick:()=>C("portability.discard",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,path:g})},"Retain source cancellation")),N&&n.createElement("p",{role:"alert"},N))}const iF=new Set(["working","running","busy","starting","stopping","retrying"]),sF=new Set(["working","running","busy","starting","pending","queued","preparing","retrying"]);function Oc(e){if(typeof e=="number")return e<1e12?e*1e3:e;const t=Date.parse(e);return Number.isFinite(t)?t:null}function lF(e){const t=Math.max(0,Math.floor(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,"0")}s`}const cF={"job.returned":"completed","job.failed":"error","job.cancelled":"cancelled"};function sk(e=[]){const t=new Map,a=new Map;for(const[r,o]of e.entries()){const i=o.callId||o.call_id||o.id||`worker-${r}`,s=t.get(i);if(o.kind==="job"){const l=cF[o.event]||(["completed","cancelled","error","failed","stopped","interrupted"].includes(o.status)?o.status:null);l&&a.set(i,l)}(!s||o.kind==="session"||s.kind!=="session")&&t.set(i,o)}return[...t].map(([r,o])=>a.has(r)?{...o,status:a.get(r),phase:a.get(r)}:o)}function uF(e,t=Date.now()){var g;if(!e)return null;const a=iF.has(e.status),r=sk(e.workers||[]).filter(y=>sF.has(y.status)),o=e.activity,i=new Map;let s=null;if(o!=null&&o.activeTools)for(const y of o.activeTools)i.set(y.callId||y.call_id||y.tool,{tool:y.tool||y.name||"tool",startedAt:y.startedAt});else if(a){const y=new Map;for(const E of e.runtimeEvents||[]){const b=E.type==="runtime.tool"?`tool.${E.phase}`:E.type||E.event,S=E.callId||E.call_id||E.tool_call_id||E.job_id||E.tool,w=E.tool||E.tool_name||E.name;w&&/^(tool[.:]|job\.)/.test(b||"")&&(s=w),["tool.pre","tool:pre","tool.start","tool.started"].includes(b)&&y.set(`tool:${S}`,{id:S,tool:w||"tool",startedAt:E.time||E.createdAt}),["tool.post","tool:post","tool.error","tool:error","tool.end","tool.finished"].includes(b)&&y.delete(`tool:${S}`),b==="job.queued"&&y.set(`job:${S}`,{id:S,tool:w||"delegate",startedAt:E.time||E.createdAt}),["job.returned","job.failed","job.cancelled","job.canceled","job.error"].includes(b)&&y.delete(`job:${S}`),["session.closed","generation.detached"].includes(b)&&y.clear()}for(const E of y.values())i.set(E.id,E)}if(!a&&!r.length)return null;const l=[...i.values()],c=new Map;for(const y of l)c.set(y.tool,(c.get(y.tool)||0)+1);let u,d;e.status==="starting"?(u="Preparing your Amplifier session…",d="preparing"):e.status==="stopping"?(u="Stopping the current work…",d="stopping"):l.length?(u=o?`Running ${l.length} ${l.length===1?"tool":"tools"}`:`${l.length} ${l.length===1?"tool call":"tool calls"} pending`,d="tools"):r.length?(u=`${r.length} ${r.length===1?"worker lane is":"worker lanes are"} active`,d="workers"):(u=e.streaming?"Writing a response…":"Composing a response…",d="composing"),o!=null&&o.phase&&(d=o.phase),typeof(o==null?void 0:o.label)=="string"&&o.label.trim()&&(u=o.label);const p=[...e.messages||[]].reverse().find(y=>y.role==="user"),m=Oc(o==null?void 0:o.startedAt)||Oc(p==null?void 0:p.createdAt)||Math.min(...l.map(y=>Oc(y.startedAt)).filter(Boolean)),h=Number.isFinite(m)?lF(t-m):null,f=[...c].map(([y,E])=>E>1?`${y} × ${E}`:y);return!s&&((g=o==null?void 0:o.lastEvent)!=null&&g.tool)&&(s=o.lastEvent.tool),{phase:d,label:u,elapsed:h,toolLabels:f,workerCount:r.length,lastTool:l.length?null:s}}function dF(e){var c,u,d,p;if((u=(c=e==null?void 0:e.execution)==null?void 0:c.nodes)!=null&&u.length||(p=(d=e==null?void 0:e.execution)==null?void 0:d.turns)!=null&&p.length){const m=e.execution.nodes||[],h=[...e.execution.turns||[]];for(const f of m)f.turnId&&!h.some(g=>g.id===f.turnId)&&h.push({id:f.turnId});return{nodes:m,turns:h,segments:e.execution.segments||[]}}const t=sk((e==null?void 0:e.workers)||[]),a=(e==null?void 0:e.runtimeEvents)||[];if(!t.length&&!a.some(m=>m.type==="runtime.tool"||String(m.type).startsWith("tool.")))return{nodes:[],turns:[]};const r="observed-activity",o=[],i=new Map;for(const m of a){const h=m.type==="runtime.tool"?m.phase:String(m.type).replace(/^tool[.:]/,"");if(m.type!=="runtime.tool"&&!/^tool[.:]/.test(m.type||""))continue;const f=m.callId||m.call_id||m.tool_call_id;if(!f)continue;const g=i.get(f)||{id:`tool:${f}`,kind:"tool",turnId:r,label:m.tool||m.tool_name||"Tool call",callId:f,startedAt:m.at||m.time};g.status=["post","end","finished"].includes(h)?"completed":["error","failed"].includes(h)?"error":"running",g.actualSessionId=m.actualSessionId||g.actualSessionId,i.set(f,g)}const s=new Map(t.map(m=>[m.sessionId||m.id,m]));for(const m of i.values())s.has(m.actualSessionId)&&(m.parentId=`worker:${m.actualSessionId}`),o.push(m);for(const m of t){const h=m.sessionId||m.id,f=m.callId||m.call_id,g=s.get(m.parentSessionId);o.push({id:`worker:${h}`,kind:"worker",turnId:r,routing:m.routing,provider:m.provider,model:m.model,label:m.name||m.agent||m.title||"Worker",status:m.status,phase:m.phase,summary:m.detail||m.report||m.result,summaryDetail:m.detail?m.detailDetail:m.report?m.reportDetail:m.resultDetail,startedAt:m.startedAt,endedAt:m.endedAt,workerId:m.id||h,parentId:i.has(f)?`tool:${f}`:g?`worker:${g.sessionId||g.id}`:null})}const l=["error","failed","cancelled","interrupted"].includes(e==null?void 0:e.status)?e.status:["working","starting","running","stopping"].includes(e==null?void 0:e.status)||o.some(m=>["running","working","starting","queued","pending","retrying","idle"].includes(m.status))?"running":"completed";return{nodes:o,turns:[{id:r,label:"Recent execution activity",status:l}]}}function pF(e,t){var i;const a=new Map,r=[],o=new Set(e.map(s=>s.id));for(const s of t.turns){let l=s.anchorMessageId;if(!Object.hasOwn(s,"anchorMessageId")){const c=e.find(p=>p.role==="user"&&(s.messageId&&s.messageId===p.id||s.userMessageId&&s.userMessageId===p.id||p.inputId&&(s.inputId===p.inputId||s.id===p.inputId))),u=t.nodes.filter(p=>p.turnId===s.id&&Number.isFinite(p.startedAt)).map(p=>p.startedAt),d=Number.isFinite(s.startedAt)?s.startedAt:u.length?Math.min(...u):null;l=(c==null?void 0:c.id)||(d!==null?(i=e.findLast(p=>Number.isFinite(p.createdAt)&&p.createdAt<=d))==null?void 0:i.id:null)}l&&o.has(l)?(a.has(l)||a.set(l,[]),a.get(l).push(s.id)):r.push(s.id)}return{after:a,before:r}}function mF(e){return e>=1e6?`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}const hF=new Set(["running","working","starting","queued","pending","retrying","idle"]);function Bn(e){return hF.has((e==null?void 0:e.status)||(e==null?void 0:e.phase))&&!Number.isFinite(e==null?void 0:e.endedAt)}function Np(e,t=Date.now()/1e3){if(!Number.isFinite(e==null?void 0:e.startedAt))return null;const a=Number.isFinite(e.endedAt)?e.endedAt:Bn(e)?t:null;if(a===null)return null;const r=Math.max(0,a-e.startedAt),o=Math.floor(r);return r>=60?`${Math.floor(o/60)}m ${o%60}s`:Bn(e)?`${o}s`:`${Number(r.toFixed(1))}s`}function Rp(e,{pending:t=!1}={}){if(!e)return t?{text:"usage pending",title:"Usage has not been reported yet."}:null;if(e.calls===0&&!e.totalTokens&&!e.inputTokens&&!e.outputTokens&&!e.costUsd)return t?{text:"usage pending",title:"Usage has not been reported yet."}:null;const a=e.totalTokens??(e.inputTokens!=null||e.outputTokens!=null?(e.inputTokens||0)+(e.outputTokens||0):null),r=e.grossTotalTokens??(a===null?null:a+(e.cacheWriteTokens||0)),o=e.tokenPendingCalls??(t&&e.tokenUnknownCalls||0),i=e.costPendingCalls??(t&&e.unknownCalls||0),s=e.costType||(e.costUsd!=null&&e.unknownCalls===0?"reported":"unavailable"),l=typeof e.costUsd=="number"&&s!=="unavailable"?`${s==="estimated"||e.estimatedCalls>0?"≈":""}$${e.costUsd<.01?e.costUsd.toFixed(6).replace(/0+$/,"").replace(/\.$/,".00"):e.costUsd.toFixed(3)}${s==="partial"&&!i?"+":""}`:null,c=[];if(e.calls>0&&e.tokenUnknownCalls>=e.calls?c.push(o===e.calls?"tokens pending":o?"tokens partly pending":"tokens unavailable"):r!=null&&c.push(`${mF(r)} tokens${e.tokenUnknownCalls?o===e.tokenUnknownCalls?" + pending":" + ?":""}`),l?c.push(l+(i?" + pending":"")):(e.calls||r!=null)&&c.push(i===e.calls?"cost pending":i?"cost partly pending":"cost unavailable"),!c.length)return null;const u=[e.inputTokens!=null&&(e.calls==null||e.tokenUnknownCalls!==e.calls)?`${e.inputTokens} input tokens`:null,e.outputTokens!=null&&(e.calls==null||e.tokenUnknownCalls!==e.calls)?`${e.outputTokens} output tokens`:null,e.cacheReadTokens?`${e.cacheReadTokens} cache-read tokens`:null,e.cacheWriteTokens?`${e.cacheWriteTokens} cache-write tokens`:null,o?`${o} call(s) awaiting token usage`:null,i?`${i} call(s) awaiting cost`:null,s==="partial"?`Partial cost: ${e.pricedCalls||0} of ${e.calls||"?"} calls priced`:s==="estimated"?"Cost is estimated":s==="reported"?"Cost reported by the provider":i===e.calls?"Cost has not been reported yet":"Provider did not report a cost for completed calls",e.estimatedCalls&&s==="partial"?"Includes estimated cost":null].filter(Boolean).join(" · ");return{text:c.join(" · "),title:u}}function fF(e,t){const a=e.nodes.filter(c=>c.turnId===t),r=new Map(a.map(c=>[c.id,c])),o=new Map;for(const c of a){const u=c.parentId&&c.parentId!==c.id&&r.has(c.parentId)?c.parentId:null;o.has(u)||o.set(u,[]),o.get(u).push(c)}const i=o.get(null)||[],s=new Set,l=c=>{if(!s.has(c.id)){s.add(c.id);for(const u of o.get(c.id)||[])l(u)}};i.forEach(l);for(const c of a)s.has(c.id)||(i.push(c),l(c));return{roots:i,children:o}}function gF(e){let t;try{t=JSON.parse(e)}catch{return[]}const a=new Set;function r(o,i=0){if(!(!o||typeof o!="object"||i>8))for(const[s,l]of Object.entries(o).slice(0,100)){if(a.size>=8)return;if(["url","uri","html_url","web_url","artifact_url"].includes(s)&&typeof l=="string")try{const c=new URL(l);["https:","http:"].includes(c.protocol)&&!c.username&&!c.password&&a.add(c.href)}catch{}else typeof l=="object"&&r(l,i+1)}}return r(t),[...a]}function vF(e){const t=e.filter(r=>r.kind==="llm"),a={calls:t.length,pricedCalls:0,unknownCalls:0,estimatedCalls:0,tokenUnknownCalls:0,costPendingCalls:0,tokenPendingCalls:0,costUsd:0};for(const r of["inputTokens","outputTokens","totalTokens","cacheReadTokens","cacheWriteTokens"])a[r]=0;for(const r of t){const o=r.usage||{},i=Bn(r);for(const s of["inputTokens","outputTokens","totalTokens","cacheReadTokens","cacheWriteTokens"])Number.isFinite(o[s])&&(a[s]+=o[s]);o.totalTokens==null&&(o.inputTokens!=null||o.outputTokens!=null)&&(a.totalTokens+=(o.inputTokens||0)+(o.outputTokens||0)),o.totalTokens==null&&o.inputTokens==null&&o.outputTokens==null&&(a.tokenUnknownCalls++,i&&a.tokenPendingCalls++),Number.isFinite(o.costUsd)?(a.costUsd+=o.costUsd,a.pricedCalls++,o.costType==="estimated"&&a.estimatedCalls++):(a.unknownCalls++,i&&a.costPendingCalls++)}return a.costType=a.pricedCalls?a.unknownCalls?"partial":a.estimatedCalls?"estimated":"reported":"unavailable",a}function bF(e,t){const a=[],r=[];for(const o of t.turns){const i=t.nodes.filter(u=>u.turnId===o.id&&!(u.lifecycle==="background"&&u.label==="Session naming")),s=new Map;let l,c=-1/0;for(const u of i){const d=Number.isFinite(u.startedAt)?u.startedAt:Number.isFinite(u.endedAt)?u.endedAt:o.startedAt;let p=o.anchorMessageId??null;if(Object.hasOwn(u,"anchorMessageId"))p=u.anchorMessageId;else if(Number.isFinite(d))for(const f of e)f.timestampKnown!==!1&&Number.isFinite(f.createdAt)&&f.createdAt<=d&&(p=f.id);const m=`${o.id}@${p||"start"}`;s.has(m)||s.set(m,{id:m,anchor:p,nodes:[]}),s.get(m).nodes.push({...u,turnId:m});const h=Number.isFinite(d)?d:-1/0;(l===void 0||h>=c)&&(c=h,l=m)}!i.length&&Bn(o)&&(l=`${o.id}@${o.anchorMessageId||"start"}`,s.set(l,{id:l,anchor:o.anchorMessageId,nodes:[]}));for(const u of s.values()){const d=u.nodes.map(f=>f.startedAt).filter(Number.isFinite),p=u.nodes.map(f=>f.endedAt).filter(Number.isFinite),m=u.id===l&&["error","failed","cancelled","interrupted"].includes(o.status||o.phase)?o.status||o.phase:null,h=!m&&(u.nodes.some(Bn)||u.id===l&&Bn(o));m&&Number.isFinite(o.endedAt)&&p.push(o.endedAt),a.push({...o,id:u.id,originalTurnId:o.id,anchorMessageId:u.anchor,startedAt:d.length?Math.min(...d):o.startedAt,endedAt:h?void 0:p.length?Math.max(...p):o.endedAt,phase:h?"running":m||((o.status||o.phase)&&(p.length||o.endedAt)?"completed":"recorded"),status:void 0,aggregateUsage:vF(u.nodes),nodeCounts:{tools:u.nodes.filter(f=>f.kind==="tool").length,models:u.nodes.filter(f=>f.kind==="llm").length},...(t.segments||[]).find(f=>f.id===u.id)}),r.push(...u.nodes)}}return{nodes:r,turns:a}}function yF({sessionId:e,act:t}){const[a,r]=v.useState(null),[o,i]=v.useState(!1),[s,l]=v.useState(""),c=v.useRef(0);v.useEffect(()=>(c.current++,r(null),i(!1),l(""),()=>{c.current++}),[e]);async function u(d=!1){const p=++c.current;i(!0),l("");try{const m=await t("runtime.dependencies",{sessionId:e,...d?{verifyImports:!0}:{}});if(c.current===p){if(!(m!=null&&m.result))throw Error("Runtime inspection did not return a result.");r(m.result)}}catch(m){c.current===p&&l(m.message)}finally{c.current===p&&i(!1)}}return n.createElement(Xt,{as:"section",name:"runtime.dependencies",busy:o,className:"a-settings-section"},n.createElement("h3",null,"Document and data tools"),n.createElement("p",null,"Check the tools available for documents, spreadsheets, PDFs and plots."),n.createElement("button",{className:"a-soft","data-action":"runtime.dependencies",disabled:o,onClick:()=>u()},n.createElement(Mt,null),"Inspect document tools"),n.createElement("button",{className:"a-soft","data-action":"runtime.dependencies",disabled:o,onClick:()=>u(!0)},"Check library imports"),s&&n.createElement("p",{role:"alert",className:"a-danger"},s),a&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Availability is separate from a successful render, visual review or formula calculation."),Object.entries(a).map(([d,p])=>n.createElement("section",{key:d,"aria-label":d==="host"?"App environment":"Conversation environment"},n.createElement("h4",null,d==="host"?"App environment":"Conversation environment"),p.status!=="available"?n.createElement("p",null,p.reason||"Environment not available."):n.createElement(n.Fragment,null,n.createElement("p",{className:"a-wrap"},"Python ",p.python.version,n.createElement("br",null),n.createElement("code",null,p.python.path)),n.createElement("ul",{className:"a-catalog-list"},p.python.packages.map(m=>n.createElement("li",{key:m.name},n.createElement("strong",null,m.name)," — ",m.version||m.status,m.importStatus&&` · Import ${m.importStatus}`))),Object.entries(p.executables).map(([m,h])=>n.createElement("p",{key:m,className:"a-wrap"},n.createElement("strong",null,{node:"Node.js",libreoffice:"LibreOffice",pdftoppm:"PDF renderer"}[m]||m)," — ",h.version||h.status,h.path&&n.createElement(n.Fragment,null,n.createElement("br",null),n.createElement("code",null,h.path)),h.reason&&n.createElement(n.Fragment,null,n.createElement("br",null),h.reason))))))))}const fs=e=>JSON.stringify(e,null,2),EF={tab:"overview",goalCondition:"",goalMaxTurns:"",mode:"",maxIterations:"",contextTokens:"",tool:"",toolArgs:"{}",clearConfirm:!1};function lk({state:e,session:t,act:a,computerControls:r}){var H,te,j,_,P,G,W,D,ne;const o=(H=e.view)==null?void 0:H.runtimeDraft,i=v.useRef(null),[s,l]=v.useState({...EF,...o});v.useEffect(()=>{o&&l(q=>({...q,...o}))},[o]);const c=q=>{l(Z=>({...Z,...q})),a("view.update",{patch:{runtimeDraft:q}})};v.useLayoutEffect(()=>{var Z;if(!s.section)return;const q=[...((Z=i.current)==null?void 0:Z.querySelectorAll("[data-runtime-section]"))||[]].find(ie=>ie.dataset.runtimeSection===s.section);q==null||q.scrollIntoView({block:"nearest"}),q==null||q.focus({preventScroll:!0})},[s.section,s.tab,s.revealRevision]);const u=((te=e.runtimeControl)==null?void 0:te[t==null?void 0:t.id])||{},d=u["catalog.inspect"]||{},p=u["mode.list"]||{},m=u["goals.get"]||u["goals.set"]||{},h=u["budget.get"]||u["budget.set"]||{},f=u["usage.inspect"],g=d.capabilities||{},y=((j=u["task.get"])==null?void 0:j.task)||(t==null?void 0:t.task),E=e.management||{},b=["working","running","pending","queued"].includes(E.phase),S=(_=e.actionStatus)==null?void 0:_["runtime.control"],w=q=>{var Z,ie;return["queued","working"].includes(S==null?void 0:S.phase)&&((Z=S==null?void 0:S.target)==null?void 0:Z.sessionId)===(t==null?void 0:t.id)&&((ie=S==null?void 0:S.target)==null?void 0:ie.operation)===q},N=t&&["working","starting","running","stopping","busy"].includes(t.status),x=(q,Z={})=>a("runtime.control",{sessionId:t.id,operation:q,args:Z}),A=d.tools||[],C=A.find(q=>q.name===s.tool),O=u["tool.invoke"],k=!!g.goals,T=!!g.modes,I=Rp(f==null?void 0:f.usage);let F={},z="";try{if(F=JSON.parse(s.toolArgs),!F||typeof F!="object"||Array.isArray(F))throw new Error("Tool arguments must be a JSON object.")}catch(q){z=q.message}const U=[["overview","Session",tl],["direction","Goals & modes",mm],["limits","Limits & context",Mk],["tools","Tools & skills",Os],["computer","Computer use",Lu]];return t?n.createElement("div",{ref:i,className:"a-runtime-settings","data-part":"runtime-controls"},n.createElement("p",null,"Inspect and control the active Amplifier session. Its bundle determines which capabilities are available."),n.createElement("nav",{className:"a-settings-nav","aria-label":"Session control sections"},U.map(([q,Z,ie])=>n.createElement("button",{key:q,className:s.tab===q?"selected":"","data-action":"view.update",onClick:()=>c({tab:q,section:null})},n.createElement(ie,null),Z))),n.createElement("div",{"data-runtime-section":s.tab,tabIndex:-1},s.tab==="computer"&&r,E.error&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,E.error)),b&&n.createElement("p",{className:"a-management-status",role:"status"},n.createElement(Mt,{className:"a-progress-spinner"}),E.detail||"Updating the session…"),s.tab==="overview"&&n.createElement(n.Fragment,null,n.createElement(oF,{session:t,act:a}),n.createElement(Xt,{as:"section",name:"runtime-catalog.inspect",busy:w("catalog.inspect"),className:"a-settings-section"},n.createElement("h3",null,"Session capabilities"),n.createElement("button",{className:"a-soft",disabled:b,"data-action":"runtime.control",onClick:()=>x("catalog.inspect")},n.createElement(Mt,null),"Inspect capabilities"),A.length>0&&n.createElement("div",{className:"a-capability-counts"},n.createElement("span",null,n.createElement("strong",null,A.length)," tools"),n.createElement("span",null,n.createElement("strong",null,Object.keys(d.agents||{}).length)," agents"),n.createElement("span",null,n.createElement("strong",null,(d.skills||[]).length)," skills")),Object.keys(g).length>0&&n.createElement("div",{className:"a-capability-tags"},Object.entries(g).map(([q,Z])=>n.createElement("span",{key:q,className:Z?"available":"unavailable"},q," · ",Z?"available":"unavailable")))),n.createElement(Xt,{as:"section",name:"runtime-usage.inspect",busy:w("usage.inspect"),className:"a-settings-section"},n.createElement("h3",null,"Usage & context"),n.createElement("button",{className:"a-soft",disabled:b,"data-action":"runtime.control",onClick:()=>x("usage.inspect")},n.createElement(Mt,null),"Refresh usage"),f&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},f.calls??0," model calls · ",f.messages??0," messages · ",f.userTurns??0," user turns"),I&&n.createElement("p",{title:I.title},I.text),n.createElement("p",{className:"a-caption"},((G=(P=f.contextCharacters)==null?void 0:P.toLocaleString)==null?void 0:G.call(P))??"Unknown"," context characters. Character counts are not token counts.")))),s.tab==="direction"&&n.createElement(n.Fragment,null,n.createElement(rF,{state:e,session:t,act:a}),n.createElement(aF,{session:t,act:a}),!y&&n.createElement(Xt,{as:"section",name:"runtime-goals.get",busy:w("goals.get"),className:"a-settings-section"},n.createElement("h3",null,"Goal"),n.createElement("p",null,"Give the session an explicit condition to work toward and an optional turn limit."),!k&&n.createElement("p",{className:"a-caption"},Object.keys(g).length?"This bundle does not expose a goal controller.":"Inspect session capabilities first to check goal support."),n.createElement("button",{className:"a-soft",disabled:!k||b,"data-action":"runtime.control",onClick:()=>x("goals.get")},n.createElement(Mt,null),"Load current goal"),m.goal&&n.createElement("div",{className:"a-selection-card"},n.createElement("p",null,n.createElement("strong",null,m.goal.condition)),n.createElement("small",null,m.goal.turns_used??0," turns used",m.goal.cap?` of ${m.goal.cap}`:""),m.goal.last_reason&&n.createElement("p",null,m.goal.last_reason)),n.createElement("label",{htmlFor:"runtime-goal"},"Goal condition"),n.createElement("textarea",{id:"runtime-goal",value:s.goalCondition,"data-action":"view.update",onChange:q=>c({goalCondition:q.target.value}),placeholder:"The requested changes are implemented and the checks pass."}),n.createElement("label",{htmlFor:"runtime-goal-turns"},"Maximum continuation turns (optional)"),n.createElement("input",{id:"runtime-goal-turns",type:"number",min:"1",value:s.goalMaxTurns,"data-action":"view.update",onChange:q=>c({goalMaxTurns:q.target.value})}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:!k||!s.goalCondition.trim()||N||b||s.goalMaxTurns!==""&&(!Number.isInteger(Number(s.goalMaxTurns))||Number(s.goalMaxTurns)<1),"data-action":"runtime.control",onClick:()=>x("goals.set",{condition:s.goalCondition.trim(),maxTurns:s.goalMaxTurns?Number(s.goalMaxTurns):null})},n.createElement(mm,null),"Set goal"),n.createElement("button",{className:"a-soft",disabled:!k||N||b,"data-action":"runtime.control",onClick:()=>x("goals.clear")},"Clear goal"))),n.createElement(Xt,{as:"section",name:"runtime-mode.list",busy:w("mode.list"),className:"a-settings-section"},n.createElement("h3",null,"Mode"),n.createElement("p",null,"Use a mode supplied by your bundle to adjust how the session works."),n.createElement("button",{className:"a-soft",disabled:!T||b,"data-action":"runtime.control",onClick:()=>x("mode.list")},n.createElement(Mt,null),"Load modes"),p.active&&n.createElement("p",{className:"a-caption"},"Active: ",typeof p.active=="string"?p.active:fs(p.active)),n.createElement("label",{htmlFor:"runtime-mode"},"Mode"),n.createElement("select",{id:"runtime-mode",value:s.mode,"data-action":"view.update",onChange:q=>c({mode:q.target.value})},n.createElement("option",{value:""},"Choose a mode"),(p.modes||[]).map(q=>n.createElement("option",{value:q.name,key:q.name},q.name,q.description?` — ${q.description}`:""))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:!T||!s.mode||N||b,"data-action":"runtime.control",onClick:()=>x("mode.set",{name:s.mode})},n.createElement(Pt,null),"Apply mode"),n.createElement("button",{className:"a-soft",disabled:!T||N||b,"data-action":"runtime.control",onClick:()=>x("mode.clear")},"Clear mode")),!T&&n.createElement("p",{className:"a-caption"},Object.keys(g).length?"This bundle does not expose modes.":"Inspect session capabilities first to check mode support."))),s.tab==="limits"&&n.createElement(n.Fragment,null,n.createElement(tF,{key:t.id,session:t,act:a}),n.createElement(eF,{results:u,run:x,busy:b,active:N}),n.createElement(Xt,{as:"section",name:"runtime-budget.get",busy:w("budget.get"),className:"a-settings-section"},n.createElement("h3",null,"Session limits"),n.createElement("p",null,"Adjust the active session’s model-turn and context limits."),n.createElement("button",{className:"a-soft",disabled:b,"data-action":"runtime.control",onClick:()=>x("budget.get")},n.createElement(Mt,null),"Load limits"),Object.keys(h).length>0&&n.createElement("p",{className:"a-caption"},"Current: ",h.maxIterations===-1?"unlimited":h.maxIterations??"unknown"," model turns · ",h.contextTokens??"unknown"," context tokens. ",h.contextNote||""),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"runtime-max-iterations"},"Maximum model turns (−1 for unlimited)"),n.createElement("input",{id:"runtime-max-iterations",type:"number",min:"-1","data-action":"view.update",value:s.maxIterations,placeholder:String(h.maxIterations??""),onChange:q=>c({maxIterations:q.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"runtime-context-tokens"},"Context token budget"),n.createElement("input",{id:"runtime-context-tokens",type:"number",min:"1","data-action":"view.update",value:s.contextTokens,placeholder:String(h.contextTokens??""),onChange:q=>c({contextTokens:q.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:N||b||!s.maxIterations&&!s.contextTokens||s.maxIterations!==""&&(!Number.isInteger(Number(s.maxIterations))||Number(s.maxIterations)!==-1&&Number(s.maxIterations)<1)||s.contextTokens!==""&&(!Number.isInteger(Number(s.contextTokens))||Number(s.contextTokens)<1),"data-action":"runtime.control",onClick:()=>x("budget.set",{...s.maxIterations!==""?{maxIterations:Number(s.maxIterations)}:{},...s.contextTokens!==""?{contextTokens:Number(s.contextTokens)}:{}})},n.createElement(Pt,null),"Update limits"))),n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Clear model context"),n.createElement("p",null,"Clear the model’s active context. The saved conversation remains in the app."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:s.clearConfirm,"data-action":"view.update",onChange:q=>c({clearConfirm:q.target.checked})}),"I want to clear the active model context."),n.createElement("button",{className:"a-soft a-danger",disabled:!s.clearConfirm||N||b,"data-action":"runtime.control",onClick:()=>x("context.clear")},n.createElement(ea,null),"Clear context"))),s.tab==="tools"&&n.createElement(n.Fragment,null,n.createElement(Xt,{as:"section",name:"runtime-catalog.inspect",busy:w("catalog.inspect"),className:"a-settings-section"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Tools"),n.createElement("p",null,"Inspect the actual tool schema, then invoke it through the session’s permission checks.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh tool catalog",disabled:b,"data-action":"runtime.control",onClick:()=>x("catalog.inspect")},n.createElement(Mt,null))),n.createElement("label",{htmlFor:"runtime-tool"},"Tool"),n.createElement("select",{id:"runtime-tool","data-action":"view.update",value:s.tool,onChange:q=>c({tool:q.target.value,toolArgs:"{}"})},n.createElement("option",{value:""},"Choose a tool"),A.map(q=>n.createElement("option",{key:q.name,value:q.name},q.name))),C&&n.createElement(n.Fragment,null,n.createElement("p",null,C.description),n.createElement("pre",{className:"a-state-view"},fs(C.inputSchema)),n.createElement("label",{htmlFor:"runtime-tool-arguments"},"Arguments (JSON)"),n.createElement("textarea",{id:"runtime-tool-arguments",className:"a-json-editor",spellCheck:!1,value:s.toolArgs,"data-action":"view.update",onChange:q=>c({toolArgs:q.target.value})}),z&&n.createElement("p",{className:"a-danger"},z),n.createElement("button",{className:"a-primary",disabled:!!z||N||b,"data-action":"runtime.control",onClick:()=>x("tool.invoke",{name:s.tool,arguments:F})},n.createElement(pg,null),"Run tool")),O&&n.createElement("div",{className:"a-tool-result"},n.createElement("h4",null,"Tool result"),((W=O.result)==null?void 0:W.error)&&n.createElement("p",{className:"a-danger"},typeof O.result.error=="string"?O.result.error:fs(O.result.error)),n.createElement(ml,{text:typeof((D=O.result)==null?void 0:D.output)=="string"?O.result.output:fs(((ne=O.result)==null?void 0:ne.output)??O)}))),n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Skills"),(d.skills||[]).length?n.createElement("ul",{className:"a-catalog-list"},d.skills.map(q=>n.createElement("li",{key:q.name},n.createElement("strong",null,q.name),n.createElement("p",null,q.description)))):n.createElement("p",null,"Inspect capabilities to see skills available in this bundle."),n.createElement("p",{className:"a-caption"},"Ask Amplifier to use a skill in the conversation, or select its loading tool above to inspect the exact arguments.")),n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Available agents"),n.createElement("ul",{className:"a-catalog-list"},Object.entries(d.agents||{}).map(([q,Z])=>{var ie;return n.createElement("li",{key:q},n.createElement("strong",null,q),n.createElement("p",null,Z.description||((ie=Z.meta)==null?void 0:ie.description)||""))})))),s.tab==="overview"&&n.createElement(yF,{sessionId:t.id,act:a}),s.tab==="overview"&&n.createElement(Hf,{state:e,session:t,act:a}),N&&n.createElement("p",{className:"a-caption"},"Changes and direct tool calls become available when this session and its workers are idle."))):n.createElement(Hf,{state:e,session:null,act:a})}const Vf=e=>new Date(e*1e3).toLocaleString();function Wf({value:e}){return n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Technical environment details"),n.createElement("p",{className:"a-wrap"},e.host.label," · ",e.platform,n.createElement("br",null),"Python ",e.python.version,n.createElement("br",null),n.createElement("code",null,e.python.path),n.createElement("br",null),"Computer-use package: ",e.computerUsePackage.version||e.computerUsePackage.status))}function wF({state:e,session:t,act:a}){var O,k,T,I,F,z,U,H,te;const r=JSON.stringify([t==null?void 0:t.id,(O=e.voice)==null?void 0:O.id,(k=e.voice)==null?void 0:k.status,(I=(T=e.voice)==null?void 0:T.visual)==null?void 0:I.id,(F=e.computerVisual)==null?void 0:F.id,(z=e.computerVisual)==null?void 0:z.available,(U=e.computerVisual)==null?void 0:U.sessionId,(H=e.updates)==null?void 0:H.installedAt]),o=v.useRef(0),[i,s]=v.useState(null),[l,c]=v.useState(!1),[u,d]=v.useState(""),[p,m]=v.useState(!1),[h,f]=v.useState("");v.useEffect(()=>(o.current++,s(null),c(!1),d(""),()=>{o.current++}),[r]);const g=(i==null?void 0:i.context)===r?i.value:null,y=g==null?void 0:g.worker,E=y==null?void 0:y.computerControl,b=g==null?void 0:g.featureSetup,S=Object.values(((te=e.updates)==null?void 0:te.featureResults)||{}).filter(j=>j.feature==="native-desktop"),w=S.sort((j,_)=>_.updatedAt-j.updatedAt)[0],N=p||(b==null?void 0:b.pending)||S.some(j=>["queued","staging","qualified","activating","restart_pending"].includes(j.phase));async function x(){if(!(p||!g)){m(!0),f("");try{const j=await a("updates.featureInstall",{feature:"native-desktop",hostInstanceId:g.host.instanceId});if(!(j!=null&&j.accepted)||!j.requestId)throw Error("The installation request could not be confirmed. Inspect Updates before retrying.")}catch(j){f(j.message)}finally{m(!1)}}}async function A(){const j=++o.current;c(!0),d("");try{const _=await a("desktop.readiness",t!=null&&t.id?{sessionId:t.id}:{});if(j!==o.current)return;if(!(_!=null&&_.result)||_.result.sessionId!==((t==null?void 0:t.id)||null))throw Error("Readiness did not return for this conversation. Check again.");s({context:r,value:_.result})}catch(_){j===o.current&&(d(_.message),s(null))}finally{j===o.current&&c(!1)}}const C=(j="",_="{}")=>a("view.update",{patch:{...Ww("runtime"),runtimeDraft:{tab:"tools",tool:j,toolArgs:_}}});return n.createElement("section",{"aria-label":"Desktop and browser readiness"},n.createElement("p",null,"Check which device and environment supply screen observation and optional computer or browser tools."),n.createElement("p",null,"Checking does not enable desktop control, capture a screen, request OS permission, start a conversation runtime or change your model."),n.createElement("button",{className:"a-soft","data-action":"desktop.readiness",disabled:l,onClick:A},l?"Checking…":"Check desktop and browser setup"),u&&n.createElement("p",{role:"alert"},u),w&&n.createElement("p",{role:"status"},"Native feature request: ",w.phase.replaceAll("_"," "),". ",w.detail),h&&n.createElement("p",{role:"alert"},h),g&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Checked ",Vf(g.observedAt),". This is a setup snapshot; check again after changing the host, tools or permissions."),n.createElement("section",{"aria-label":"Native screen observation"},n.createElement("h4",null,"Native screen observation"),n.createElement("p",null,"The serving app host can differ from your browser device and the conversation worker."),n.createElement(Wf,{value:g.host}),n.createElement("p",{role:"status"},"Native observation: ",g.nativeObservation.available?"ready for explicit consent":g.nativeObservation.code||g.nativeObservation.status),g.nativeObservation.reason&&n.createElement("p",{className:"a-wrap"},g.nativeObservation.reason),n.createElement("p",null,g.nativeObservation.nextStep),b!=null&&b.supported?n.createElement(n.Fragment,null,b.installedExtras.includes("native-desktop")?n.createElement("p",null,"The native observation package is installed. OS permission and consent for this conversation and browser are separate."):n.createElement(n.Fragment,null,n.createElement("p",null,b.detail),n.createElement("button",{className:"a-soft","data-action":"updates.featureInstall",disabled:N||!!h,onClick:x},"Install native screen observation"))):(b==null?void 0:b.reason)&&n.createElement("p",null,b.reason),n.createElement("p",{className:"a-caption"},"The Python path identifies the executing interpreter. It does not identify which parent application macOS lists in Screen Recording settings.")),n.createElement("section",{"aria-label":"Browser screen observation"},n.createElement("h4",null,"Shared screen source"),g.voiceObservation.source?n.createElement("p",null,"Selected ",g.voiceObservation.source.kind,": ",g.voiceObservation.source.label,". Permission expires ",Vf(g.voiceObservation.expiresAt),"."):n.createElement("p",null,"No source is shared for this conversation in this browser."),n.createElement("p",null,g.voiceObservation.nextStep),n.createElement("p",{className:"a-caption"},g.voiceObservation.browserContext)),n.createElement("section",{"aria-label":"Conversation computer tools"},n.createElement("h4",null,"Conversation computer and browser tools"),y.status!=="available"?n.createElement("p",null,y.reason):n.createElement(n.Fragment,null,n.createElement(Wf,{value:y}),n.createElement("p",null,"Computer control: ",E.status.replaceAll("_"," "),". Mounted tools are separate from native screen observation."),E.detail&&n.createElement("p",{className:"a-wrap"},E.detail),n.createElement("p",{className:"a-wrap"},"Mounted tools: ",y.mountedTools.join(", ")||"none"),n.createElement("details",null,n.createElement("summary",null,"Configured tool modules"),n.createElement("ul",null,y.modules.map(j=>n.createElement("li",{key:j.id},j.module," (",j.enabled?"enabled":"disabled",")")))),n.createElement("p",{className:"a-caption"},y.browserContext.reason),E.status==="unavailable"&&n.createElement(n.Fragment,null,n.createElement("p",null,"The computer-use module could not mount a working backend. Its existing setup tool can discover candidate targets, explicitly activate one, and separately persist that choice."),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>C("computer_use_unavailable",'{"action":"discover"}')},"Open computer target setup")),E.status==="not_mounted"&&n.createElement("p",null,"Review a computer-use bundle or connect a browser adapter in Smart Tools. A skill or installed library alone does not mount these tools in this conversation."),E.doctorSupported&&n.createElement(n.Fragment,null,n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>C("desktop",'{"action":"doctor"}')},"Open desktop doctor"),n.createElement("p",{className:"a-caption"},"In Session tools, refresh the catalog and run the prefilled doctor action. It is a prompt-free, no-content diagnostic through normal session policy; policy approval may still be required. It does not clear a halt or prove physical capture/control. Remote facts retain their connection-time ages; guard state is the last recorded state.")),E.status==="mounted"&&!E.doctorSupported&&n.createElement("p",null,"The mounted desktop tool does not advertise doctor. Review its own schema in Session tools."))),n.createElement("section",{"aria-label":"Desktop setup actions"},n.createElement("h4",null,"Set up optional tools"),n.createElement("p",null,"Use bundle review to add or enable tools, and Smart Tools to inspect an adapter's published schemas, connection and reported account identity. Confirm target and account through that adapter before acting."),n.createElement("div",{className:"a-dialog-actions"},g.nextActions.map(j=>n.createElement("button",{className:"a-soft",key:j.label,"data-action":j.action,onClick:()=>a(j.action,j.args)},j.label))),n.createElement("p",null,n.createElement("a",{href:"https://github.com/microsoft/amplifier-bundle-computer-use",target:"_blank",rel:"noreferrer"},"Computer-use installation and target setup")))))}function oi(e,t=!1){if(!e||e.value==null)return(e==null?void 0:e.status)==="empty"?"No recorded calls":(e==null?void 0:e.status)==="pending"?"Pending":"Unavailable";const a=e.value.toLocaleString(void 0,{maximumFractionDigits:t?6:0}),r=[];return e.estimatedCalls>0&&r.push("includes estimates"),e.pendingCalls>0&&r.push(`${e.pendingCalls} pending`),e.unknownCalls>0&&r.push(`${e.unknownCalls} unavailable`),`${t?"$":""}${a}${r.length?" · "+r.join(" · "):""}`}function Zf(e){const{sessionId:t,scope:a,source:r,calls:o,metrics:i,providers:s,coverage:l,excludedUnboundCalls:c}=e.usage;return{observedAt:e.observedAt,sessionId:t,scope:a,source:r,calls:o,metrics:i,providers:s,coverage:l,excludedUnboundCalls:c}}function kF({sessionId:e,act:t}){var y;const[a,r]=v.useState(null),[o,i]=v.useState(!1),[s,l]=v.useState(""),[c,u]=v.useState(!1),d=v.useRef(0);async function p(){var b,S;const E=++d.current;i(!0),l(""),u(!1);try{const w=await t("capacity.read",{sessionId:e,limit:1});if((w==null?void 0:w.accepted)===!1||((S=(b=w==null?void 0:w.result)==null?void 0:b.usage)==null?void 0:S.sessionId)!==e)throw Error("Usage could not be read.");E===d.current&&r(w.result)}catch(w){E===d.current&&l(w.message||"Usage could not be read.")}finally{E===d.current&&i(!1)}}v.useEffect(()=>(r(null),p(),()=>{d.current++}),[e]);const m=((y=a==null?void 0:a.usage)==null?void 0:y.sessionId)===e?a:null,h=m==null?void 0:m.usage,f=(h==null?void 0:h.metrics)||{};async function g(){try{await navigator.clipboard.writeText(JSON.stringify(Zf(m),null,2)),u(!0)}catch{l("Clipboard unavailable. Expand the usage data to select and copy it.")}}return n.createElement("section",{"aria-label":"Conversation usage",className:"a-settings-section"},n.createElement("h3",null,"Conversation usage"),n.createElement("p",{className:"a-caption"},"Recorded model calls in this chat and its observed workers. Cumulative tokens are not the current context-window size."),m&&n.createElement(n.Fragment,null,n.createElement("p",null,h.calls," recorded model calls · Snapshot ",new Date(m.observedAt*1e3).toLocaleTimeString()),n.createElement("dl",{className:"a-capability-counts"},n.createElement("div",null,n.createElement("dt",null,"Total tokens including cache writes"),n.createElement("dd",null,oi(f.grossTotalTokens))),n.createElement("div",null,n.createElement("dt",null,"Cost (USD)"),n.createElement("dd",null,oi(f.costUsd,!0)))),n.createElement("details",null,n.createElement("summary",null,"Token and model breakdown"),n.createElement("dl",null,[["inputTokens","Input tokens (includes cache reads)"],["outputTokens","Output tokens"],["reasoningTokens","Reasoning tokens (part of output)"],["cacheReadTokens","Cache-read tokens"],["cacheWriteTokens","Cache-write tokens"]].map(([E,b])=>n.createElement("div",{key:E},n.createElement("dt",null,b),n.createElement("dd",null,oi(f[E]))))),h.providers.map(E=>n.createElement("p",{key:E.provider+"|"+E.model},E.provider," / ",E.model," · ",E.calls," calls · ",oi(E.metrics.grossTotalTokens)," tokens · ",oi(E.metrics.costUsd,!0)))),n.createElement("p",{className:"a-caption"},"Historical calls without telemetry and provider-internal retries may be missing. Unavailable values are not zero.",h.excludedUnboundCalls>0?` ${h.excludedUnboundCalls} records could not be bound to this chat and are excluded.`:"")),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"capacity.read",disabled:o,onClick:p},o?"Reading usage…":"Refresh usage"),m&&n.createElement("button",{type:"button",className:"a-soft",onClick:g},"Copy usage")),m&&n.createElement("details",null,n.createElement("summary",null,"Usage data"),n.createElement("pre",{className:"a-state-view"},JSON.stringify(Zf(m),null,2))),c&&n.createElement("p",{role:"status"},"Usage copied"),s&&n.createElement("p",{role:"alert"},s))}function ck(e){return["working","running","starting","stopping"].includes(e.status)||e.configurationBusy||(e.workers||[]).some(t=>["queued","starting","running","working","stopping"].includes(t.status))}function uk({session:e,act:t}){var y,E;const[a,r]=v.useState(e.title||""),[o,i]=v.useState(!1),[s,l]=v.useState(""),c=v.useRef(!1),u=v.useRef(!1),d=e.autoName??(e.titleSource!=="manual"&&e.nativeNameSource!=="manual"),p=((y=e.naming)==null?void 0:y.status)==="working",[m,h]=v.useState(d);v.useEffect(()=>h(d),[d]),v.useEffect(()=>{c.current||r(e.title||"")},[e.title]);async function f(b){if(b.preventDefault(),!(u.current||!a.trim())){u.current=!0,i(!0),l("");try{const S=await t("session.rename",{id:e.id,title:a.trim()});if(!S||S.accepted===!1)throw Error("Could not save the name. Your edit is kept.");c.current=!1,r(a.trim())}catch(S){l(S.message)}finally{u.current=!1,i(!1)}}}async function g(b){if(!u.current){u.current=!0,i(!0),l(""),"automatic"in b&&h(b.automatic);try{const S=await t("session.naming",{id:e.id,...b});if(!S||S.accepted===!1)throw Error("Could not update chat naming.")}catch(S){h(d),l(S.message)}finally{u.current=!1,i(!1)}}}return n.createElement(n.Fragment,null,n.createElement("form",{onSubmit:f,"aria-busy":o||p},n.createElement("label",{htmlFor:"session-title"},"Chat name"),n.createElement("div",{className:"a-chat-name-row"},n.createElement("input",{id:"session-title",value:a,disabled:o,required:!0,maxLength:200,onChange:b=>{c.current=!0,r(b.target.value),l("")}}),n.createElement("label",{className:"a-chat-name-auto"},n.createElement("input",{type:"checkbox","aria-label":"Automatic chat naming","data-action":"session.naming",checked:m,disabled:o,onChange:b=>g({automatic:b.target.checked})}),"Auto"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Regenerate chat name",title:"Generate a name from this conversation","data-action":"session.naming",disabled:o||p||a!==e.title,onClick:()=>g({regenerate:!0})},n.createElement(Mt,{className:p?"a-name-spinning":void 0}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"submit",className:"a-soft","data-action":"session.rename",disabled:o||!a.trim()||a===e.title},o?"Saving…":"Save name")),p&&n.createElement("p",{role:"status"},"Generating chat name…"),(s||((E=e.naming)==null?void 0:E.error))&&n.createElement("p",{role:"alert",className:"a-danger"},s||e.naming.error)),n.createElement(xF,{key:e.id,session:e,act:t}))}function xF({session:e,act:t}){const[a,r]=v.useState(e.health),[o,i]=v.useState(""),[s,l]=v.useState(""),[c,u]=v.useState(""),d=v.useRef(!1);v.useEffect(()=>{r(e.health),u(""),l("")},[e.id,e.health,e.status,e.failure]);async function p(){var w;if(!d.current){d.current=!0,i("inspect"),l("");try{const N=await t("session.inspect",{id:e.id});if(!N||N.accepted===!1)throw Error("Could not inspect this conversation.");if((w=N.result)!=null&&w.stale)throw Error("The conversation changed while reading its diagnostics. Try copying again.");return r(N.result),N.result}catch(N){l(N.message)}finally{d.current=!1,i("")}}}v.useEffect(()=>{p()},[e.id]);async function m(){if(!d.current){d.current=!0,i("recover"),l("");try{const w=await t("session.recover",{id:e.id});if(!w||w.accepted===!1)throw Error("Could not create the recovery copy.")}catch(w){l(w.message)}finally{d.current=!1,i("")}}}async function h(w,N){try{await navigator.clipboard.writeText(w),u(N)}catch{l("Clipboard unavailable. Select and copy the session ID below.")}}async function f(){var N;if(d.current)return;const w=p();if((N=navigator.clipboard)!=null&&N.write&&typeof ClipboardItem<"u"){const x=w.then(A=>{if(!A)throw Error("Diagnostics unavailable");return new Blob([JSON.stringify(A,null,2)],{type:"text/plain"})});x.catch(()=>{});try{await navigator.clipboard.write([new ClipboardItem({"text/plain":x})]),u("Diagnostics copied")}catch{l(A=>A||"Clipboard unavailable. Select and copy the session ID below.")}}else{const x=await w;x&&await h(JSON.stringify(x,null,2),"Diagnostics copied")}}const g=a!=null&&a.status&&a.status!==e.status?void 0:a,y=Uu(e),E=(g==null?void 0:g.failure)||e.failure,b=(g==null?void 0:g.moduleFailures)||e.moduleFailures||[],S=ck(e);return n.createElement("div",{className:"a-conversation-details","aria-busy":!!o},n.createElement("div",null,n.createElement("p",null,n.createElement("strong",null,"Session ID"),n.createElement("span",{className:"a-session-identity"},n.createElement("code",null,y),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy session ID",title:"Copy session ID",onClick:()=>h(y,"Session ID copied")},n.createElement(rr,null)))),y!==e.id&&n.createElement("p",null,"App ID: ",n.createElement("code",{style:{overflowWrap:"anywhere"}},e.id)),n.createElement("p",{style:{overflowWrap:"anywhere"}},e.workspace,n.createElement("br",null),"Bundle: ",e.bundle," · Status: ",e.status),(E||e.error||b.length>0)&&(b.length>0?n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,"Configured modules could not load")),n.createElement("ul",null,b.map((w,N)=>n.createElement("li",{key:N},n.createElement("strong",null,w.module),": ",w.guidance)))):n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,(E==null?void 0:E.summary)||"The turn failed. Inspect the recorded details for its cause.")),n.createElement("p",null,(E==null?void 0:E.guidance)||"Work was not automatically replayed."),E&&n.createElement("p",null,"Recorded error: ",E.errorType,E.recordedAt?" · "+new Date(E.recordedAt*1e3||E.recordedAt).toLocaleString():""),(E==null?void 0:E.generationId)&&n.createElement("p",null,"Failed turn: ",n.createElement("code",null,E.generationId)),e.error&&n.createElement("details",null,n.createElement("summary",null,"Runtime message"),n.createElement("p",{style:{overflowWrap:"anywhere"}},e.error)))),n.createElement("p",null,"Create an independent copy with readable history. Old tool calls and image payloads stay in the original; reattach images if needed. Safety stops remain in effect. Nothing runs until you send a new message."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"session.recover",disabled:!!o||S,onClick:m},o==="recover"?"Creating recovery copy…":"Create recovery copy"),n.createElement("button",{type:"button",className:"a-soft",disabled:!!o,onClick:f},"Copy diagnostics")),S&&n.createElement("p",null,"Wait for the current work to stop before creating a copy.")),c&&n.createElement("p",{role:"status"},c),s&&n.createElement("p",{role:"alert",className:"a-danger"},s),n.createElement(kF,{key:e.id,sessionId:e.id,act:t}))}function SF({state:e,session:t,act:a}){var h,f;const[r,o]=v.useState(!1);if(!(t!=null&&t.error))return t!=null&&t.recovery?n.createElement("p",{className:"a-hint"},"Recovery copy · Readable history retained. Old tool and image payloads remain in the original conversation. No work was replayed."):null;const i=(f=(h=e.attention)==null?void 0:h.items)==null?void 0:f.find(g=>g.id==="session:"+t.id),s=t.failure,l=(s==null?void 0:s.category)==="context_limit",c=ck(t);async function u(){if(!(r||c)){o(!0);try{await a("session.recover",{id:t.id})}finally{o(!1)}}}if(i!=null&&i.read)return null;if(l)return n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,n.createElement("strong",null,"Context limit reached.")," ",s.summary," ",s.guidance),n.createElement("button",{type:"button",className:"a-link","data-action":"session.recover",disabled:r||c,onClick:u},r?"Creating recovery copy…":"Create recovery copy"),i&&n.createElement("button",{type:"button","aria-label":"Dismiss conversation error","data-action":"attention.read",onClick:()=>br(a,[i])},n.createElement(nn,null)));const d=(s==null?void 0:s.recordedAt)??t.errorAt,p=Number.isFinite(d)&&d>0?new Date(d*1e3):null,m=p&&Number.isFinite(p.getTime())?p:null;return n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,n.createElement("strong",null,(s==null?void 0:s.category)==="worker_startup"?"Chat could not start.":"A turn stopped.")," ",m&&n.createElement("time",{dateTime:m.toISOString()},m.toLocaleString()," · "),(s==null?void 0:s.summary)||"The cause is not available in the saved details."," Your conversation is saved."),n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>a("view.update",{patch:{panel:"session-details"}})},"View error details"),i&&n.createElement("button",{type:"button","aria-label":"Dismiss conversation error","data-action":"attention.read",onClick:()=>br(a,[i])},n.createElement(nn,null)))}function CF({session:e,act:t}){const[a,r]=v.useState(""),[o,i]=v.useState("workspace"),[s,l]=v.useState(null),[c,u]=v.useState(null),[d,p]=v.useState(null),[m,h]=v.useState([]),[f,g]=v.useState(null),[y,E]=v.useState(""),[b,S]=v.useState("task"),[w,N]=v.useState("available"),[x,A]=v.useState(null),[C,O]=v.useState(""),[k,T]=v.useState(!1),[I,F]=v.useState(null),z=v.useRef(!0),U=v.useRef(!1),H=v.useRef(null),te=e==null?void 0:e.id,j=v.useRef(te);j.current=te,v.useEffect(()=>{H.current=null,u(null),p(null),h([]),g(null),A(null),E(""),l(null),F(null),O("")},[te]),v.useEffect(()=>(z.current=!0,()=>{z.current=!1}),[]);async function _(q,Z,ie){if(!U.current){U.current=!0,T(!0),O("");try{const ke=await t(q,{sessionId:te,...Z});if(!(ke!=null&&ke.accepted))throw Error("The request was not accepted.");return z.current&&j.current===te&&(ie==null||ie(ke.result)),ke.result}catch(ke){z.current&&O(ke.message)}finally{U.current=!1,z.current&&T(!1)}}}v.useEffect(()=>{if(!te||(s==null?void 0:s.status)!=="indexing")return;const q=setInterval(()=>_("recall.status",{},l),750);return()=>clearInterval(q)},[te,s]),v.useEffect(()=>{te&&!k&&!U.current&&H.current!==te&&(H.current=te,_("memory.status",{},F))},[te,k]),v.useEffect(()=>{if(!(I!=null&&I.running))return;const q=setInterval(()=>_("memory.status",{},F),750);return()=>clearInterval(q)},[te,I==null?void 0:I.running]);const P=q=>_("memory.configure",{expectedRevision:I.settings.revision,...q},F),G=(q=0)=>_("recall.search",{query:a,scope:o,offset:q},Z=>{u(ie=>q?{...Z,items:[...ie.items,...Z.items]}:Z),l(Z.coverage)}),W=(q=0,Z=w)=>_("memory.list",{scope:Z,offset:q},ie=>{h(ke=>q?[...ke,...ie.items]:ie.items),g(ie.nextOffset)}),D=q=>_("recall.read",{sourceSessionId:q.sessionId,messageId:q.messageId,sourceRevision:q.sourceRevision},p),ne=async q=>{q.preventDefault(),await _(x?"memory.update":"memory.create",{...x?{id:x.id,expectedRevision:x.revision,allScopes:w==="all"}:{scope:b},text:y})&&(E(""),A(null),await W())};return te?n.createElement(n.Fragment,null,n.createElement("section",{className:"a-settings-section","aria-label":"Automatic memory"},n.createElement("h3",null,"Automatic memory"),n.createElement("p",null,"Workspace references can capture your stated preferences, settled decisions, and approaches you said worked. Review their exact sources and correct them when needed."),I&&n.createElement(n.Fragment,null,n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:I.settings.contribute,disabled:k,"data-action":"memory.configure",onChange:q=>P({contribute:q.target.checked})}),"Save useful details from this workspace"),n.createElement("p",null,"Saving memory uses your chosen AI models and may incur provider charges. Review saved details to correct mistakes."),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:I.settings.use,disabled:k,"data-action":"memory.configure",onChange:q=>P({use:q.target.checked})}),"Use saved memory in this workspace"),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:I.settings.excludedSessions.includes(te),disabled:k,"data-action":"memory.configure",onChange:q=>P({excludedSessions:q.target.checked?[...I.settings.excludedSessions,te]:I.settings.excludedSessions.filter(Z=>Z!==te)})}),"Exclude this conversation from contribution and automatic use"),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Memory activity & limits"),n.createElement("div",null,n.createElement("p",null,"Up to ",I.settings.maxCallsPerDay," model attempts per day, 16,000 source characters and 4,096 output tokens per attempt. Only attributable user statements qualify."),n.createElement("label",{htmlFor:"memory-call-limit"},"Maximum model attempts per day"),n.createElement("input",{id:"memory-call-limit",type:"number",min:1,max:10,disabled:k,value:I.settings.maxCallsPerDay,onChange:q=>{const Z=Number(q.target.value);Z>=1&&Z<=10&&P({maxCallsPerDay:Z})}}),n.createElement("button",{type:"button",className:"a-soft",disabled:k||I.running||!I.settings.contribute,"data-action":"memory.consolidate",onClick:()=>_("memory.consolidate",{},F)},"Consolidate eligible past conversations"),n.createElement("p",{role:"status"},I.running?"Consolidating…":"No consolidation running",". Saved references remain inspectable when contribution or use is off."),I.activity&&n.createElement("p",null,I.activity.status,I.activity.reason?" · "+I.activity.reason:""),I.attempts.map(q=>n.createElement("p",{key:q.id},"Conversation ",q.sessionId,": ",q.status,q.saved?` · ${q.saved.length} saved`:"",q.reason?` · ${q.reason}`:"",q.model?` · ${q.model}`:"")),I.lastContext&&n.createElement("div",{"aria-label":"Last memory context"},n.createElement("strong",null,"Last context supplied"),I.lastContext.items.length?I.lastContext.items.map(q=>n.createElement("p",{key:q.id},q.id," · revision ",q.revision," · matched ",q.matchTerms.join(", "))):n.createElement("p",null,"No relevant memory was selected."))))),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.status",onClick:()=>_("memory.status",{},F)},"Refresh memory activity")),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Find past work"),n.createElement("section",{className:"a-settings-section","aria-label":"Indexed recall"},n.createElement("p",null,"Search saved conversation text. Reading a result leaves your current conversation and draft in place."),n.createElement("button",{type:"button",className:"a-soft",disabled:k||(s==null?void 0:s.status)==="indexing","data-action":"recall.refresh",onClick:()=>_("recall.refresh",{},l)},"Update search index"),s&&n.createElement("p",{role:"status"},s.status," · ",s.indexed," of ",s.total??"unknown"," conversations indexed",s.errorCount?` · ${s.errorCount} unavailable`:"",". ",s.checkedAt?"Last checked "+new Date(s.checkedAt*1e3).toLocaleString():""),n.createElement("form",{onSubmit:q=>{q.preventDefault(),G()}},n.createElement("label",{htmlFor:"recall-query"},"Search conversations, tasks and outputs"),n.createElement("input",{id:"recall-query",value:a,maxLength:500,onChange:q=>r(q.target.value)}),n.createElement("label",{htmlFor:"recall-scope"},"Search scope"),n.createElement("select",{id:"recall-scope",value:o,onChange:q=>i(q.target.value)},n.createElement("option",{value:"task"},"This conversation"),n.createElement("option",{value:"workspace"},"This workspace"),n.createElement("option",{value:"all"},"All registered conversations")),n.createElement("button",{type:"submit",className:"a-primary","data-action":"recall.search",disabled:k||!a.trim()},"Search past work")),c&&n.createElement(n.Fragment,null,n.createElement("p",null,"Matches contain all search terms. Coverage and source dates matter; an empty partial search does not prove nothing exists."),c.items.map(q=>n.createElement("div",{className:"a-selection-card",key:q.sessionId+q.messageId},n.createElement("strong",null,q.session.title),n.createElement("p",null,q.snippet),n.createElement("small",null,q.role,q.via==="call"?" · voice":""),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"recall.read",onClick:()=>D(q)},"Read source"))),c.nextOffset!==null&&n.createElement("button",{type:"button",className:"a-soft",disabled:k,onClick:()=>G(c.nextOffset)},"More matches")),d&&n.createElement("div",{className:"a-selection-card","aria-label":"Verified source"},n.createElement("strong",null,"Source verified for this read"),n.createElement("pre",{className:"a-state-view",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}},d.text),n.createElement("small",null,"Conversation ",d.sessionId," · ",d.sourceKind==="message"?"message":"record"," ",d.recordId||d.messageId),d.nextOffset!=null&&n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"recall.read",onClick:()=>_("recall.read",{sourceSessionId:d.sessionId,messageId:d.messageId,sourceRevision:d.sourceRevision,offset:d.nextOffset},q=>p(Z=>({...q,text:Z.text+q.text})))},"Read more")))),n.createElement("section",{className:"a-settings-section","aria-label":"Saved memory"},n.createElement("h3",null,"Saved memory"),n.createElement("p",null,"Notes are reference material. They do not grant permission or start work. Automatic contribution and use are separately controlled above."),n.createElement("label",{htmlFor:"memory-view"},"Inspect scope"),n.createElement("select",{id:"memory-view",disabled:k,value:w,onChange:q=>{N(q.target.value),W(0,q.target.value)}},n.createElement("option",{value:"available"},"Notes for this work"),n.createElement("option",{value:"all"},"All saved notes, including removed chats")),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.list",onClick:()=>W()},"Inspect saved memory"),n.createElement("form",{onSubmit:ne},n.createElement("label",{htmlFor:"memory-text"},"Memory note"),n.createElement("textarea",{id:"memory-text",disabled:k,value:y,maxLength:8e3,rows:4,onChange:q=>E(q.target.value)}),!x&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"memory-scope"},"Remember for"),n.createElement("select",{id:"memory-scope",disabled:k,value:b,onChange:q=>S(q.target.value)},n.createElement("option",{value:"task"},"This conversation"),n.createElement("option",{value:"workspace"},"This workspace"),n.createElement("option",{value:"global"},"All work"))),n.createElement("button",{type:"submit",className:"a-primary","data-action":x?"memory.update":"memory.create",disabled:k||!y.trim()},x?"Save correction":"Save memory"),x&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>{A(null),E("")}},"Cancel edit")),m.map(q=>{var Z;return n.createElement("div",{key:q.id,className:"a-selection-card"},n.createElement("strong",null,q.scope," · revision ",q.revision),q.supersededBy&&n.createElement("p",null,"Superseded by ",q.supersededBy,"; excluded from automatic context."),n.createElement("p",{style:{whiteSpace:"pre-wrap"}},q.text),n.createElement("small",null,"Saved through ",q.provenance.origin,q.provenance.wording?" · "+q.provenance.wording:""),((Z=q.source)==null?void 0:Z.quote)&&n.createElement("blockquote",null,q.source.quote),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.read",onClick:()=>_("memory.read",{id:q.id,allScopes:w==="all"},ie=>{A(ie),E(ie.text)})},"Inspect or correct"),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.delete",onClick:async()=>{await _("memory.delete",{id:q.id,expectedRevision:q.revision,allScopes:w==="all"})&&((x==null?void 0:x.id)===q.id&&(A(null),E("")),await W())}},"Delete memory")),q.source&&n.createElement("button",{type:"button",className:"a-link",disabled:k,onClick:()=>q.source.kind==="attributed-user"?_("memory.source",{id:q.id},p):D(q.source)},"Read original source"))}),f!==null&&n.createElement("button",{type:"button",className:"a-soft",disabled:k,onClick:()=>W(f)},"More saved notes"),x&&n.createElement("details",null,n.createElement("summary",null,"Retained revisions (",x.versions.length,", up to 50)"),x.versions.map(q=>n.createElement("p",{key:q.revision},"Revision ",q.revision,": ",q.text))),n.createElement("p",null,"Deleting removes the saved note and its retained revisions. Original chats and existing private backups remain.")),C&&n.createElement("p",{role:"alert",className:"a-danger"},C)):n.createElement("p",null,"Open a conversation to manage memory for its workspace. Your existing memory settings are kept.")}function dk(e){return n.createElement(NF,{key:e.session.id,...e})}function NF({session:e,state:t,act:a}){var k,T,I;const[r,o]=v.useState("all"),[i,s]=v.useState(!1),l=(e.messages||[]).filter(F=>F.id&&["user","assistant"].includes(F.role)&&!F.streaming),[c,u]=v.useState(((k=l[0])==null?void 0:k.id)||""),[d,p]=v.useState(((T=l.at(-1))==null?void 0:T.id)||""),[m,h]=v.useState(null),[f,g]=v.useState(!1),[y,E]=v.useState(""),b=v.useRef(0);v.useEffect(()=>()=>{b.current++},[]);const S=(I=t.view)==null?void 0:I.conversationExport,w=(S==null?void 0:S.sessionId)===e.id?S:null,N=f||(w==null?void 0:w.status)==="pending",x=F=>{b.current++,h(null),E(""),F()},A=async()=>{var z;const F=++b.current;g(!0),E(""),h(null);try{const U=await a("session.export",{id:e.id,format:"markdown",destination:"none",scope:r,minimal:i,...r!=="all"?{fromMessageId:c}:{},...r==="range"?{throughMessageId:d}:{}});if(F!==b.current)return;if(!((z=U==null?void 0:U.result)!=null&&z.snapshotId))throw Error("The export could not be prepared. Please try again.");const H=U.result,te=await St(H.url,{cache:"no-store"});if(typeof te.content!="string")throw Error("The reviewed export is unavailable.");F===b.current&&h({...H,text:te.content})}catch(U){F===b.current&&E(U.message||"The export could not be prepared.")}finally{F===b.current&&g(!1)}},C=async F=>{E("");try{await a("session.exportDeliver",{id:e.id,snapshotId:m.snapshotId,destination:F})}catch(z){E(z.message||"The export could not be delivered.")}},O=l.map((F,z)=>n.createElement("option",{key:F.id+":"+z,value:F.id},z+1,". ",F.role==="user"?"You":"Amplifier",": ",String(F.text||"").replace(/\s+/g," ").slice(0,90)));return n.createElement("div",null,n.createElement("p",{className:"a-caption"},"Preview user-visible conversation text before copying or downloading. Full exports include history outside the loaded page. Voice exchanges are included; files are referenced, never embedded."),n.createElement("label",{className:"a-field"},"Export scope",n.createElement("select",{"aria-label":"Export scope",value:r,disabled:N,onChange:F=>x(()=>o(F.target.value))},n.createElement("option",{value:"all"},"Full conversation"),n.createElement("option",{value:"from",disabled:!l.length},"From a message onward"),n.createElement("option",{value:"range",disabled:!l.length},"Selected message range"))),r!=="all"&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Choose boundaries from loaded messages. Load earlier messages in the chat to choose an older starting point."),n.createElement("label",{className:"a-field"},"Starting message",n.createElement("select",{"aria-label":"Starting message",value:c,disabled:N,onChange:F=>x(()=>u(F.target.value))},O)),r==="range"&&n.createElement("label",{className:"a-field"},"Ending message",n.createElement("select",{"aria-label":"Ending message",value:d,disabled:N,onChange:F=>x(()=>p(F.target.value))},O))),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:i,disabled:N,onChange:F=>x(()=>s(F.target.checked))})," Minimal context: omit conversation identifiers"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:N,onClick:A},f?"Preparing preview…":m?"Refresh preview":"Preview Markdown"),n.createElement("button",{type:"button",className:"a-link","data-action":"session.export",disabled:N,onClick:()=>a("session.export",{id:e.id})},"Export JSON")),m&&n.createElement("section",{"aria-label":"Conversation export preview"},n.createElement("p",null,m.summary.messageCount," messages · ",m.summary.bytes.toLocaleString()," bytes · ",m.summary.attachmentCount," attachment references · ",m.summary.artifactCount," artifact references"),n.createElement("p",{className:"a-caption"},"Captured ",new Date(m.capturedAt).toLocaleString(),". Copy and download use this exact preview, even if the conversation continues."),m.summary.omissions.map(F=>n.createElement("p",{className:"a-caption",key:F},F)),n.createElement("textarea",{"aria-label":"Reviewed Markdown",readOnly:!0,value:m.text,rows:10,style:{width:"100%",maxWidth:"100%",boxSizing:"border-box"}}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"session.exportDeliver",disabled:N,onClick:()=>C("clipboard")},n.createElement(rr,null),"Copy Markdown"),n.createElement("button",{type:"button",className:"a-soft","data-action":"session.exportDeliver",disabled:N,onClick:()=>C("download")},n.createElement(wa,null),"Download Markdown"))),y&&n.createElement("p",{role:"alert"},y),w&&n.createElement("p",{role:w.status==="error"?"alert":"status"},w.status==="pending"?"Delivering reviewed export…":w.message))}function RF({session:e,act:t}){var ue,ye;const[a,r]=v.useState([]),[o,i]=v.useState(null),[s,l]=v.useState(!1),[c,u]=v.useState(null),[d,p]=v.useState(!1),[m,h]=v.useState(""),[f,g]=v.useState("file"),[y,E]=v.useState(""),[b,S]=v.useState(""),[w,N]=v.useState(""),[x,A]=v.useState(""),[C,O]=v.useState("document"),[k,T]=v.useState(null),[I,F]=v.useState("unstaged"),[z,U]=v.useState(""),[H,te]=v.useState(""),[j,_]=v.useState(""),[P,G]=v.useState(""),[W,D]=v.useState("right"),[ne,q]=v.useState(""),Z=v.useRef(!1),ie=e==null?void 0:e.id;async function ke(M,Y,se){if(!Z.current){Z.current=!0,p(!0),h("");try{const Fe=await t(M,{sessionId:ie,...Y});if(!(Fe!=null&&Fe.accepted))throw Error("The request was not accepted.");return se==null||se(Fe.result),Fe.result}catch(Fe){h(Fe.message)}finally{Z.current=!1,p(!1)}}}const me=(M=0,Y=s)=>ke("outputs.list",{includeUnlinked:Y,offset:M},se=>{r(Fe=>M?[...Fe,...se.items]:se.items),i(se.nextOffset)}),_e=M=>ke("outputs.read",{id:M},u),Je=async(M,Y)=>{const se=await ke(M,Y,u);return se&&await me(),se},De=async()=>{let M=await ke("outputs.read",{id:c.id});if(!M)return;let Y=M.text||"";for(;M.nextOffset!==null&&M.nextOffset!==void 0;){if(M=await ke("outputs.read",{id:c.id,offset:M.nextOffset}),!M)return;Y+=M.text||""}A(Y),O(c.variant||"document"),E(c.title),T(c.id)};return ie?n.createElement("section",{"aria-label":"Output relationships"},n.createElement("h3",null,"Outputs & review"),n.createElement("p",null,"Keep exact saved versions, their origin and review notes with this conversation."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:s,disabled:d,onChange:M=>{l(M.target.checked),me(0,M.target.checked)}}),"Include unlinked outputs"),n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":"outputs.list",onClick:()=>me()},"Inspect outputs"),a.map(M=>n.createElement("div",{className:"a-selection-card",key:M.id},n.createElement("strong",null,M.title),n.createElement("p",null,M.kind," · version ",M.version," · ",M.linked?"linked":"unlinked"),n.createElement("small",null,M.versionEvidence==="snapshot"?"Saved exact content":M.externalVersion?"Version reference: "+M.externalVersion:"External reference; version unknown"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":"outputs.read",onClick:()=>_e(M.id)},"Read saved output"),n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":M.linked?"outputs.unlink":"outputs.relink",onClick:async()=>{await ke(M.linked?"outputs.unlink":"outputs.relink",{id:M.id,expectedRevision:M.revision})&&((c==null?void 0:c.id)===M.id&&u(null),await me())}},M.linked?"Unlink":"Restore link")))),o!==null&&n.createElement("button",{type:"button",disabled:d,className:"a-soft",onClick:()=>me(o)},"More outputs"),c&&n.createElement("div",{className:"a-selection-card","aria-label":"Saved output detail"},n.createElement("h4",null,c.title),n.createElement("p",null,c.versionEvidence==="snapshot"?"Immutable saved content":"External reference only; remote contents were not fetched."),c.text!==void 0&&n.createElement("pre",{className:"a-state-view",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}},c.text),c.nextOffset!==null&&c.nextOffset!==void 0&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,onClick:()=>ke("outputs.read",{id:c.id,offset:c.nextOffset},M=>u(Y=>({...M,text:Y.text+M.text})))},"Read more"),c.downloadUrl&&n.createElement("a",{href:c.downloadUrl,download:!0},"Download exact version"),c.binary&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":"outputs.image",onClick:()=>ke("outputs.image",{id:c.id,sha256:c.sha256},M=>u(Y=>({...Y,image:M})))},"View saved PNG"),c.image&&n.createElement("figure",null,n.createElement("img",{src:c.image.imageUrl,alt:"Saved output: "+c.title,style:{maxWidth:"100%",height:"auto"}}),n.createElement("figcaption",null,"Exact saved image · ",c.image.width," × ",c.image.height,". Viewing does not send a message.")),c.url&&n.createElement("a",{href:c.url,target:"_blank",rel:"noopener noreferrer"},"Open external reference"),n.createElement("p",null,"Origin: ",c.origin.source,c.origin.messageId?" · message "+c.origin.messageId:" · no originating message supplied"),c.sha256&&n.createElement("small",{style:{overflowWrap:"anywhere"}},"Content hash: ",c.sha256),c.parentId&&n.createElement("button",{type:"button",className:"a-link",disabled:d,onClick:()=>_e(c.parentId)},"Read prior version"),(ue=c.evidenceIds)==null?void 0:ue.map(M=>n.createElement("button",{type:"button",className:"a-link",key:M,disabled:d,onClick:()=>_e(M)},"Read evidence ",M)),c.kind==="writing"&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,onClick:De},"Edit as a new version"),n.createElement("h4",null,"Local review notes"),c.nextCommentOffset!==null&&c.nextCommentOffset!==void 0&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,onClick:()=>ke("outputs.read",{id:c.id,commentOffset:c.nextCommentOffset},M=>u(Y=>({...Y,comments:[...Y.comments||[],...M.comments],nextCommentOffset:M.nextCommentOffset})))},"More review notes"),(ye=c.comments)==null?void 0:ye.map(M=>n.createElement("p",{key:M.id},M.path&&`${M.path}:${M.line} (${M.side}) · `,M.body)),n.createElement("form",{onSubmit:async M=>{M.preventDefault(),await ke("outputs.comment",{id:c.id,body:j,...P?{path:ne,side:W,line:Number(P)}:{}})&&(_(""),await _e(c.id))}},n.createElement("label",{htmlFor:"output-comment"},"Review note"),n.createElement("textarea",{id:"output-comment",disabled:d,value:j,onChange:M=>_(M.target.value),maxLength:8e3}),c.kind==="git_review"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"output-comment-path"},"Diff file (optional)"),n.createElement("input",{id:"output-comment-path",value:ne,disabled:d,onChange:M=>q(M.target.value)}),n.createElement("label",{htmlFor:"output-comment-line"},"Displayed line (optional)"),n.createElement("input",{id:"output-comment-line",type:"number",min:"1",value:P,disabled:d,onChange:M=>G(M.target.value)}),n.createElement("label",{htmlFor:"output-comment-side"},"Diff side"),n.createElement("select",{id:"output-comment-side",disabled:d,value:W,onChange:M=>D(M.target.value)},n.createElement("option",{value:"right"},"Updated"),n.createElement("option",{value:"left"},"Original"))),n.createElement("button",{className:"a-primary",disabled:d||!j.trim(),"data-action":"outputs.comment"},"Save local review note")),n.createElement("p",null,"Review notes stay here. They are not posted to a remote service.")),n.createElement("h4",null,"Attach an output"),n.createElement("form",{onSubmit:M=>{M.preventDefault(),Je("outputs.attach",{kind:f,title:y,...f==="canvas"?{canvasId:b}:["file","dataset"].includes(f)?{path:b}:{url:b,...w?{version:w}:{}}})}},n.createElement("label",{htmlFor:"output-kind"},"Output type"),n.createElement("select",{id:"output-kind",value:f,disabled:d,onChange:M=>g(M.target.value)},["file","dataset","canvas","pull_request","external_document"].map(M=>n.createElement("option",{key:M,value:M},M.replaceAll("_"," ")))),n.createElement("label",{htmlFor:"output-title"},"Output title"),n.createElement("input",{id:"output-title",value:y,disabled:d,maxLength:200,onChange:M=>E(M.target.value)}),n.createElement("label",{htmlFor:"output-location"},f==="canvas"?"Saved canvas ID":["file","dataset"].includes(f)?"File in this workspace":"External URL"),n.createElement("input",{id:"output-location",disabled:d,value:b,onChange:M=>S(M.target.value)}),["pull_request","external_document"].includes(f)&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"output-version"},"Version reference (optional)"),n.createElement("input",{id:"output-version",disabled:d,value:w,onChange:M=>N(M.target.value)})),n.createElement("button",{className:"a-primary",disabled:d||!y.trim()||!b.trim(),"data-action":"outputs.attach"},"Attach output")),n.createElement("h4",null,"Reusable writing"),n.createElement("form",{onSubmit:async M=>{M.preventDefault(),await Je("outputs.write",{title:y||"Writing",content:x,variant:C,...k?{parentId:k}:{}})&&T(null)}},n.createElement("label",{htmlFor:"writing-variant"},"Writing type"),n.createElement("select",{id:"writing-variant",value:C,disabled:d,onChange:M=>O(M.target.value)},["document","email","chat_message","social_post","standard"].map(M=>n.createElement("option",{key:M,value:M},M.replaceAll("_"," ")))),n.createElement("label",{htmlFor:"writing-content"},"Writing content"),n.createElement("textarea",{id:"writing-content",rows:6,value:x,disabled:d,maxLength:1e5,onChange:M=>A(M.target.value)}),n.createElement("p",null,k?"Saving creates a new version; the prior version remains.":"Saving keeps a copy here; it does not send or publish."),n.createElement("button",{className:"a-primary",disabled:d||!x.trim(),"data-action":"outputs.write"},"Save writing version"),k&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>T(null)},"Start separate output")),n.createElement("h4",null,"Git review"),n.createElement("form",{onSubmit:M=>{M.preventDefault(),Je("outputs.review",{mode:I,...I==="branch"?{base:z}:{},...H?{path:H}:{}})}},n.createElement("label",{htmlFor:"review-mode"},"Changes to inspect"),n.createElement("select",{id:"review-mode",value:I,disabled:d,onChange:M=>F(M.target.value)},n.createElement("option",{value:"unstaged"},"Unstaged tracked changes"),n.createElement("option",{value:"staged"},"Staged changes"),n.createElement("option",{value:"branch"},"Base revision to HEAD")),I==="branch"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"review-base"},"Existing base revision"),n.createElement("input",{id:"review-base",value:z,disabled:d,onChange:M=>U(M.target.value)})),n.createElement("label",{htmlFor:"review-path"},"Relative file path (optional)"),n.createElement("input",{id:"review-path",value:H,disabled:d,onChange:M=>te(M.target.value)}),n.createElement("button",{className:"a-primary",disabled:d||I==="branch"&&!z.trim(),"data-action":"outputs.review"},"Save review snapshot")),n.createElement("p",null,"Untracked files and binary contents are excluded. This only reads changes."),m&&n.createElement("p",{role:"alert"},m)):n.createElement("p",null,"Choose a conversation to inspect its outputs.")}const Mc=new Map;function TF(e){return Mc.has(e)||Mc.set(e,{pending:null,busy:!1,listeners:new Set}),Mc.get(e)}function ii(e){e.listeners.forEach(t=>t())}const to=e=>typeof e=="string"?e:(e==null?void 0:e.message)||JSON.stringify(e||"The action failed."),Jf=(e,t)=>Object.assign(Error(e!=null&&e.error?to(e.error):t),{code:e==null?void 0:e.code,state:e==null?void 0:e.state,receipt:e==null?void 0:e.receipt,status:e==null?void 0:e.status}),IF=e=>{var t;return(e==null?void 0:e.code)==="unknown_outcome"||["unknown","running"].includes(e==null?void 0:e.state)||["unknown","running"].includes((t=e==null?void 0:e.receipt)==null?void 0:t.state)},gs=e=>{try{const t=new URL(e);return["http:","https:"].includes(t.protocol)?t.href:null}catch{return null}},vs={targetId:"",label:"",hostname:"",username:"",python:"",socketPath:"",expectedBind:"127.0.0.1"};function AF({session:e,act:t}){var Ze,it,zt,ct,qt,le,fe,xe,ze,Ye,ht,bt,ft,Ce,gt,Et,vt,at,X,Re;const a=e==null?void 0:e.id,r=TF(a),[,o]=v.useReducer(ae=>ae+1,0),i=((Ze=r.pending)==null?void 0:Ze.args.targetId)||"loopback",s=v.useRef(i),[l,c]=v.useState(i),[u,d]=v.useState(null),[p,m]=v.useState({...vs}),[h,f]=v.useState(0),[g,y]=v.useState(null),[E,b]=v.useState(((it=r.pending)==null?void 0:it.args.siteId)||""),[S,w]=v.useState(""),[N,x]=v.useState(((zt=r.pending)==null?void 0:zt.args.releaseId)||""),[A,C]=v.useState(""),[O,k]=v.useState(!1),[T,I]=v.useState(""),[F,z]=v.useState(""),[U,H]=v.useState(null),te=v.useRef(!0),j=v.useRef(!1);v.useEffect(()=>(te.current=!0,r.listeners.add(o),()=>{te.current=!1,r.listeners.delete(o)}),[r]);const _=ae=>{te.current&&ae()},P=(g==null?void 0:g.sites)||[],G=(g==null?void 0:g.releases)||[],W=P.find(ae=>ae.id===E),D=G.find(ae=>ae.id===N&&ae.siteId===E),ne=(u==null?void 0:u.targets)||[],q=ne.find(ae=>ae.id===l),Z=r.busy||O,ie=Z||!!r.pending,ke=G.filter(ae=>ae.siteId===E),me=(u==null?void 0:u.selectedTargetId)===l&&((q==null?void 0:q.kind)==="loopback"||((ct=q==null?void 0:q.inspection)==null?void 0:ct.revision)===(q==null?void 0:q.revision)&&u.selectedTargetRevision===q.revision&&u.selectedServiceId===((qt=q.inspection)==null?void 0:qt.serviceId)),_e=ie||!me,Je=((le=g==null?void 0:g.target)==null?void 0:le.accessPolicy)||((xe=(fe=q==null?void 0:q.inspection)==null?void 0:fe.capabilities)==null?void 0:xe.accessPolicy);function De(ae){s.current!==ae&&(s.current=ae,_(()=>{c(ae),y(null),b(""),x(""),C(""),H(null)}))}async function ue(ae,Le={},Oe=s.current){const et=await t(ae,{sessionId:a,...ae.startsWith("publishing.target.")?{}:{targetId:Oe},...Le});if(!(et!=null&&et.accepted))throw Jf(et,"The server did not confirm this request.");return et.result}async function ye({reconcile:ae=!1,followSelection:Le=!1,target:Oe=s.current}={}){var It,xt,Ut;const et=await ue("publishing.target.list");if(_(()=>d(et)),Le&&(Oe=((It=r.pending)==null?void 0:It.args.targetId)||et.selectedTargetId||"loopback"),De(Oe),(xt=r.pending)!=null&&xt.action.startsWith("publishing.target."))return et;const st=await ue("publishing.list",{},Oe);if(_(()=>y(st)),ae&&r.pending&&r.pending.args.targetId===Oe){const rt=(Ut=st.receipts)==null?void 0:Ut.find(Xe=>Xe.requestId===r.pending.args.requestId);["unknown","running"].includes(rt==null?void 0:rt.state)?(r.pending={...r.pending,receipt:rt},ii(r),_(()=>z(rt.state==="unknown"?"The saved receipt records an unknown outcome. Nothing was replayed.":"The saved receipt is still running. Nothing was replayed."))):rt&&["succeeded","failed"].includes(rt.state)&&(r.pending=null,ii(r),_(()=>rt.state==="failed"?I(to(rt.error)):z("The saved receipt confirms this request succeeded.")))}return st}async function M(ae="publishing.list",Le=!0){if(!(r.busy||j.current)){j.current=!0,k(!0),I("");try{ae==="publishing.list"?await ye({reconcile:Le,followSelection:!0}):(H({action:ae,value:await ue(ae,{siteId:E})}),ae==="publishing.status"&&await ye())}catch(Oe){I(Oe.message)}finally{j.current=!1,k(!1)}}}v.useEffect(()=>{a&&M("publishing.list",!1)},[a]);async function Y(ae,Le,Oe=!1){var xt,Ut;if(r.busy||j.current||!Oe&&r.pending)return;const et=ae==null?void 0:ae.startsWith("publishing.target.");if(!Oe&&!et&&!me){I("Inspect and select this exact target before starting another publishing action.");return}const st=Oe?r.pending:{action:ae,args:{sessionId:a,...et?{}:{targetId:s.current,...(q==null?void 0:q.kind)==="ssh"?{targetRevision:q.revision,serviceId:q.inspection.serviceId}:{},requestId:crypto.randomUUID()},...Le}};if(!st)return;const It=st.action.startsWith("publishing.target.");r.pending=st,r.busy=!0,ii(r),I(""),z("");try{const rt=await t(st.action,st.args);if(!(rt!=null&&rt.accepted))throw Jf(rt,"The connection ended before the outcome was confirmed.");const Xe=rt.result;if(It){if(!Array.isArray(Xe==null?void 0:Xe.targets))throw Error("The server returned no complete target state.");r.pending=null,_(()=>{d(Xe),z(st.action==="publishing.target.save"?"Target saved. No connection was made.":st.action==="publishing.target.inspect"?"Target identity and capabilities inspected.":st.action==="publishing.target.remove"?"Target configuration removed. Existing remote sites were not stopped.":"Publishing target selected.")}),st.action==="publishing.target.save"&&_(()=>{var $e;f((($e=Xe.targets.find(Nt=>Nt.id===st.args.targetId))==null?void 0:$e.revision)??0),st.args.targetId===s.current&&y(null)}),st.action==="publishing.target.select"&&(De(Xe.selectedTargetId),await ye({target:Xe.selectedTargetId}))}else{if(!Xe||(st.action==="publishing.build"?!Xe.id:!["succeeded","failed","unknown","running"].includes(Xe.state)))throw Error("The server returned no complete publishing receipt.");(Xe==null?void 0:Xe.state)==="unknown"||(Xe==null?void 0:Xe.state)==="running"?(r.pending={...st,receipt:Xe},_(()=>I(to(Xe.error||"The outcome is not confirmed. Inspect receipts before continuing.")))):(Xe==null?void 0:Xe.state)==="failed"?(r.pending=null,_(()=>I(to(Xe.error)))):(r.pending=null,_(()=>{z(st.action.slice(11)+" completed."),st.action==="publishing.build"&&(b(Xe.siteId),x(Xe.id),C(""))}));try{await ye({target:st.args.targetId})}catch($e){_(()=>I("The action returned, but the list could not refresh. "+$e.message))}}}catch(rt){const Xe=["succeeded","failed"].includes((xt=rt.receipt)==null?void 0:xt.state);if(IF(rt)||Oe&&st.args.requestId&&!Xe)["unknown","running"].includes((Ut=rt.receipt)==null?void 0:Ut.state)&&(r.pending={...st,receipt:rt.receipt}),_(()=>I(rt.message+" Keep this request unchanged until its outcome is known."));else if(Xe||rt.status>=400&&rt.status<500&&rt.status!==408){r.pending=null,_(()=>{var $e;return(($e=rt.receipt)==null?void 0:$e.state)==="succeeded"?z("The saved receipt confirms this request succeeded."):I(rt.message)});try{if(It){const $e=await ue("publishing.target.list");_(()=>d($e))}else await ye({target:st.args.targetId})}catch{}}else _(()=>I(rt.message+" Keep this request unchanged until its outcome is known."))}finally{r.busy=!1,ii(r)}}function se(){var ae,Le;r.busy||((Le=(ae=r.pending)==null?void 0:ae.receipt)==null?void 0:Le.state)!=="unknown"||(r.pending=null,ii(r),I(""),z("Unknown outcome acknowledged. Inspect the current site status. Any site marked unknown requires an explicit stop or remove action."))}function Fe(ae){b(ae),x(""),C(""),H(null)}function je(ae){f(ae.revision),m(Object.fromEntries(Object.keys(vs).map(Le=>[Le,Le==="targetId"?ae.id:ae[Le]||vs[Le]])))}function oe(ae){ae.preventDefault(),Y("publishing.target.save",{...p,...p.username?{}:{username:void 0},expectedRevision:h})}return a?n.createElement("section",{className:"a-publishing","aria-label":"Managed publishing"},n.createElement("h3",null,"Publishing"),n.createElement("p",null,"Save a built site as an immutable release, preview it, record your review, and explicitly deploy that version."),n.createElement("div",{className:"a-selection-card","aria-label":"Publishing target"},n.createElement("strong",null,(q==null?void 0:q.label)||((Ye=(ze=g==null?void 0:g.target)==null?void 0:ze.host)==null?void 0:Ye.label)||"Local server"),n.createElement("p",null,"Target: ",n.createElement("code",null,l),(u==null?void 0:u.selectedTargetId)!==l&&u&&" · task selection: "+u.selectedTargetId),n.createElement("p",null,"Access: ",Je||(l==="loopback"?"loopback-only":"Not inspected")),u&&!me&&n.createElement("p",null,"Inspect and select this exact target before starting another publishing action."),n.createElement("p",null,((ht=g==null?void 0:g.target)==null?void 0:ht.detail)||"URLs belong to the publishing service host."),n.createElement("p",{className:"a-caption"},"A loopback URL opens only on the service host. No tunnel, service installation, credentials, or public route is created here.")),n.createElement("details",{className:"a-publishing-targets"},n.createElement("summary",null,"Publishing targets for this task"),n.createElement("div",{"aria-label":"Publishing targets"},ne.map(ae=>{var et;const Le=((et=ae.inspection)==null?void 0:et.revision)===ae.revision?ae.inspection:null,Oe=Le==null?void 0:Le.capabilities;return n.createElement("div",{className:"a-selection-card",key:ae.id,"aria-label":"Target "+ae.id},n.createElement("h4",null,ae.label),n.createElement("p",null,n.createElement("code",null,ae.id)," · revision ",ae.revision,u.selectedTargetId===ae.id?u.selectedTargetRevision===ae.revision?" · selected":" · configuration changed; inspect and select again":""),ae.kind==="ssh"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Configured SSH destination: ",ae.username?ae.username+"@":"",ae.hostname),n.createElement("p",null,"Expected bind: ",n.createElement("code",null,ae.expectedBind),". Access policy is verified by inspection of the service."),Le?n.createElement("dl",null,n.createElement("dt",null,"Inspected service"),n.createElement("dd",null,Le.serviceId),n.createElement("dt",null,"Actual bind"),n.createElement("dd",null,Oe==null?void 0:Oe.bind),n.createElement("dt",null,"Access policy"),n.createElement("dd",null,Oe==null?void 0:Oe.accessPolicy),n.createElement("dt",null,"Authentication"),n.createElement("dd",null,Oe==null?void 0:Oe.authentication)):n.createElement("p",null,"Not inspected. Service identity and access policy are unverified.")),n.createElement("div",{className:"a-dialog-actions"},ae.kind==="ssh"&&n.createElement("button",{type:"button",className:"a-soft",disabled:ie,"data-action":"publishing.target.inspect",onClick:()=>Y("publishing.target.inspect",{targetId:ae.id,expectedRevision:ae.revision})},"Inspect target"),n.createElement("button",{type:"button",className:"a-soft",disabled:ie||ae.kind==="loopback"&&u.selectedTargetId===ae.id||ae.kind==="ssh"&&!Le,"data-action":"publishing.target.select",onClick:()=>Y("publishing.target.select",{targetId:ae.id,expectedRevision:ae.revision,...Le?{serviceId:Le.serviceId}:{}})},"Select target"),ae.kind==="ssh"&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-soft",disabled:ie,onClick:()=>je(ae)},"Edit target"),n.createElement("button",{type:"button",className:"a-soft a-danger",disabled:ie||u.selectedTargetId===ae.id,"data-action":"publishing.target.remove",onClick:()=>Y("publishing.target.remove",{targetId:ae.id,expectedRevision:ae.revision})},"Remove target configuration"))))}),n.createElement("h4",null,"Save a target configuration"),n.createElement("p",null,"Use an existing SSH account and running publishing service. Saving these paths does not connect or install anything. Only unused configurations can be removed; configurations with publishing records remain available for control and audit. Removing a configuration does not stop sites on that service."),n.createElement("form",{onSubmit:oe},[["targetId","Target ID"],["label","Target label"],["hostname","SSH hostname"],["username","SSH username (optional)"],["python","Remote Python path"],["socketPath","Remote service socket"],["expectedBind","Expected bind address"]].map(([ae,Le])=>n.createElement(n.Fragment,{key:ae},n.createElement("label",{htmlFor:"publishing-target-"+ae},Le),n.createElement("input",{id:"publishing-target-"+ae,value:p[ae],required:ae!=="username",disabled:ie,onChange:Oe=>{ae==="targetId"&&f(0),m(et=>({...et,[ae]:Oe.target.value}))}}))),n.createElement("button",{className:"a-primary",disabled:ie,"data-action":"publishing.target.save"},"Save target configuration"),n.createElement("button",{type:"button",className:"a-soft",disabled:ie,onClick:()=>{m({...vs}),f(0)}},"Clear target form")))),n.createElement("button",{type:"button",className:"a-soft","data-action":"publishing.list",disabled:Z,onClick:()=>M()},"Inspect publishing"),T&&n.createElement("p",{role:"alert"},T),F&&n.createElement("p",{role:"status"},F),r.pending&&n.createElement("div",{className:"a-selection-card","aria-label":"Unconfirmed publishing request"},n.createElement("strong",null,r.busy?"Request in progress":((bt=r.pending.receipt)==null?void 0:bt.state)==="unknown"?"Recorded unknown outcome":"Request outcome unconfirmed"),n.createElement("p",null,r.pending.action," · target ",n.createElement("code",null,r.pending.args.targetId)," · ",r.pending.args.siteId||r.pending.args.releaseId),r.pending.args.requestId&&n.createElement("code",null,r.pending.args.requestId),n.createElement("p",null,"The exact submitted arguments are retained while this browser page stays open. Inspect publishing to check the saved receipt, or retry this same request. Nothing is retried automatically."),((ft=r.pending.receipt)==null?void 0:ft.state)==="unknown"?n.createElement(n.Fragment,null,n.createElement("p",null,to(r.pending.receipt.error)),n.createElement("button",{type:"button",className:"a-soft",disabled:Z,onClick:se},"Acknowledge unknown outcome"),n.createElement("p",null,"Acknowledgement dismisses this pending request only. It does not repeat or resolve the operation; any site marked unknown requires an explicit stop or remove action.")):n.createElement("button",{type:"button",className:"a-soft",disabled:Z,"data-action":r.pending.action,onClick:()=>Y(null,null,!0)},"Retry exact request")),n.createElement("h4",null,"Sites"),g&&!P.length&&n.createElement("p",null,"No sites yet. Capture a release below to get started."),n.createElement("div",{className:"a-publishing-sites"},P.map(ae=>n.createElement("button",{type:"button",className:"a-selection-card",key:ae.id,disabled:_e,"aria-pressed":E===ae.id,onClick:()=>Fe(ae.id)},n.createElement("strong",null,ae.id),n.createElement("span",null,ae.status," · revision ",ae.revision)))),n.createElement("h4",null,"Capture built output"),n.createElement("p",null,"Build with your existing project tools first, then enter its output folder relative to this task’s execution folder. Capturing preserves the current files as a new release."),n.createElement("form",{onSubmit:ae=>{ae.preventDefault(),Y("publishing.build",{siteId:E.trim(),sourcePath:S.trim()})}},n.createElement("label",{htmlFor:"publishing-site"},"Site ID"),n.createElement("input",{id:"publishing-site",value:E,disabled:_e,maxLength:63,pattern:"[a-z0-9][a-z0-9-]{0,62}",onChange:ae=>Fe(ae.target.value),placeholder:"my-site"}),n.createElement("label",{htmlFor:"publishing-source"},"Built output folder"),n.createElement("input",{id:"publishing-source",value:S,disabled:_e,onChange:ae=>w(ae.target.value),placeholder:"dist"}),n.createElement("button",{className:"a-primary","data-action":"publishing.build",disabled:_e||!E.trim()||!S.trim()},"Capture release")),E&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Saved releases for ",E),n.createElement("label",{htmlFor:"publishing-release"},"Release to preview, review, or deploy"),n.createElement("select",{id:"publishing-release",value:(D==null?void 0:D.id)||"",disabled:_e,onChange:ae=>{x(ae.target.value),C("")}},n.createElement("option",{value:""},"Choose a saved release"),ke.map(ae=>n.createElement("option",{key:ae.id,value:ae.id},ae.createdAt," · ",ae.id)))),D&&n.createElement("div",{className:"a-selection-card","aria-label":"Selected release"},n.createElement("h4",null,"Exact release"),n.createElement("dl",null,n.createElement("dt",null,"Release ID"),n.createElement("dd",null,D.id),n.createElement("dt",null,"Manifest digest"),n.createElement("dd",null,D.manifestDigest),n.createElement("dt",null,"Files"),n.createElement("dd",null,((Ce=D.files)==null?void 0:Ce.length)||0," · ",D.totalBytes||0," bytes"),n.createElement("dt",null,"Preview"),n.createElement("dd",null,D.previewStatus||"none"),n.createElement("dt",null,"Review"),n.createElement("dd",null,D.review?`Reviewed: ${D.review.note}`:"Not reviewed")),n.createElement("details",null,n.createElement("summary",null,"Release files"),n.createElement("ul",null,(gt=D.files)==null?void 0:gt.map(ae=>n.createElement("li",{key:ae.path},n.createElement("strong",null,ae.path)," · ",ae.size," bytes",n.createElement("br",null),n.createElement("code",null,ae.sha256))))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:_e,"data-action":"publishing.preview",onClick:()=>Y("publishing.preview",{releaseId:D.id})},"Start preview"),D.previewStatus==="running"&&gs(D.previewUrl)&&n.createElement("a",{href:gs(D.previewUrl),target:"_blank",rel:"noopener noreferrer"},"Open exact release preview")),n.createElement("form",{onSubmit:ae=>{ae.preventDefault(),Y("publishing.review",{releaseId:D.id,note:A.trim()})}},n.createElement("label",{htmlFor:"publishing-note"},"Review note for this exact release"),n.createElement("textarea",{id:"publishing-note",value:A,disabled:_e,maxLength:4e3,onChange:ae=>C(ae.target.value)}),n.createElement("button",{className:"a-soft","data-action":"publishing.review",disabled:_e||!A.trim()},"Record review")),n.createElement("p",null,"Deploy release ",n.createElement("code",null,D.id)," to ",n.createElement("strong",null,E)," on target ",n.createElement("strong",null,l)," with ",n.createElement("strong",null,((Et=g==null?void 0:g.target)==null?void 0:Et.accessPolicy)||((at=(vt=q==null?void 0:q.inspection)==null?void 0:vt.capabilities)==null?void 0:at.accessPolicy)||"unverified")," access."),n.createElement("button",{type:"button",className:"a-primary",disabled:_e||!D.review||(W==null?void 0:W.status)==="unknown"||!Je,"data-action":"publishing.deploy",onClick:()=>Y("publishing.deploy",{siteId:E,releaseId:D.id,expectedRevision:(W==null?void 0:W.revision)??0})},"Deploy reviewed release")),W&&n.createElement("div",{className:"a-selection-card","aria-label":"Site status"},n.createElement("h4",null,W.id),n.createElement("dl",null,n.createElement("dt",null,"Status"),n.createElement("dd",null,W.status),n.createElement("dt",null,"Revision"),n.createElement("dd",null,W.revision),n.createElement("dt",null,"Access policy"),n.createElement("dd",null,W.accessPolicy),n.createElement("dt",null,"Deployed release"),n.createElement("dd",null,W.releaseId||"None"),n.createElement("dt",null,"Previous release"),n.createElement("dd",null,W.previousReleaseId||"None")),gs(W.url)&&n.createElement("p",null,n.createElement("a",{href:gs(W.url),target:"_blank",rel:"noopener noreferrer"},"Open deployed site"),n.createElement("br",null),n.createElement("code",null,W.url)),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:Z,"data-action":"publishing.status",onClick:()=>M("publishing.status")},"Check site status"),n.createElement("button",{type:"button",className:"a-soft",disabled:Z,"data-action":"publishing.logs",onClick:()=>M("publishing.logs")},"Read site logs")),W.previousReleaseId&&n.createElement(n.Fragment,null,n.createElement("p",null,"Rollback restores release ",n.createElement("code",null,W.previousReleaseId),"."),n.createElement("button",{type:"button",className:"a-soft",disabled:_e,"data-action":"publishing.rollback",onClick:()=>Y("publishing.rollback",{siteId:E,releaseId:W.previousReleaseId,expectedRevision:W.revision})},"Roll back to previous release")),n.createElement("p",null,"Stopping or removing this site preserves its saved releases and receipts."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:_e||["stopped","removed"].includes(W.status),"data-action":"publishing.stop",onClick:()=>Y("publishing.stop",{siteId:E,expectedRevision:W.revision})},"Stop site"),n.createElement("button",{type:"button",className:"a-soft a-danger",disabled:_e||W.status==="removed","data-action":"publishing.remove",onClick:()=>Y("publishing.remove",{siteId:E,expectedRevision:W.revision})},"Remove site"))),U&&n.createElement("div",{"aria-label":"Publishing inspection"},n.createElement("h4",null,U.action==="publishing.logs"?"Site logs":"Current site status"),n.createElement("pre",{className:"a-state-view"},JSON.stringify(U.value,null,2))),n.createElement("details",null,n.createElement("summary",null,"Durable publishing receipts (",((X=g==null?void 0:g.receipts)==null?void 0:X.length)||0,")"),n.createElement("div",{"aria-label":"Publishing receipts"},(Re=g==null?void 0:g.receipts)==null?void 0:Re.map(ae=>n.createElement("div",{className:"a-selection-card",key:ae.id},n.createElement("strong",null,ae.action," · ",ae.state),n.createElement("p",null,ae.siteId," · ",ae.createdAt),n.createElement("p",null,"Request: ",n.createElement("code",null,ae.requestId)),ae.releaseId&&n.createElement("p",null,"Release: ",n.createElement("code",null,ae.releaseId)),ae.error&&n.createElement("p",null,to(ae.error))))))):n.createElement("p",null,"Choose a conversation to manage its published sites.")}const _F=[{id:"gpt-live-1",name:"GPT Live 1",description:"A natural conversation: listen and speak at the same time.",source:"https://developers.openai.com/api/docs/guides/live-conversations",voices:[{id:"marin",name:"Marin",description:"The default GPT Live voice."},{id:"cedar",name:"Cedar",description:"Built-in OpenAI voice."},{id:"alloy",name:"Alloy",description:"Built-in OpenAI voice."},{id:"ash",name:"Ash",description:"Built-in OpenAI voice."},{id:"ballad",name:"Ballad",description:"Built-in OpenAI voice."},{id:"coral",name:"Coral",description:"Built-in OpenAI voice."},{id:"echo",name:"Echo",description:"Built-in OpenAI voice."},{id:"sage",name:"Sage",description:"Built-in OpenAI voice."},{id:"shimmer",name:"Shimmer",description:"Built-in OpenAI voice."},{id:"verse",name:"Verse",description:"Built-in OpenAI voice."},{id:"quartz",name:"Quartz",description:"English · Australian influence · feminine"},{id:"ripple",name:"Ripple",description:"English · Australian influence · masculine"},{id:"vesper",name:"Vesper",description:"English · British influence · masculine"},{id:"willow",name:"Willow",description:"English · Irish influence · feminine"},{id:"stone",name:"Stone",description:"English · Irish influence · masculine"},{id:"gleam",name:"Gleam",description:"English · North American influence · feminine"},{id:"meridian",name:"Meridian",description:"English · North American influence · masculine"},{id:"bossa",name:"Bossa",description:"Portuguese · Brazilian influence · feminine"},{id:"tempo",name:"Tempo",description:"Portuguese · Brazilian influence · masculine"},{id:"beacon",name:"Beacon",description:"English · Filipino influence · masculine"},{id:"delta",name:"Delta",description:"English · Southern U.S. influence · feminine"},{id:"cinder",name:"Cinder",description:"English · Southern U.S. influence · masculine"}],reference:"https://developers.openai.com/api/reference/resources/live/primary-websocket"},{id:"gpt-realtime-2.1",name:"GPT Realtime 2.1",description:"A responsive voice conversation with turn detection.",source:"https://developers.openai.com/api/docs/guides/realtime-conversations",voices:[{id:"marin",name:"Marin",description:"Recommended for best quality."},{id:"cedar",name:"Cedar",description:"Recommended for best quality."},{id:"alloy",name:"Alloy",description:"OpenAI Realtime voice."},{id:"ash",name:"Ash",description:"OpenAI Realtime voice."},{id:"ballad",name:"Ballad",description:"OpenAI Realtime voice."},{id:"coral",name:"Coral",description:"OpenAI Realtime voice."},{id:"echo",name:"Echo",description:"OpenAI Realtime voice."},{id:"sage",name:"Sage",description:"OpenAI Realtime voice."},{id:"shimmer",name:"Shimmer",description:"OpenAI Realtime voice."},{id:"verse",name:"Verse",description:"OpenAI Realtime voice."}]}],bs={models:_F};function PF({state:e,act:t}){const a=e.settings||{},r=bs.models.find(_=>_.id===a.preferredVoice)||bs.models[0],o=r.voices.find(_=>_.id===a.voiceName)||r.voices[0],i=e.voiceConfiguration,[s,l]=n.useState(""),[c,u]=n.useState(""),[d,p]=n.useState(""),[m,h]=n.useState(!1),[f,g]=n.useState(""),[y,E]=n.useState(!1),[b,S]=n.useState(null),[w,N]=n.useState(""),x=n.useRef(null);n.useLayoutEffect(()=>{var _,P;y&&((_=x.current)==null||_.focus(),(P=x.current)==null||P.scrollIntoView({block:"start"}))},[y]);const A=n.useRef(null),C=n.useRef(null),O=n.useRef(!0),k=n.useRef(0);n.useEffect(()=>(O.current=!0,t("voice.configuration").catch(_=>l(_.message)),()=>{var _;O.current=!1,k.current++,(_=C.current)==null||_.pause(),A.current&&URL.revokeObjectURL(A.current)}),[]);const T=()=>{var _;(_=C.current)==null||_.pause(),S(null),A.current&&(URL.revokeObjectURL(A.current),A.current=null)},I=d||((i==null?void 0:i.source)==="private"?"private":i!=null&&i.environmentAvailable?"environment":"private"),F=async _=>{l("");try{const P=await t("settings.update",{patch:_});if((P==null?void 0:P.accepted)===!1)throw Error(P.error||"Could not save voice settings.")}catch(P){l(P.message)}};async function z(){h(!0),l("");try{const _=await t("voice.configure",{source:I,...I==="private"?{apiKey:c}:{}});if((_==null?void 0:_.accepted)===!1)throw Error(_.error||"Could not save voice key.");u("")}catch(_){l(_.message)}finally{h(!1)}}async function U(_){var G;if(w)return;const P=++k.current;N(_.id),l(""),T();try{const W=await t("voice.preview",{model:r.id,voice:_.id});if((W==null?void 0:W.accepted)===!1||!((G=W==null?void 0:W.result)!=null&&G.audio))throw Error((W==null?void 0:W.error)||"The sample was unavailable. Try again.");if(O.current&&P===k.current){const D=Uint8Array.from(atob(W.result.audio),ne=>ne.charCodeAt(0));A.current=URL.createObjectURL(new Blob([D],{type:W.result.mimeType})),S({...W.result,audio:void 0,url:A.current,name:_.name})}}catch(W){O.current&&P===k.current&&l(W.message)}finally{O.current&&P===k.current&&N("")}}const H=_=>{T(),F({voiceName:_.id}),E(!1)},te=r.voices.filter(_=>(_.name+" "+_.description).toLowerCase().includes(f.toLowerCase())),j=n.createElement("div",{className:"a-voice-key-form"},n.createElement("p",null,"Voice uses an OpenAI API key, separate from a ChatGPT subscription."),(i==null?void 0:i.environmentAvailable)&&n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"radio",name:"voice-key-source",checked:I==="environment",onChange:()=>p("environment")}),"Use the key on this host (OPENAI_API_KEY)"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"radio",name:"voice-key-source",checked:I==="private"||!(i!=null&&i.environmentAvailable),onChange:()=>p("private")}),"Use a separate key"),(I==="private"||!(i!=null&&i.environmentAvailable))&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"voice-api-key"},"OpenAI API key"),n.createElement("input",{id:"voice-api-key",type:"password",autoComplete:"off",value:c,onChange:_=>{p("private"),u(_.target.value)},placeholder:i!=null&&i.privateKeyAvailable?"Saved key · enter a new key to replace it":""})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"voice.configure",disabled:m||(I==="private"||!(i!=null&&i.environmentAvailable))&&!c.trim()&&!(i!=null&&i.privateKeyAvailable),onClick:z},m?"Saving…":"Save voice connection")));return n.createElement("div",{className:"a-voice-settings"},n.createElement("section",{className:"a-voice-connection","aria-label":"Voice connection"},n.createElement("strong",null,i!=null&&i.available?"Voice key configured":i?"Connect voice":"Checking voice connection…"),i!=null&&i.available?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},i.source==="private"?"Using your separate voice API key.":"Using the OpenAI API key on this host."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Change voice connection"),j)):j),n.createElement("label",{htmlFor:"preferred-voice"},"Voice model"),n.createElement("select",{id:"preferred-voice","data-action":"settings.update",disabled:!!w,value:r.id,onChange:_=>{const P=bs.models.find(G=>G.id===_.target.value);T(),g(""),F({preferredVoice:P.id,voiceName:P.voices.some(G=>G.id===o.id)?o.id:"marin"})}},bs.models.map(_=>n.createElement("option",{key:_.id,value:_.id},_.name))),n.createElement("p",{className:"a-caption"},r.description),n.createElement("h4",{className:"a-voice-label"},"Speaking voice"),n.createElement("div",{className:"a-voice-current"},n.createElement("div",null,n.createElement("strong",null,o.name),n.createElement("p",null,o.description)),n.createElement("button",{className:"a-soft",disabled:!!w,"aria-expanded":y,onClick:()=>E(!y)},y?"Close voice list":"Choose a voice"),n.createElement("button",{className:"a-soft","data-action":"voice.preview",disabled:!(i!=null&&i.available)||!!w||e.voicePreviewBusy,onClick:()=>U(o)},w===o.id?"Preparing sample…":"Preview voice")),y&&n.createElement("section",{className:"a-voice-picker","aria-label":"Choose a speaking voice"},n.createElement("h4",{ref:x,tabIndex:-1},"Voices for ",r.name),n.createElement("label",{htmlFor:"voice-search"},"Find a voice"),n.createElement("input",{id:"voice-search",type:"search",placeholder:"Search names or descriptions",value:f,onChange:_=>g(_.target.value)}),n.createElement("div",{role:"radiogroup","aria-label":"Speaking voice"},te.map(_=>n.createElement("div",{key:_.id,className:"a-voice-option","data-selected":_.id===o.id},n.createElement("label",null,n.createElement("input",{type:"radio",name:"speaking-voice",checked:_.id===o.id,disabled:!!w,"data-action":"settings.update",onChange:()=>H(_)}),n.createElement("span",null,n.createElement("strong",null,_.name),n.createElement("small",null,_.description))),n.createElement("button",{className:"a-soft","aria-label":"Preview "+_.name,disabled:!(i!=null&&i.available)||!!w||e.voicePreviewBusy,"data-action":"voice.preview",onClick:()=>U(_)},w===_.id?"Preparing…":"Preview"),(b==null?void 0:b.voice)===_.id&&n.createElement("audio",{ref:C,controls:!0,autoPlay:!0,"aria-label":b.name+" sample",src:b.url,onError:()=>l("This browser could not play the sample. Try the preview again.")})))),!te.length&&n.createElement("p",null,"No voices match your search.")),b&&!y&&n.createElement("div",{className:"a-voice-sample"},n.createElement("p",null,b.name," · ",r.name),n.createElement("audio",{ref:C,controls:!0,autoPlay:!0,src:b.url,onError:()=>l("This browser could not play the sample. Try the preview again.")},"Your browser does not support audio playback.")),n.createElement("p",{className:"a-caption"},"Previews use a short AI-generated sample and your OpenAI API usage. Your microphone and conversations are not used."),r.id==="gpt-realtime-2.1"&&n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:a.voiceInterruptions!==!1,"data-action":"settings.update",onChange:_=>F({voiceInterruptions:_.target.checked})}),"Let me interrupt by speaking"),n.createElement("p",{className:"a-caption"},"Changes apply to your next call. Your browser manages microphone access."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"About these voices"),n.createElement("div",null,n.createElement("p",null,"Available voices depend on the model. Regional descriptions come from OpenAI; voices can speak other languages too. OpenAI does not describe the tone of every voice. Preview those voices to compare how they sound."),n.createElement("a",{href:r.source,target:"_blank",rel:"noreferrer"},"Voice guide from OpenAI"))),s&&n.createElement("p",{role:"alert",className:"a-danger"},s))}function OF(){return n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("a",{href:"/setup/terminal",target:"_blank",rel:"noopener noreferrer"},"Install the Terminal app on this computer")," to connect to this Unified service. The setup page handles the client and its saved connection."),n.createElement("p",null,"In Edge or Chrome, choose the install icon in the address bar or Install this site as an app in the browser menu. In Safari on Mac, use File → Add to Dock. On iPhone or iPad, use Share → Add to Home Screen."),n.createElement("p",null,"Keep the Python service running on the host computer. Installation gives this interface its own window; the service still runs your conversations and tools."),n.createElement("p",{className:"a-caption"},"Use localhost on this computer, or a trusted HTTPS address on other devices. Your saved chats and canvas artifacts stay on the host."))}const MF={panel:"settings",settingsSection:"index",settingsExpanded:[]};function Ou(e,t){const a={...Ww(e,t)};return["ai-connections","overview"].includes(e)&&(a.aiConnectionEditor={step:"list"}),e==="diagnostics"&&(a.diagnosticsDraft={destinationId:null}),e==="providers"&&(a.providerEditor={detailOpen:!1,orderOpen:!1}),e==="routing"&&(a.routingEditor={detailOpen:!1,candidateOpen:!1,orderOpen:!1}),e==="app-bundles"&&(a.bundleManager={detailOpen:!1,orderOpen:!1}),e==="loaded-modules"&&(a.moduleEditor={detailOpen:!1}),["smart-tools","tool-connections"].includes(e)&&(a.smartToolsEditor={page:"home",catalogDetail:!1}),a}function zF(e,t){const a={...t};for(const r of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])r in a&&(a[r]={...e[r],...a[r]});return a}function LF(e={},t={},a){var u,d,p,m,h,f,g,y,E,b;const{page:r,section:o}=Vw(e,a),i=[{key:"index",title:"Settings",navigation:MF}];if(e.settingsSection==="index"&&e.panel!=="appearance")return i;const s=Ou(r,a),l=Is(r,a);l&&i.push({key:l,title:o.title,navigation:Ou(l,a)}),i.push({key:r,title:bp(r,a),navigation:s});const c=(S,w,N,x)=>i.push({key:S,title:w,navigation:{...s,[N]:{...s[N],...x}}});if(["ai-connections","overview"].includes(r)){const S=e.aiConnectionEditor||{},w=S.step||"list";w!=="list"&&c("ai/"+w,w==="services"?"Connect AI":w==="model"?"Choose model":"AI connection","aiConnectionEditor",{step:w})}else if(r==="diagnostics"){const S=e.diagnosticsDraft||{},w=S.config||((u=t.diagnostics)==null?void 0:u.config),N=(d=w==null?void 0:w.destinations)==null?void 0:d.find(x=>x.id===S.destinationId);N&&c("diagnostics/destination",N.name||"Destination","diagnosticsDraft",{destinationId:N.id})}else if(r==="providers"){const S=e.providerEditor||{};S.order&&S.orderOpen!==!1?c("providers/order","Preference order","providerEditor",{orderOpen:!0}):S.detailOpen&&c("providers/detail",S.id||"Add connection","providerEditor",{detailOpen:!0})}else if(r==="routing"){const S=e.routingEditor||{},w=S.role||"general";(S.detailOpen||S.order&&S.orderOpen!==!1)&&(c("routing/role/"+w,w,"routingEditor",{role:w,detailOpen:!0}),S.order&&S.orderOpen!==!1?c("routing/order/"+w,"Preference order","routingEditor",{role:w,detailOpen:!0,orderOpen:!0}):S.candidateOpen&&c("routing/choice/"+w,"Choice "+((S.candidate||0)+1),"routingEditor",{role:w,detailOpen:!0,candidateOpen:!0}))}else if(r==="app-bundles"){const S=e.bundleManager||{},w=Array.isArray(t.bundles)?t.bundles:((p=t.bundles)==null?void 0:p.entries)||[];S.order&&S.orderOpen!==!1?c("bundles/order","Composition order","bundleManager",{orderOpen:!0}):S.detailOpen&&c("bundles/detail",((m=w.find(N=>N.id===S.entryId))==null?void 0:m.name)||"Bundle","bundleManager",{detailOpen:!0})}else if(r==="loaded-modules"){const S=e.moduleEditor||{};S.detailOpen&&c("modules/detail",(()=>{var w;try{return(w=Sp(JSON.parse(S.text)).find(N=>N.key===S.selectedKey))==null?void 0:w.id}catch{return null}})()||"Module","moduleEditor",{detailOpen:!0})}else if(["smart-tools","tool-connections"].includes(r)){const S=e.smartToolsEditor||{},w=S.page||"home";w==="catalog"?(c("tools/catalog","Catalog","smartToolsEditor",{page:"catalog"}),S.catalogDetail&&c("tools/catalog/detail",((g=(f=(h=t.smartTools)==null?void 0:h.catalog)==null?void 0:f.find(N=>N.id===S.catalogId))==null?void 0:g.name)||"Tool details","smartToolsEditor",{page:"catalog",catalogDetail:!0})):w!=="home"&&(w==="source"&&S.returnPage==="catalog"&&c("tools/catalog","Catalog","smartToolsEditor",{page:"catalog"}),w==="tool"&&c("tools/server",((b=(E=(y=t.smartTools)==null?void 0:y.servers)==null?void 0:E.find(N=>N.id===S.serverId))==null?void 0:b.name)||"Connection","smartToolsEditor",{page:"server"}),c("tools/"+w,{source:"Install from source",connection:"Connection settings",server:"Connection",tool:S.toolName||"Tool"}[w]||"Smart Tools","smartToolsEditor",{page:w}))}return i}const DF={ai:$c,privacy:wi,workspaces:qr,overview:tl,appearance:Bc,voice:zu,notifications:lg,models:$c,bundles:qr,"smart-tools":ox,updates:wa,diagnostics:mo,history:wi,advanced:Hc};function FF({state:e,session:t,act:a,dispatch:r,open:o,close:i=()=>a("view.update",{patch:{panel:null}}),navigationRef:s,appearance:l}){var U,H,te,j;const c=Qu(),u=(((U=c==null?void 0:c.data)==null?void 0:U.resolvedInstances)||[]).filter(_=>_.slot==="settings.section"),d=Zi.map(_=>_.id==="advanced"?{..._,pages:[..._.pages,...u.map(P=>{var G,W;return["shell:"+P.id,((W=(G=c.data.packages[P.package])==null?void 0:G.manifest)==null?void 0:W.label)||P.id]})]}:_),{page:p,section:m}=Vw(e.view,d),h=v.useRef(null),f=v.useRef(null),g=v.useRef(null),[y,E]=v.useState(null),b=KL(g),S=LF(e.view,e,d),w=S.at(-1),N=b&&w.key==="index",x=b&&S.length>(Is(p,d)?3:2);YL(g,b);const A=cD(),C=GL({compact:b,trail:S,view:e.view||{},act:a,close:i,body:f,navigationRef:s,confirmClose:A.confirmClose,hasUnsaved:A.hasUnsaved}),O=(_,P=!1)=>{C.rememberScroll(),a("view.update",{patch:{...zF(e.view||{},Ou(_,d)),...P?{settingsRootVisit:crypto.randomUUID()}:{}}})};v.useLayoutEffect(()=>{var _,P;if((_=e.view)!=null&&_.settingsRootVisit){f.current&&(f.current.scrollTop=0);for(const G of((P=g.current)==null?void 0:P.querySelectorAll(".a-settings-page-content:not([hidden]) details[open]"))||[])G.open=!1}},[(H=e.view)==null?void 0:H.settingsRootVisit]),v.useEffect(()=>{var _;(_=h.current)==null||_.focus({preventScroll:!0}),!b&&f.current&&(f.current.scrollTop=0)},[p,w.key,b]);const k={state:e,session:t,act:a,navigate:O},T=v.useRef(new Map),F=(_=>["ai-connections","overview"].includes(_)?"ai-connections":["appearance","custom-appearance"].includes(_)?"appearance":["smart-tools","tool-connections"].includes(_)?"smart-tools":["app-bundles","add-bundles","loaded-modules","share-bundle","registries"].includes(_)?"bundles":["notifications","diagnostics","history","permissions","automation","repair","reset"].includes(_)?"maintenance":_)(p);N||T.current.set(F,p);function z(_){var G,W;let P;return["overview","ai-connections"].includes(_)?P=n.createElement(fD,{...k,act:r||a,navigate:O}):_==="privacy"?P=n.createElement(sD,{state:e,navigate:O}):_==="advanced"?P=n.createElement(lD,{...k,sections:d,navigate:O}):_==="appearance"?P=n.createElement(Ur,{name:"settings.appearance"},n.isValidElement(l)?n.cloneElement(l,{simple:!0,onAdvanced:()=>O("custom-appearance")}):l):_==="custom-appearance"?P=n.isValidElement(l)?n.cloneElement(l,{advancedOnly:!0}):l:_.startsWith("shell:")?P=n.createElement(Ur,{name:"settings.section",instanceId:_.slice(6)}):_==="workspaces"?P=n.createElement(zx,{...k}):_==="voice"?P=n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Choose how your conversations sound."),n.createElement(PF,{...k})):_==="providers"?P=n.createElement(bD,{...k}):_==="routing"?P=n.createElement(gD,{...k}):_==="defaults"?P=n.createElement(RD,{...k}):["app-bundles","add-bundles","loaded-modules","share-bundle","registries"].includes(_)?P=n.createElement(xD,{...k}):["smart-tools","tool-connections"].includes(_)?P=n.createElement(DD,{...k,simple:_==="smart-tools",navigateSettings:O}):_==="updates"?P=n.createElement(QD,{...k}):_==="ready-conversations"?P=(G=e.runtime)!=null&&G.retention?n.createElement(XD,{...k}):n.createElement("p",null,"This host does not expose conversation readiness settings."):_==="install-app"?P=n.createElement(OF,null):_==="runtime"?P=n.createElement(lk,{...k}):_==="desktop"?P=n.createElement(wF,{...k}):_==="recall"?P=n.createElement(CF,{key:(t==null?void 0:t.id)||"none",...k}):_==="outputs"?P=n.createElement(RF,{key:t==null?void 0:t.id,...k}):_==="publishing"?P=n.createElement(AF,{key:t==null?void 0:t.id,...k,act:r||a}):_==="conversation"?P=n.createElement(n.Fragment,null,t?n.createElement(n.Fragment,null,n.createElement(uk,{key:t.id,session:t,act:a}),n.createElement(dk,{...k}),((W=t.location)==null?void 0:W.kind)==="managed"&&ho(t)&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft a-danger","data-action":"view.update",onClick:()=>o("delete-session")},"Delete chat")),n.createElement("h3",null,"Conversation bundle")):n.createElement("p",null,"Choose a bundle to start a conversation."),n.createElement(tk,{...k,working:["working","starting","running","stopping","busy"].includes(t==null?void 0:t.status)})):P=n.createElement($D,{...k}),_==="conversation"&&t&&(P=n.createElement(n.Fragment,null,P,n.createElement(Dx,{key:"library-"+t.id,...k}),n.createElement(Fx,{key:"sharing-"+t.id,...k}))),P}return n.createElement(uD,{value:A.context},n.createElement("div",{ref:g,className:"a-settings-experience a-settings-everyday","data-part":"settings-experience","data-settings-page":p,"data-compact":b,"data-settings-index":N,"data-settings-detail":x,"data-settings-route":w.key},n.createElement("header",{className:"a-settings-mobile-head"},N?n.createElement("span",null):n.createElement("button",{type:"button",className:"a-link","data-action":"view.update","aria-label":"Back to "+(((te=S.at(-2))==null?void 0:te.title)||"Settings"),onClick:C.back},n.createElement(Sa,null),n.createElement("span",null,S.length>2?"Back":"Settings")),n.createElement("h3",{ref:b?h:void 0,tabIndex:-1},w.title),n.createElement("button",{type:"button",className:"a-icon","data-action":"view.update","aria-label":"Close settings",onClick:C.dismiss},n.createElement(nn,null))),n.createElement("nav",{className:"a-settings-sidebar","aria-label":"Settings sections"},d.map((_,P)=>{var W;const G=DF[_.id]||qr;return n.createElement(n.Fragment,{key:_.id},_.group&&_.group!==((W=d[P-1])==null?void 0:W.group)&&n.createElement("div",{className:"a-settings-category"},_.group),n.createElement("button",{type:"button","data-action":"view.update","data-settings-section":_.id,"aria-current":_.id===m.id?"page":void 0,onClick:()=>O(_.pages[0][0],!0)},n.createElement(G,{"aria-hidden":"true"}),n.createElement("span",null,_.title),n.createElement(Da,{count:rD(e,_)})))})),n.createElement("div",{ref:f,onScroll:C.rememberScroll,className:"a-settings-content",role:"region","aria-label":"Settings content"},n.createElement("header",{className:"a-settings-page-heading"},n.createElement("div",null,n.createElement("h3",{ref:b?void 0:h,tabIndex:-1},bp(p,d))),t&&["loaded-modules","conversation","runtime"].includes(p)&&n.createElement("span",{className:"a-settings-conversation"},n.createElement(Qk,{"aria-hidden":"true"}),t.title)),Is(p,d)&&n.createElement("button",{type:"button",className:"a-link a-settings-breadcrumb","data-action":"view.update",onClick:()=>O(Is(p,d))},n.createElement(Sa,null),"Back to ",m.title),p!=="updates"&&n.createElement(zs,{state:e,act:a,page:p}),A.count>0&&n.createElement("p",{className:"a-alert",role:"status"},"You have unsaved connection changes. They are kept while Settings stays open."),((j=e.management)==null?void 0:j.error)&&p!=="add-bundles"&&n.createElement("div",{className:"a-alert",role:"alert"},e.management.error),n.createElement(n.Fragment,null,[...T.current].map(([_,P])=>n.createElement(Ju.Provider,{key:_,value:P},n.createElement(Kr.Provider,{value:{compact:b,active:_===F&&!N,footer:y}},n.createElement("div",{className:"a-settings-page-content",hidden:_!==F},z(P))))))),n.createElement("div",{ref:E,className:"a-settings-mobile-actions"}),A.dialog))}const pk="amplifier.messageOutbox.v1";function qF(e){try{return JSON.parse((e==null?void 0:e.getItem(pk))||"[]").filter(t=>t&&typeof t.id=="string"&&typeof t.commandId=="string"&&(t.sessionId===null||typeof t.sessionId=="string")&&typeof t.text=="string"&&Array.isArray(t.attachmentIds)&&t.attachmentIds.every(a=>typeof a=="string")&&["sending","failed","unknown"].includes(t.status)).map(t=>({...t,status:t.status==="sending"?"unknown":t.status}))}catch{return[]}}function UF(e,t,a){const r=t.filter(i=>i.sessionId===(a??null));return[...e.map(i=>{var l,c;const s=r.find(u=>u.commandId===i.inputId);return s&&((l=i.delivery)==null?void 0:l.status)!=="accepted"?{...i,localDelivery:{...s,...((c=i.delivery)==null?void 0:c.status)==="failed"?{status:"failed"}:{}}}:i}),...r.filter(i=>!e.some(s=>s.inputId===i.commandId)).map(i=>({id:i.id,inputId:i.commandId,role:"user",text:i.text,via:i.via,createdAt:i.createdAt,attachments:i.attachments,replyTo:i.replyTo,localDelivery:i}))]}function jF(){const[e,t]=v.useState(()=>{try{return qF(sessionStorage)}catch{return[]}}),a=v.useRef(e),[r,o]=v.useState(!1),i=v.useCallback((s,l)=>{const c=a.current,u=c.some(p=>p.id===s);if(!u&&l!==null&&!l.commandId)return;const d=l===null?c.filter(p=>p.id!==s):u?c.map(p=>p.id===s?{...p,...l}:p):[...c,{id:s,...l}];a.current=d,t(d);try{sessionStorage.setItem(pk,JSON.stringify(d)),o(!1)}catch{o(!0)}return d.find(p=>p.id===s)},[]);return{entries:e,current:a,update:i,storageError:r}}async function Ll(e,t=St,a){let r=0,o="";do{const i=await t("/api/conversation/detail?"+new URLSearchParams({...e,offset:r}),{signal:a});o+=i.value,r=i.nextOffset}while(r!==null);return o}function Oi({text:e,reference:t,markdown:a=!1,automatic:r=!1,writingContext:o,fileContext:i}){const[s,l]=v.useState(null),[c,u]=v.useState(!1),[d,p]=v.useState(""),[m,h]=v.useState(!1),f=v.useRef(null),g=v.useRef(null),y=t?JSON.stringify(t):null,E=v.useRef(y);E.current=y;const b=(s==null?void 0:s.key)===y?s.value:null;v.useEffect(()=>(l(null),p(""),u(!1),()=>{var w;return(w=g.current)==null?void 0:w.abort()}),[y]),v.useEffect(()=>{if(!r||!t)return;if(!globalThis.IntersectionObserver){h(!0);return}const w=new IntersectionObserver(N=>{N.some(x=>x.isIntersecting)&&(h(!0),w.disconnect())},{rootMargin:"400px"});return f.current&&w.observe(f.current),()=>w.disconnect()},[r,y]);async function S(){var x;const w=y,N=new AbortController;(x=g.current)==null||x.abort(),g.current=N,u(!0),p("");try{const A=await Ll(t,St,N.signal);!N.signal.aborted&&E.current===w&&l({key:w,value:A})}catch(A){!N.signal.aborted&&E.current===w&&p(A.message)}finally{!N.signal.aborted&&E.current===w&&u(!1)}}return v.useEffect(()=>{r&&m&&t&&S()},[r,m,y]),n.createElement("div",{className:"a-detail-text",ref:f},a?n.createElement(ml,{text:b??e,writingContext:o,fileContext:i}):n.createElement("p",null,b??e),t&&b===null&&(r&&!d?n.createElement("span",{className:"a-caption",role:"status"},c?"Loading complete response…":"Complete response loads when visible."):n.createElement("button",{type:"button",className:"a-link",disabled:c,onClick:S},c?"Loading full text…":d?"Retry loading full text":"Show full text")),d&&n.createElement("p",{role:"alert"},d))}const Rr=e=>[...new Map(e.map(t=>[t.id,t])).values()];function $F(e,t){var g,y,E,b,S,w,N;const[a,r]=v.useState(null),[o,i]=v.useState(""),[s,l]=v.useState(""),c=v.useRef(e==null?void 0:e.id);c.current=e==null?void 0:e.id;const u=v.useRef((g=e==null?void 0:e.messageWindow)==null?void 0:g.total);v.useEffect(()=>{r(null),l(""),i("")},[e==null?void 0:e.id,e==null?void 0:e.sharedHistoryOffset]),v.useEffect(()=>{var x,A;((x=e==null?void 0:e.messageWindow)==null?void 0:x.total){var A;return{...x,...(A=e.messageAnnotations)==null?void 0:A[x.id]}})},m=e&&d?{...e,messages:Rr([...d.messages,...e.messages]).map(x=>{var A;return{...x,...(A=e.messageAnnotations)==null?void 0:A[x.id]}}),sharedHistoryUserTurnOffset:d.userOffset??e.sharedHistoryUserTurnOffset,messageWindow:{...e.messageWindow,...d.messages.length?{offset:d.messageOffset,before:d.messages[0].id}:{}},execution:{...e.execution,nodes:Rr([...d.nodes,...((E=e.execution)==null?void 0:E.nodes)||[]]),turns:Rr([...d.turns,...((b=e.execution)==null?void 0:b.turns)||[]]),segments:Rr([...d.segments||[],...((S=e.execution)==null?void 0:S.segments)||[]])},executionWindow:{...e.executionWindow,...d.nodes.length?{offset:d.nodeOffset,before:d.nodes[0].id}:{}}}:p;async function h(x){if(o||!m)return;const A=m.id,C=x==="messages"?m.messageWindow:m.executionWindow;i(x),l("");try{const O=await St("/api/conversation/detail?"+new URLSearchParams({sessionId:A,part:x,before:C.before}));if(c.current!==A)return;t==null||t(),r(k=>{const T=(k==null?void 0:k.id)===A?k:{id:A,messages:[],nodes:[],turns:[]};return{...T,[x]:Rr([...O.items,...T[x]]),...x==="messages"?{messageOffset:O.offset,userOffset:O.userOffset}:{nodeOffset:O.offset,turns:Rr([...O.turns,...T.turns]),segments:Rr([...O.segments||[],...T.segments||[]])}}})}catch(O){c.current===A&&l(O.message)}finally{c.current===A&&i("")}}const f=n.createElement(n.Fragment,null,((w=m==null?void 0:m.messageWindow)==null?void 0:w.offset)>0&&n.createElement("button",{className:"a-soft",type:"button",disabled:!!o,onClick:()=>h("messages")},"Load earlier messages"),((N=m==null?void 0:m.executionWindow)==null?void 0:N.offset)>0&&n.createElement("button",{className:"a-soft",type:"button",disabled:!!o,onClick:()=>h("nodes")},"Load earlier activity"),o&&n.createElement("span",{role:"status"},"Loading earlier ",o==="nodes"?"activity":"messages","…"),s&&n.createElement("p",{role:"alert"},s));return{session:m,controls:f,earlier:h,busy:o}}const Kf=[["👍","Thumbs up"],["❤️","Heart"],["😂","Laugh"],["🎉","Celebrate"],["😮","Surprised"],["😢","Sad"],["👎","Thumbs down"],["✅","Check"]],mk=e=>e.role==="user"?"You":"Amplifier";function BF({quote:e,sessionId:t,dispatch:a}){const[r,o]=v.useState("");if(!e)return null;const i=(e.navigationSessionId||e.sessionId)===t;return n.createElement("blockquote",{className:"a-reply-quote"},n.createElement("button",{type:"button",className:"a-quoted-source","data-action":"message.reveal",title:i?"Go to original message":"Open the original message in its conversation",onClick:async()=>{o("");try{const s=e.navigationSessionId||e.sessionId;await a("message.reveal",{sessionId:s,messageId:e.messageId})}catch(s){o(s.message)}}},n.createElement("strong",null,mk(e)),n.createElement("span",null,e.excerpt,e.truncated?"…":"")),!i&&n.createElement("small",null,"Quoted from the original conversation"),r&&n.createElement("small",{role:"status"},r))}function HF({quote:e,sessionId:t,dispatch:a}){const[r,o]=v.useState("");return!e||e.sessionId!==t?null:n.createElement("div",{className:"a-reply-preview","aria-label":"Quoted reply"},n.createElement("div",null,n.createElement("strong",null,"Replying to ",mk(e)),n.createElement("p",null,e.excerpt,e.truncated?"…":"")),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Remove quoted reply","data-action":"message.replyClear",onClick:async()=>{o("");try{await a("message.replyClear",{sessionId:t,expectedReplyId:e.id})}catch(i){o(i.message)}}},n.createElement(nn,null)),r&&n.createElement("small",{role:"alert"},r))}function VF({message:e,sessionId:t,dispatch:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(""),p=e.reactions||[];async function m(h,f){var g;if(!l){c(!0),d("");try{await a(h,{sessionId:t,messageId:e.id,...f}),h==="message.reply"&&((g=document.querySelector('[aria-label="Message Amplifier"]'))==null||g.focus())}catch(y){d(y.message)}finally{c(!1)}}}return n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-icon","aria-label":"Reply to message",title:"Reply to message","data-action":"message.reply",disabled:l,onClick:()=>m("message.reply",{})},n.createElement(ix,null)),n.createElement("div",{className:"a-reaction-control",onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||o(!1)},onKeyDown:h=>{var f;h.key==="Escape"&&(o(!1),(f=h.currentTarget.querySelector("button"))==null||f.focus())}},n.createElement("button",{type:"button",className:"a-icon","aria-label":"React to message",title:"React to message","aria-expanded":r,onClick:h=>{var g;const f=(g=h.currentTarget.closest(".a-messages"))==null?void 0:g.getBoundingClientRect();s(h.currentTarget.getBoundingClientRect().top-((f==null?void 0:f.top)||0)<110),o(!r)}},n.createElement(mx,null)),r&&n.createElement("div",{className:"a-reaction-picker","data-below":i,role:"group","aria-label":"Choose reaction"},Kf.map(([h,f])=>n.createElement("button",{key:h,type:"button","aria-label":f,"aria-pressed":p.includes(h),disabled:l,"data-action":"message.reaction",onClick:async()=>{await m("message.reaction",{emoji:h,present:!p.includes(h)}),o(!1)}},h)))),p.map(h=>{var f;return n.createElement("button",{key:h,type:"button",className:"a-reaction-chip","aria-label":`Remove ${((f=Kf.find(g=>g[0]===h))==null?void 0:f[1])||h} reaction`,"aria-pressed":"true",disabled:l,"data-action":"message.reaction",onClick:()=>m("message.reaction",{emoji:h,present:!1})},h)}),u&&n.createElement("span",{className:"a-message-interaction-error",role:"alert"},u))}function WF({session:e,focus:t,detail:a}){var i,s;const r=v.useRef(""),o=v.useRef("");return v.useEffect(()=>{var d,p;if(!t||t.sessionId!==(e==null?void 0:e.id)||a.busy)return;const l=`${t.sessionId}:${t.revision}`;if(o.current===l)return;const c=`${l}:${((d=e.messageWindow)==null?void 0:d.offset)??0}`;if(r.current===c)return;r.current=c;const u=[...document.querySelectorAll("[data-message-id]")].find(m=>m.dataset.messageId===t.messageId);if(u){o.current=l,u.tabIndex=-1,u.scrollIntoView({block:"center"}),u.focus({preventScroll:!0});return}((p=e.messageWindow)==null?void 0:p.offset)>0&&a.earlier("messages")},[e==null?void 0:e.id,(i=e==null?void 0:e.messages)==null?void 0:i.length,(s=e==null?void 0:e.messageWindow)==null?void 0:s.offset,t==null?void 0:t.revision,t==null?void 0:t.sessionId,a.busy]),null}function ZF({message:e,session:t,delivery:a,localDelivery:r,dispatch:o,retry:i,discard:s}){var N,x;const[l,c]=v.useState(!1),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=e.inputId||(r==null?void 0:r.commandId),y=t.configurationBusy||((N=t.ownership)==null?void 0:N.status)==="blocked"||t.workspaceAvailable===!1||!!t.historyReadOnlyReason,E=["working","starting","running","stopping"].includes(t.status),b=async()=>{if(!l){c(!0),f(""),m(!1);try{if(!t.id){d({delivery:"not_saved",message:"This message has no confirmed conversation yet. Choose Send again to retry the original submission."});return}const A=await o("conversation.delivery",{sessionId:t.id,inputId:g},{feedback:!1});d(A.result)}catch(A){f(A.message)}finally{c(!1)}}},S=async()=>{var A;if(!l){c(!0),f("");try{if((A=t.messages)==null?void 0:A.some(O=>O.role==="user"&&O.inputId===g)){const O=await o("conversation.retry",{sessionId:t.id,inputId:g,confirmUncertain:!0},{feedback:!1});d(O.result)}else await i(e);m(!1)}catch(C){f(C.message)}finally{c(!1)}}};if(!a)return null;const w=a.status==="sending";return n.createElement(n.Fragment,null,n.createElement("span",{className:"a-message-delivery",role:"status"},w?n.createElement(n.Fragment,null,n.createElement(Ro,{className:"a-progress-spinner"}),"Sending…"):n.createElement(n.Fragment,null,n.createElement(zn,null),a.status==="failed"?"Not sent":"Delivery not confirmed",a.status==="failed"?n.createElement("button",{type:"button",className:"a-link","data-action":"conversation.send",disabled:l||y,onClick:()=>{var A;return(A=t.messages)!=null&&A.some(C=>C.inputId===g)?S():i(e)}},n.createElement(pm,null),"Retry"):n.createElement("button",{type:"button",className:"a-link","data-action":"conversation.delivery",disabled:l||!g,onClick:b},n.createElement(pm,null),l?"Checking…":"Check delivery"))),!w&&a.error&&n.createElement("p",{role:"alert",className:"a-delivery-detail"},a.error),r&&a.status==="failed"&&!((x=t.messages)!=null&&x.some(A=>A.inputId===g))&&n.createElement("button",{type:"button",className:"a-link",disabled:l,onClick:()=>s==null?void 0:s(e)},"Discard unsent message"),(u==null?void 0:u.message)&&n.createElement("p",{role:"status",className:"a-delivery-detail"},u.message),h&&n.createElement("p",{role:"alert",className:"a-delivery-detail"},h),!w&&u&&!["accepted","sending"].includes(u.delivery)&&!p&&n.createElement("button",{type:"button",className:"a-link","data-action":"conversation.retry",disabled:l||y||E,onClick:()=>m(!0)},"Send again"),p&&n.createElement("div",{className:"a-delivery-confirm",role:"alert"},n.createElement("p",null,"The earlier attempt may have run even though delivery was not confirmed. Sending again could repeat that work. Your saved message and history will be kept."),n.createElement("button",{type:"button",className:"a-soft",disabled:l,onClick:()=>m(!1)},"Cancel"),n.createElement("button",{type:"button",className:"a-primary","data-action":"conversation.retry",disabled:l||y||E,onClick:S},l?"Sending…":"Send this message again")))}function hk(e){if(!e)return"Worker routing has not been reported.";const t={inherited_conversation:"This worker inherited the conversation selection.",delegation_preferences:"This worker uses delegation provider preferences.",agent_provider:"This worker uses its agent provider configuration.",agent_model_role:"This worker uses its agent model role.",session_defaults:"This worker uses its session defaults."},a=e.modelInheritance==="conversation_when_unspecified"?"Workers inherit the conversation model unless their configuration overrides it.":"Workers use bundle and agent model settings.",r=e.matrixSource==="user"?" from user settings":e.matrixSource==="bundle"?" from the bundle":"",o=e.resolverActive?` Routing is active${e.resolverName?` (${e.resolverName})`:""}${r}.`:"";return`${t[e.selectionSource]||a}${o} Other connected providers may be used.`}const zc={};function fk({items:e=[],remove:t}){return e.length?n.createElement("div",{className:"a-attachments"},e.map(a=>{var r;return n.createElement("div",{className:"a-attachment",key:a.id},(r=a.mime)!=null&&r.startsWith("image/")?n.createElement("a",{href:a.url,target:"_blank",rel:"noopener noreferrer"},n.createElement("img",{src:a.url,alt:a.name})):n.createElement(Fu,null),n.createElement("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",title:a.name},a.name,n.createElement("small",null,Math.ceil(a.size/1024)," KB")),t&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Remove "+a.name,"data-action":"attachment.remove",onClick:()=>t(a.id)},n.createElement(nn,null)))})):null}function Lc(e,t){var r,o,i;const a=yp(e,{model:t,default_model:t}).find(s=>s.id==="reasoning_effort");return(e==null?void 0:e.effort)||((r=e==null?void 0:e.config)==null?void 0:r.reasoning_effort)||((i=(o=e==null?void 0:e.info)==null?void 0:o.defaults)==null?void 0:i.reasoning_effort)||(a==null?void 0:a.default)||""}function JF({state:e,session:t,act:a,working:r}){var Ye,ht,bt,ft,Ce,gt,Et,vt,at,X,Re,ae,Le,Oe,et,st,It,xt,Ut,rt,Xe,$e,Nt,Zt,rn,In,yn,Fn,Gn,An,Jt,dn,ut;const o=Ja(e),i=!t,s=(t==null?void 0:t.id)||null,l=Ag(e),c=e.configurationRevision||0,u=JSON.stringify([((Ye=o.location)==null?void 0:Ye.kind)||"workspace",o.workspace,c]),d=v.useRef(null);i&&l.phase==="ready"&&(d.current={context:u,value:l});const p=l.phase==="ready"||l.phase==="error"?l:((ht=d.current)==null?void 0:ht.context)===u?d.current.value:l,m=i&&l.phase!=="ready"&&l.phase!=="error",h=(t==null?void 0:t.workspaceAvailable)===!1||!!(t!=null&&t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1,f=((bt=e.view)==null?void 0:bt.composerModel)||zc,[g,y]=v.useState(f),[E,b]=v.useState("");v.useEffect(()=>y(f),[f]);const S=ve=>{const ge={...g,...ve};y(ge),a("view.update",{patch:{composerModel:ge}})},w=((ft=o.location)==null?void 0:ft.kind)==="managed",N=w?{location:{kind:"managed"}}:{},x=((Ce=e.setup)==null?void 0:Ce.providersRequestedWorkspace)===o.workspace&&((Et=(gt=e.setup)==null?void 0:gt.providersLocation)==null?void 0:Et.kind)==="managed"===w?e.setup:zc,A=(x.providers||[]).filter(ve=>ve.enabled!==!1).map(ve=>{var At,Ot,Kt,Q,Yt,En,qn,pn;const ge=((Ot=(At=x.providerCatalogs)==null?void 0:At[ve.id])==null?void 0:Ot.metadata)||((Kt=x.metadata)==null?void 0:Kt[ve.module])||{};return{...ve,...ge,info:{...ge.info,defaults:{...(Q=ge.info)==null?void 0:Q.defaults,model:((Yt=ve.config)==null?void 0:Yt.default_model)||((En=ve.config)==null?void 0:En.model)||((pn=(qn=ge.info)==null?void 0:qn.defaults)==null?void 0:pn.model)}}}}),C=((vt=e.runtimeControl)==null?void 0:vt[s])||{},O=C["configuration.providers"],k=i?p.providers||A:(O==null?void 0:O.providers)||((X=(at=t==null?void 0:t.runtimeReport)==null?void 0:at.provider_choices)==null?void 0:X.map(ve=>({id:ve.id,info:{id:ve.provider,display_name:ve.display_name,defaults:{model:ve.model,reasoning_effort:ve.effort}}})))||[],T=i?!!((Re=o.selection)!=null&&Re.model):(O==null?void 0:O.pinned)??!!((ae=t==null?void 0:t.runtimeReport)!=null&&ae.selection||t!=null&&t.selection),I=!O&&!(t!=null&&t.runtimeReport)?t==null?void 0:t.initialModel:void 0,F=i?T?o.selection:p.effective||{}:(O==null?void 0:O.effective)||((Le=t==null?void 0:t.runtimeReport)==null?void 0:Le.effective_selection)||(t==null?void 0:t.selection)||I||{},z=[...((Oe=t==null?void 0:t.execution)==null?void 0:Oe.nodes)||[]].reverse().find(ve=>ve.kind==="llm"&&(ve.sessionId===s||!ve.sessionId&&!ve.parentId)),U=(i?l.phase==="ready":Array.isArray(O==null?void 0:O.providers))&&!k.length,H=F.model||(i?"":z==null?void 0:z.model)||(U?"Set up a model":l.phase==="error"?"Model unavailable":i?"Loading model…":"Choose a model"),te=F.instance||F.id||(i?"":z==null?void 0:z.provider)||"",j=k.find(ve=>ve.id===te),_=F.effort||Lc(j,H),P=(((et=e.setup)==null?void 0:et.providers)||[]).find(ve=>ve.id===te),G={...(xt=(It=(st=e.setup)==null?void 0:st.metadata)==null?void 0:It[P==null?void 0:P.module])==null?void 0:xt.info,...($e=(Xe=(rt=(Ut=e.setup)==null?void 0:Ut.providerCatalogs)==null?void 0:rt[te])==null?void 0:Xe.metadata)==null?void 0:$e.info,...j==null?void 0:j.info},W=Qw(k),D=((Nt=W.find(ve=>ve.id===te))==null?void 0:Nt.label)||(G==null?void 0:G.display_name)||(G==null?void 0:G.id)||((I==null?void 0:I.instance)===te?I.providerLabel:"")||te,ne=_?`${H} (${_})`:H,q=((rn=(Zt=j==null?void 0:j.info)==null?void 0:Zt.defaults)==null?void 0:rn.auth_mode)==="chatgpt_plan"||i&&((In=j==null?void 0:j.config)==null?void 0:In.auth_mode)==="chatgpt_plan",Z=D?`${D} · ${ne}`:ne,ie=g.open&&(g.sessionId??null)===s,ke=v.useRef(null),me=ek(ie,ke);il(ie,ke,()=>S({open:!1}));const _e=k.find(ve=>ve.id===g.instance),Je=C["configuration.providerModels"],De=i?(yn=x.providerCatalogs)==null?void 0:yn[g.instance]:((Fn=C.modelCatalogs)==null?void 0:Fn[g.instance])||(Je&&Je.provider===g.instance?{phase:"ready",models:Je.models}:null),ue=v.useRef(new Map);let ye=zl((De==null?void 0:De.models)||[]);ye.length?ue.current.set((i?ws(o):s)+"|"+g.instance,ye):ye=ue.current.get((i?ws(o):s)+"|"+g.instance)||[];const M=new Map(ye.map(ve=>[ve.id,ve])),Y=(An=(Gn=_e==null?void 0:_e.info)==null?void 0:Gn.defaults)==null?void 0:An.model;Y&&!M.has(Y)&&M.set(Y,{id:Y,name:Y}),ye=[...M.values()];const se=(De==null?void 0:De.metadata)||_e||{},Fe=((Jt=yp(se,{model:g.model,default_model:g.model}).find(ve=>ve.id==="reasoning_effort"))==null?void 0:Jt.choices)||[],je=g.effort||Lc(_e,g.model)||Lc(se,g.model),oe=v.useRef(!1),Ze=v.useRef(""),it=v.useRef(!1);v.useEffect(()=>{if(!i||!o.workspace&&!w)return;const ve=JSON.stringify([ws(o),c]);if(Ze.current===ve)return;const ge=setTimeout(()=>{Ze.current=ve,a("configuration.defaults",{workspace:o.workspace,bundle:o.bundle||"",...N}),x===zc&&a("providers.list",{workspace:o.workspace,...N})},250);return()=>clearTimeout(ge)},[i,o.workspace,o.bundle,w,c]),v.useEffect(()=>{var ve,ge;if(ie&&!it.current){const At=F.instance||F.id||g.instance||"",Ot=k.find(Kt=>Kt.id===At);S({instance:At,model:F.model||g.model||((ge=(ve=Ot==null?void 0:Ot.info)==null?void 0:ve.defaults)==null?void 0:ge.model)||"",effort:_||g.effort||""})}},[ie,s,k.map(ve=>ve.id).join("|"),F.instance,F.id,F.model,_]);function zt(){if(it.current=!1,b(""),ie){S({open:!1});return}S({open:!0,sessionId:s,instance:te,model:F.model||"",effort:_||""}),t&&a("runtime.control",{sessionId:s,operation:"configuration.providers",args:{}})}async function ct(ve){it.current=!0;const ge={...g,...ve};if(S(ve),b(""),!k.some(Ot=>Ot.id===ge.instance)||!ge.model)return;const At={instance:ge.instance,model:ge.model,...ge.effort?{effort:ge.effort}:{}};try{i?await a("view.update",{patch:{newSessionDraft:{...o,selection:At}}}):await a("runtime.control",{sessionId:s,operation:"provider.select",args:At})}catch(Ot){b(Ot.message)}}function qt(ve){var At,Ot,Kt,Q,Yt,En;if(!ve)return;const ge=k.find(qn=>qn.id===ve);ge&&(ct({instance:ve,model:O!=null&&O.selectionIssue?g.model||((At=O.selection)==null?void 0:At.model)||"":((Kt=(Ot=ge.info)==null?void 0:Ot.defaults)==null?void 0:Kt.model)||"",effort:O!=null&&O.selectionIssue&&(g.effort||((Q=O.selection)==null?void 0:Q.effort))||""}),i&&!((Yt=x.providerCatalogs)!=null&&Yt[ve])?a("providers.models",{id:ve,workspace:o.workspace,...N}):!i&&!((En=C.modelCatalogs)!=null&&En[ve])&&a("runtime.control",{sessionId:s,operation:"configuration.providerModels",args:{instance:ve}}))}function le(ve){it.current=!0,oe.current=!0,y({...g,effort:Fe[Number(ve.currentTarget.value)]})}function fe(ve){if(!oe.current)return;oe.current=!1;const ge=Fe[Number(ve.currentTarget.value)];ge&&ct({effort:ge})}const xe=(dn=e.actionStatus)==null?void 0:dn[i?"configuration.defaults":"runtime.control"],ze=E||((xe==null?void 0:xe.phase)==="error"?xe.error:"")||l.error;return n.createElement("div",{className:"a-model-control",ref:ke},n.createElement("button",{type:"button",className:"a-model-trigger","aria-label":"Model and reasoning settings",disabled:h,"aria-expanded":!!ie,"aria-busy":m||void 0,title:m?`${Z} · Checking bundle settings…`:Z,"data-action":"view.update",onClick:zt},n.createElement("span",null,Z),n.createElement(el,null)),ie&&n.createElement("section",{className:"a-model-popover a-compact-popover",style:me,"aria-label":"Conversation model"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation model"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close model settings","data-action":"view.update",onClick:()=>S({open:!1})},n.createElement(nn,null))),q&&n.createElement("p",{className:"a-caption"},"Using ChatGPT plan · ",n.createElement("a",{href:"https://chatgpt.com/settings/usage",target:"_blank",rel:"noopener noreferrer"},"Manage usage")),(O==null?void 0:O.selectionIssue)&&n.createElement("p",{role:"status"},O.selectionIssue),n.createElement("label",{htmlFor:"chat-provider"},"Provider"),n.createElement("select",{id:"chat-provider",value:g.instance||"","data-action":i?"view.update":"runtime.control",disabled:r,onChange:ve=>qt(ve.target.value)},!g.instance&&n.createElement("option",{value:"",disabled:!0},k.length?"Choose a provider":U?"No providers configured":"Loading providers…"),g.instance&&!_e&&n.createElement("option",{value:g.instance,disabled:!0},g.instance," (unavailable)"),W.map(ve=>n.createElement("option",{key:ve.id,value:ve.id},ve.label))),n.createElement("label",{htmlFor:"chat-model"},"Model"),n.createElement("select",{id:"chat-model","aria-label":"Conversation model",value:g.model||"",disabled:r||!_e,"data-action":i?"view.update":"runtime.control",onChange:ve=>ct({model:ve.target.value,effort:""})},!g.model&&n.createElement("option",{value:""},(De==null?void 0:De.phase)==="working"?"Loading models…":"Choose a model"),g.model&&!ye.some(ve=>ve.id===g.model)&&n.createElement("option",{value:g.model},g.model),ye.map(ve=>n.createElement("option",{key:ve.id,value:ve.id},ve.name))),Fe.length>0?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"chat-effort"},"Reasoning effort ",n.createElement("strong",null,je||"Choose effort")),n.createElement("input",{id:"chat-effort",type:"range",min:"0",max:Fe.length-1,step:"1",value:Math.max(0,Fe.indexOf(je)),"aria-valuetext":je||"Choose effort",disabled:r||!g.model,"data-action":i?"view.update":"runtime.control",onChange:le,onPointerUp:fe,onKeyUp:fe,onBlur:fe}),n.createElement("div",{className:"a-effort-labels"},n.createElement("span",null,Fe[0]),n.createElement("span",null,Fe.at(-1)))):n.createElement("small",null,"Reasoning effort is not configurable for this model."),!i&&n.createElement("p",{className:"a-muted","data-part":"delegation-routing"},hk((O==null?void 0:O.delegationRouting)||((ut=t==null?void 0:t.runtimeReport)==null?void 0:ut.delegationRouting))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>{var ve;return a("view.update",{patch:{composerModel:{...g,open:!1},panel:"settings",settingsSection:"setup",settingsExpanded:["ai-connections"],aiConnectionEditor:{...((ve=e.view)==null?void 0:ve.aiConnectionEditor)||{},step:"services"}}})}},"Add connection"),n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>{var ve;return a("view.update",{patch:{composerModel:{...g,open:!1},panel:"settings",settingsSection:"setup",settingsExpanded:["ai-connections"],aiConnectionEditor:{...((ve=e.view)==null?void 0:ve.aiConnectionEditor)||{},step:"list"}}})}},"Manage connections")),n.createElement("small",null,"Model changes here apply to this conversation."),ze&&n.createElement("small",{className:"a-danger",role:"status"},ze),!ze&&(De==null?void 0:De.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},"The model list is unavailable. Your current selection is preserved.")))}function KF(e){return new Promise((t,a)=>{if(e.size>32*1024*1024||!e.size){a(new Error("Choose a nonempty file up to 32 MB."));return}const r=new FileReader;r.onload=()=>t(String(r.result).split(",")[1]),r.onerror=()=>a(new Error("Could not read "+e.name)),r.readAsDataURL(e)})}function YF(e,t){var u,d,p;const a=((u=e.observation)==null?void 0:u.recovery)||{},r=a.call_id||((d=e.observation)==null?void 0:d.call_id),o=r?(((p=t==null?void 0:t.execution)==null?void 0:p.nodes)||[]).find(m=>m.kind==="tool"&&m.toolCallId===r):null,i=r?((t==null?void 0:t.workers)||[]).find(m=>m.callId===r||m.toolCallId===r):null,s={returned:"Result returned",cancelled:"Work cancelled",interrupted:"Work interrupted",failed:"Work failed",pending:"Outcome unknown"}[a.status]||"Saved work notice",c=a.outcome==="unconfirmed"||["cancelled","interrupted","pending"].includes(a.status)?"The final outcome is unconfirmed. Inspect the saved work before deciding whether to continue.":a.reason==="restored_evidence"?"A saved call or result was restored to this chat.":a.reason==="changed_evidence"?"A saved result replaced an earlier pending record.":"Saved work was found when this chat resumed.";return{facts:a,node:o,worker:i,status:s,explanation:c}}function Yf({message:e,session:t,state:a,act:r}){const{facts:o,node:i,worker:s,status:l,explanation:c}=YF(e,t),u=s&&(a.sessions||[]).find(m=>m.id===s.id||m.runtimeSessionId===s.sessionId),d=i==null?void 0:i.output,p=i==null?void 0:i.outputDetail;return n.createElement("div",{className:"a-recovery-notice"},n.createElement("p",null,n.createElement("strong",null,(s==null?void 0:s.name)||(s==null?void 0:s.agent)||(i==null?void 0:i.label)||"Background work"," · ",l)),n.createElement("p",null,c," This notice does not mean the work ran again."),u&&n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",onClick:()=>r("session.select",{id:u.id})},"Open worker chat"),(typeof d=="string"||p)&&n.createElement("details",null,n.createElement("summary",null,"View saved result"),n.createElement(Oi,{text:d||"",reference:p})),n.createElement("details",null,n.createElement("summary",null,"Technical details"),o.job_id&&n.createElement("p",null,"Job: ",n.createElement("code",null,o.job_id),n.createElement("br",null),"Call: ",n.createElement("code",null,o.call_id)),o.status==="returned"&&n.createElement("p",null,"A returned report does not independently verify that its claimed effects succeeded."),n.createElement(Oi,{text:e.text,reference:e.textDetail}),n.createElement("button",{type:"button",className:"a-link","data-action":"message.copy",onClick:()=>r("message.copy",{sessionId:t.id,messageId:e.id})},"Copy observation")))}function GF(e){var o,i;const t=(e==null?void 0:e.messages)||[],a=new Map;let r=Number(e==null?void 0:e.sharedHistoryUserTurnOffset)||0;for(let s=0;sp.role==="assistant");if(!c)continue;const u=(i=(o=e.execution)==null?void 0:o.turns)==null?void 0:i.find(p=>p.inputId===t[s].inputId&&t[s].inputId);(u?["completed","complete","done"].includes(u.phase||u.status):l{r.length&&a.push(r.length>1?r:r[0]),r=[]};for(const s of e)((i=s.observation)==null?void 0:i.source)==="local-job-recovery"&&!(t.get(s.id)||[]).length?r.push(s):(o(),a.push(s));return o(),a}function XF({messages:e,renderArtifacts:t,...a}){return n.createElement("details",{className:"a-recovery-group"},n.createElement("summary",null,"Saved work notices (",e.length,")"),n.createElement("p",null,"Recorded when this chat resumed. These notices are part of its history."),e.map(r=>n.createElement(n.Fragment,{key:r.id},n.createElement(gk,{message:r,...a,expandedObservation:!0}),t==null?void 0:t(r))))}function gk({message:e,session:t,state:a,act:r,stamp:o,working:i,forkTurn:s,retry:l,discard:c,dispatch:u=r,expandedObservation:d=!1}){var U,H,te;const[p,m]=v.useState(!1),[h,f]=v.useState(!1),[g,y]=v.useState(!1),[E,b]=v.useState(""),S=(U=a.view)==null?void 0:U.messageEdit,w=(S==null?void 0:S.sessionId)===t.id&&(S==null?void 0:S.messageId)===e.id,[N,x]=v.useState(w?S.text:""),A=v.useRef(null);v.useEffect(()=>{if(!w){A.current=null;return}(A.current===null||S.text===A.current)&&(x(S.text||""),A.current=null)},[w,S==null?void 0:S.text]);const C=(H=a.view)==null?void 0:H.messageCopy,O=(C==null?void 0:C.sessionId)===t.id&&(C==null?void 0:C.messageId)===e.id?C:null,k=i||t.configurationBusy||t.workspaceAvailable===!1||!!t.historyReadOnlyReason,T=j=>r("view.update",{patch:{messageEdit:j}}),I=e.localDelivery,F=I||((te=e.delivery)!=null&&te.status&&e.delivery.status!=="accepted"?e.delivery:null),z=async j=>{if(j.preventDefault(),!(p||k||!N.trim())){m(!0);try{I?await l(e,N):await u("message.edit",{sessionId:t.id,messageId:e.id,text:N,mode:S!=null&&S.fork?"fork":"current"})}catch(_){b(_.message)}finally{m(!1)}}};if(e.observation){if(e.observation.source==="local-job-recovery")return n.createElement("article",{className:"a-message a-assistant","data-message-id":e.id},d?n.createElement(Yf,{message:e,session:t,state:a,act:r}):n.createElement("details",null,n.createElement("summary",null,"Saved work notice"),n.createElement(Yf,{message:e,session:t,state:a,act:r})));const j=n.createElement(n.Fragment,null,n.createElement(Oi,{text:e.text,reference:e.textDetail,markdown:!0}),n.createElement("button",{type:"button",className:"a-link","data-action":"message.copy",onClick:()=>r("message.copy",{sessionId:t.id,messageId:e.id})},"Copy observation"));return n.createElement("article",{className:"a-message a-assistant","data-message-id":e.id},d?j:n.createElement("details",null,n.createElement("summary",null,e.observation.source==="local-job-recovery"?"Recovered work update":["amplifier-delegate","amplifier-child","amplifier-child-lifecycle"].includes(e.observation.source)?"Delegated work update":"Service observation"," · Details"),j))}return n.createElement("article",{className:`a-message a-${e.role==="user"?"user":"assistant"}`,"data-message-id":e.id},n.createElement("div",{className:"a-msg-meta"},n.createElement("strong",null,e.role==="user"?"You":e.role==="assistant"?"Amplifier":e.role),n.createElement("span",null,e.via&&(e.via==="observation"?"Background follow-up · ":`via ${e.via} · `),e.timestampKnown===!1?"Time unavailable":o(e.createdAt))),n.createElement(BF,{quote:e.replyTo,sessionId:t.id,dispatch:u}),n.createElement(fk,{items:e.attachments}),E&&n.createElement("p",{role:"alert"},E),w?n.createElement("form",{className:"a-message-editor",onSubmit:z},n.createElement("textarea",{autoFocus:!0,"aria-label":"Edit your message",value:N,"data-action":"view.update",onChange:j=>{x(j.target.value),A.current=j.target.value,T({...S,text:j.target.value})},onKeyDown:j=>{j.key==="Escape"&&(j.preventDefault(),T(null)),j.key==="Enter"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),j.currentTarget.form.requestSubmit())}}),n.createElement("p",{className:"a-caption"},I?"Update this unsent message and try again.":"Continue from this point. Later messages leave the active conversation; saved event history and earlier tool effects remain."),!I&&n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:!!(S!=null&&S.fork),"data-action":"view.update",onChange:j=>T({...S,text:N,fork:j.target.checked})}),"Start a new conversation instead"),n.createElement("div",{className:"a-message-edit-actions"},n.createElement("button",{className:"a-soft",type:"button",disabled:p,"data-action":"view.update",onClick:()=>T(null)},"Cancel"),n.createElement("button",{className:"a-primary",type:"submit",disabled:p||k||!N.trim(),"data-action":"message.edit","data-operation-pending":p||void 0,"aria-busy":p||void 0},n.createElement(Li,null),p?"Starting…":"Save & regenerate"))):n.createElement(Oi,{text:e.text||(i?"…":""),reference:e.textDetail,markdown:e.role!=="user",automatic:e.role==="assistant",writingContext:e.role==="assistant"?{sessionId:t.id,messageId:e.id,act:r}:void 0,fileContext:e.role==="assistant"?{sessionId:t.id,workspace:t.workspace,act:r}:void 0}),!w&&n.createElement("div",{className:"a-message-actions"},n.createElement("button",{type:"button",className:"a-icon",title:"Copy as Markdown","aria-label":"Copy message as Markdown","data-action":"message.copy",disabled:g,"data-operation-pending":g||void 0,"aria-busy":g||void 0,onClick:async()=>{if(!I){await r("message.copy",{sessionId:t.id,messageId:e.id});return}y(!0);try{await navigator.clipboard.writeText(e.text),f(!0)}catch(j){b(j.message)}finally{y(!1)}}},(O==null?void 0:O.status)==="ready"||h?n.createElement(Pt,null):n.createElement(rr,null)),!I&&["user","assistant"].includes(e.role)&&n.createElement(VF,{message:e,sessionId:t.id,dispatch:u}),e.role==="user"&&n.createElement("button",{type:"button",className:"a-icon",title:t.historyReadOnlyReason||(t.workspaceAvailable===!1?"Workspace folder unavailable":k?"Wait for the current work to finish":"Edit message"),"aria-label":"Edit message",disabled:k||p||!!I&&F.status!=="failed","data-operation-pending":p||void 0,"aria-busy":p||void 0,"data-action":"view.update",onClick:async()=>{m(!0);try{T({sessionId:t.id,messageId:e.id,text:e.textDetail?await Ll(e.textDetail):e.text,fork:!1})}catch(j){b(j.message)}finally{m(!1)}}},n.createElement(qi,null)),n.createElement(ZF,{message:e,session:t,delivery:F,localDelivery:I,dispatch:u,retry:l,discard:c}),s&&n.createElement(eq,{session:t,turn:s,act:r,working:i}),(O==null?void 0:O.status)==="ready"&&n.createElement("span",{role:"status",className:"a-copy-result success"},"Copied Markdown"),(O==null?void 0:O.status)==="error"&&n.createElement("span",{role:"alert",className:"a-copy-result error"},n.createElement(zn,null),O.message||"Could not copy")))}function eq({session:e,turn:t,act:a,working:r}){return n.createElement("button",{type:"button",className:"a-icon",title:e.historyReadOnlyReason||(e.workspaceAvailable===!1?"Workspace folder unavailable":r?"Wait for the current work to finish":"Fork a new chat from here"),"aria-label":`Fork conversation after turn ${t}`,disabled:r||e.configurationBusy||e.workspaceAvailable===!1||!!e.historyReadOnlyReason,"data-action":"session.fork",onClick:()=>a("session.fork",{id:e.id,turn:t})},n.createElement(Wa,null))}const Ia=e=>JSON.stringify([e.sessionId,e.workerId||null]),tq={idle:"Ready for follow-up",working:"Working",running:"Working",starting:"Starting",queued:"Queued",stopping:"Interruption requested",completed:"Completed",interrupted:"Outcome unknown",error:"Needs attention",cancelled:"Cancelled",stopped:"Stopped"},Gf={selected:[],cursors:{},results:{},drafts:{}};function nq({dispatch:e}){const t="amplifier-coordination-v1",[a,r]=v.useState(()=>{try{return{...Gf,...JSON.parse(sessionStorage.getItem(t)||"null")}}catch{return Gf}}),o=v.useRef(new Set),i=v.useRef(a),[s,l]=v.useState([]),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(null),[y,E]=v.useState(!1),b=x=>{const A=x(i.current);i.current=A,r(A);try{sessionStorage.setItem(t,JSON.stringify(A))}catch{h("This browser could not save delivery cursors. Reports may appear again after reload.")}},S=async()=>{try{const x=await e("coordination.list",{},{feedback:!1});l(x.result.items),x.result.truncated&&h("Showing the first 100 targets. Agents can address any known conversation directly.")}catch(x){u(x.message)}};v.useEffect(()=>{S()},[]),v.useEffect(()=>{if(!a.selected.length)return;let x=!0,A=0;const C=new AbortController;return(async()=>{for(;x;){const O=a.selected.map(k=>({...k,...i.current.cursors[Ia(k)]?{afterCursor:i.current.cursors[Ia(k)]}:{}}));try{E(!0);const k=await e("coordination.wait",{targets:O,waitMs:3e4,maxBytes:32768},{feedback:!1,signal:C.signal});if(!x)return;A=0,p("");const T=k.result;if(T.errors.length){p(T.errors.map(I=>I.error).join(" "));return}b(I=>{const F={...I.cursors},z={...I.results};for(const H of T.targets){const te=Ia(H.target),j=z[te]||[],_=new Set(j.map(P=>P.id));z[te]=[...j,...H.results.filter(P=>!_.has(P.id)).map(P=>({...P,text:P.text.slice(0,4096),textTruncated:P.textTruncated||P.text.length>4096}))].slice(-8),F[te]=H.nextCursor}const U=new Set([...Object.keys(z).slice(-16),...I.selected.map(Ia)]);return{...I,cursors:Object.fromEntries(Object.entries(F).filter(([H])=>U.has(H))),results:Object.fromEntries(Object.entries(z).filter(([H])=>U.has(H)))}}),l(I=>I.map(F=>T.targets.find(z=>Ia(z.target)===Ia(F.target))||F)),T.targets.some(I=>I.cursorGap)&&h("Some older reports are no longer retained here. Open the saved conversation for its available history.")}catch(k){if(!x||k.name==="AbortError")return;p("Waiting to reconnect: "+k.message),await new Promise(T=>{const I=()=>{clearTimeout(F),C.signal.removeEventListener("abort",I),T()},F=setTimeout(I,Math.min(15e3,1e3*2**A++));C.signal.addEventListener("abort",I,{once:!0})})}finally{x&&E(!1)}}})(),()=>{x=!1,C.abort()}},[JSON.stringify(a.selected)]);const w=x=>b(A=>{const C=Ia(x),O=A.selected.some(k=>Ia(k)===C);return{...A,selected:O?A.selected.filter(k=>Ia(k)!==C):[...A.selected,x].slice(0,8)}}),N=async(x,A)=>{const C=Ia(x.target);if(o.current.has(C))return;o.current.add(C);const O=i.current.drafts[C]||"";g(C),u("");try{if((await e(A,{...x.target,...A==="coordination.followup"?{text:O}:{}})).delivery==="unknown"){u("Delivery is unknown. Work was not replayed. Inspect the target before sending another instruction.");return}A==="coordination.followup"&&b(T=>({...T,drafts:{...T.drafts,[C]:""}})),h(A==="coordination.interrupt"?"Interruption requested. Effects may already have happened.":"Follow-up accepted."),await S()}catch(k){u(k.message)}finally{o.current.delete(C),g(null)}};return n.createElement("div",{className:"a-coordination"},n.createElement("p",null,"Follow up on a conversation or its workers without switching away from your current draft. Watch up to eight targets for reports or requests for attention."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"coordination.list",onClick:S},"Refresh targets"),n.createElement("button",{className:"a-link",disabled:!a.selected.length,onClick:()=>b(x=>({...x,selected:[]}))},"Stop watching"),n.createElement("span",{role:"status"},y?"Waiting for updates…":a.selected.length?`${a.selected.length} targets watched`:"Choose targets to watch")),c&&n.createElement("p",{role:"alert",className:"a-alert"},c),d&&n.createElement("p",{role:"alert",className:"a-alert"},d),m&&n.createElement("p",{role:"status"},m),s.map(x=>{var k;const A=Ia(x.target),C=a.selected.some(T=>Ia(T)===A),O=a.results[A]||[];return n.createElement("section",{key:A,className:"a-coordination-target","aria-label":`${x.kind==="worker"?"Worker":"Conversation"}: ${x.title}`},n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:C,disabled:!C&&a.selected.length>=8,onChange:()=>w(x.target)}),n.createElement("strong",null,x.title)," · ",x.kind==="worker"?"Worker":"Conversation"),n.createElement("p",{className:"a-caption"},tq[x.status]||x.status,x.attention?" · Needs attention":""),O.map(T=>n.createElement("article",{key:T.id,"data-report-id":T.id},n.createElement("p",{style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}},T.text),T.textTruncated&&n.createElement("small",null,"Report excerpt. Open the saved conversation for more."))),n.createElement("details",null,n.createElement("summary",null,"Follow up"),n.createElement("form",{onSubmit:T=>{T.preventDefault(),N(x,"coordination.followup")}},n.createElement("label",null,"Follow-up for ",x.title,n.createElement("textarea",{value:a.drafts[A]||"",disabled:!x.canFollowup||f===A,onChange:T=>b(I=>({...I,drafts:{...I.drafts,[A]:T.target.value}}))})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"coordination.followup",disabled:!x.canFollowup||!((k=a.drafts[A])!=null&&k.trim())||f===A},"Send follow-up")))),n.createElement("button",{type:"button",className:"a-link a-danger","data-action":"coordination.interrupt",disabled:!x.canInterrupt||f===A,onClick:()=>N(x,"coordination.interrupt")},"Interrupt"))}))}function aq(){const e=new Map;return{add(t,a){const r=Symbol();return e.set(r,{patch:{...t},sessionId:a}),r},addCanvas(t,a){var o,i;const r=Symbol();return e.set(r,{canvas:{open:a,sessionId:t.selectedSessionId,canvasId:(o=t.canvas)==null?void 0:o.id,host:(i=t.client)==null?void 0:i.hostInstanceId}}),r},settle(t){e.delete(t)},bindDraft(t,a){const r=e.get(t);r&&Object.hasOwn(r.patch,"draft")&&(r.sessionId=a)},apply(t){var o,i;if(!t||!e.size)return t;let a={...t.view},r=t.canvas;for(const{patch:s,sessionId:l,canvas:c}of e.values()){if(c){c.sessionId===t.selectedSessionId&&c.canvasId===((o=t.canvas)==null?void 0:o.id)&&c.host===((i=t.client)==null?void 0:i.hostInstanceId)&&(r={...r,open:c.open,visibilityPending:!0},c.open||(a.canvasFocused=!1));continue}const u={...s};l!==void 0&&l!==t.selectedSessionId&&delete u.draft,a={...a,...u}}return{...t,view:a,canvas:r}}}}const rq=new Set(["aiConnectionEditor","providerEditor","composerModel","composerBundle","bundleDefaultsDraft"]),oq=(e,t={})=>t.expectedRevision===void 0&&["providers.list","providers.models","providers.schema"].includes(e);function iq(e,t,a={}){var s;if(e!=="view.update"||a.id||a.expectedRevision!==void 0||a.signal||a.pendingViewToken||Object.keys(t).some(l=>!["patch","sessionId"].includes(l)))return null;const r=Object.keys(t.patch||{}),o=r[0],i=(s=t.patch)==null?void 0:s[o];return r.length!==1||!rq.has(o)||!i||typeof i!="object"||Array.isArray(i)?null:JSON.stringify([o,t.sessionId??null,i.sessionId??null])}function sq(){let e=null;return(t,a,r=null,o=null)=>{if(r&&(e==null?void 0:e.queue)===t&&e.key===r&&!e.started)return e.execute=a,e.promise;const i={queue:t,key:r,execute:a,started:!1},s=()=>{i.started=!0,e===i&&(e=null);const l=i.execute;return i.execute=null,l()};return i.promise=(o?Promise.all([t.current,o]):t.current).then(s,s),t.current=i.promise.catch(()=>{}),e=i,i.promise}}function lq(e,t){if(!e||e.revision!==t.baseRevision)throw Error("State stream needs a fresh snapshot.");const a=(o,i,s)=>{if(!i.length)return s.value;const[l,...c]=i,u=Array.isArray(o)?[...o]:{...o};return!c.length&&s.remove?delete u[l]:Object.defineProperty(u,l,{value:a(Object.hasOwn(o||{},l)?o[l]:void 0,c,s),enumerable:!0,configurable:!0,writable:!0}),u};let r=e;for(const o of t.changes)r=a(r,o.path,o);if(r.revision!==t.revision)throw Error("State stream revision mismatch.");return r}function cq(e,t=()=>{}){let a=null,r=null,o=null,i=0;function s(){return r||(a===o?(a=null,Promise.resolve()):(r=(async()=>{for(;a!==null;){const c=a,u=i;if(a=null,c!==o)try{await e(JSON.parse(c)),u===i&&(o=c)}catch(d){t(d)}}})().finally(()=>{r=null,a!==null&&s()}),r))}const l=c=>(a=JSON.stringify(c),s());return l.invalidate=()=>{i++,o=null},l}function uq(e=32){const t=new Map,a=new Map;let r;const o=c=>{var u;return(u=c==null?void 0:c.sessions)==null?void 0:u.find(d=>d.id===c.selectedSessionId)};function i(c){var p;const u=(p=c==null?void 0:c.client)==null?void 0:p.hostInstanceId;r!==void 0&&u!==r&&(t.clear(),a.clear()),r=u;const d=o(c);if(d)for(t.delete(d.id),t.set(d.id,{session:d,canvas:c.canvas,canvasWorkspace:c.canvasWorkspace,canvasArtifacts:c.canvasArtifacts});t.size>e;)t.delete(t.keys().next().value)}function s(c,u){var h,f,g,y;if((f=(h=c==null?void 0:c.canvasWorkspace)==null?void 0:h.views)!=null&&f.some(E=>E.dirty))return null;const d=((g=c==null?void 0:c.sessions)==null?void 0:g.find(E=>E.id===u))||((y=t.get(u))==null?void 0:y.session);if(!d)return null;const p=o(c);p&&i({...c,sessions:c.sessions.map(E=>{var b;return E.id===p.id?{...E,draft:((b=c.view)==null?void 0:b.draft)||""}:E})});const m=Symbol();return a.set(m,{id:u,row:d}),m}function l(c){var S,w,N;if(!c||!a.size)return c;const{id:u,row:d}=Array.from(a.values()).at(-1);if(c.selectedSessionId===u)return{...c,navigationPending:!0};const p=t.get(u),m=((S=c.sessions)==null?void 0:S.find(x=>x.id===u))||d,{messages:h,workers:f,approvals:g,...y}=m,b=m.messageWindow||m.executionWindow||((w=m.messages)==null?void 0:w.length)||((N=m.approvals)==null?void 0:N.length)||m.streaming?m:p?{...p.session,...y}:{...m,historyLoading:!0,messages:[],workers:[],approvals:[]};return{...c,selectedSessionId:u,selectedWorkspaceId:b.workspaceId??c.selectedWorkspaceId,navigationPending:!0,sessions:[...(c.sessions||[]).filter(x=>x.id!==u),b],view:{...c.view,draft:b.draft||""},canvas:(p==null?void 0:p.canvas)||{open:!1},canvasWorkspace:(p==null?void 0:p.canvasWorkspace)||{views:[]},canvasArtifacts:(p==null?void 0:p.canvasArtifacts)||[]}}return{remember:i,begin:s,apply:l,settle:c=>a.delete(c)}}async function dq(e,t,a){const r=i=>{var s,l,c;return(c=(l=(s=i==null?void 0:i.sessions)==null?void 0:s.find(u=>u.id===t.sessionId))==null?void 0:l.messages)==null?void 0:c.find(u=>u.id===t.messageId)};let o=r(e);if(!o){const i=await a("/api/state?sessionId="+encodeURIComponent(t.sessionId));o=r(i.state||i)}if(!o)throw Error("Message no longer available");return o.textDetail?Ll(o.textDetail,a):o.text||""}async function pq(e,{request:t,download:a,clipboard:r}){let o="ready",i=e.destination==="clipboard"?"Copied conversation Markdown":"Markdown download started";try{const s=await t(e.url);e.destination==="clipboard"?await r.writeText(s.content):a(s.filename,s.content,s.mimeType)}catch(s){o="error",i="Could not export: "+s.message}await t("/api/actions",{method:"POST",body:{action:"session.exportResult",args:{requestId:e.requestId,status:o,message:i}}})}class mq{constructor({document:t=globalThis.document,navigator:a=globalThis.navigator,onState:r=()=>{}}={}){var o;this.document=t,this.navigator=a,this.onState=r,this.active=!1,this.enabled=!0,this.sentinel=null,this.pending=null,this.epoch=0,this.visible=()=>{var i;((i=this.document)==null?void 0:i.visibilityState)==="visible"&&this.acquire()},(o=this.document)==null||o.addEventListener("visibilitychange",this.visible)}setActive(t){this.active!==t&&(this.active=t,t?this.acquire():this.release())}setEnabled(t){this.enabled=t,t?this.acquire():this.release()}async acquire(){var r,o,i;if(!this.active||!this.enabled||((r=this.document)==null?void 0:r.visibilityState)!=="visible"||this.sentinel||this.pending)return;if(!((i=(o=this.navigator)==null?void 0:o.wakeLock)!=null&&i.request)){this.onState("unsupported");return}const t=this.epoch,a=this.pending=Promise.resolve().then(()=>this.navigator.wakeLock.request("screen"));try{const s=await a;if(t!==this.epoch||!this.active||!this.enabled||this.document.visibilityState!=="visible"){await s.release();return}this.sentinel=s,s.addEventListener("release",()=>{this.sentinel===s&&(this.sentinel=null,this.onState(this.active&&this.enabled?"released":"off"))},{once:!0}),this.onState(s.released?"released":"active"),s.released&&(this.sentinel=null)}catch{t===this.epoch&&this.active&&this.enabled&&this.onState("unavailable")}finally{this.pending===a&&(this.pending=null),t!==this.epoch&&this.active&&this.enabled&&this.acquire()}}release(){++this.epoch;const t=this.sentinel;this.sentinel=null,t&&Promise.resolve(t.release()).catch(()=>{}),this.onState("off")}dispose(){var t;this.active=!1,this.release(),(t=this.document)==null||t.removeEventListener("visibilitychange",this.visible)}}class hq{constructor({navigator:t=globalThis.navigator,document:a=globalThis.document,Metadata:r=globalThis.MediaMetadata,getAudio:o=()=>null,onState:i=()=>{},onAction:s=()=>{},onError:l=()=>{}}={}){Object.assign(this,{navigator:t,document:a,Metadata:r,getAudio:o,onState:i,onAction:s,onError:l}),this.active=!1,this.epoch=0,this.handlers=[],this.trackListeners=[],this.tracks=[],this.onVisibility=()=>{this.active&&(a==null?void 0:a.visibilityState)==="visible"&&this.resumePlayback()},a==null||a.addEventListener("visibilitychange",this.onVisibility)}start(){var t,a,r,o;if(!this.active){if(this.active=!0,++this.epoch,this.onState({audioSessionState:"unavailable",microphoneInterrupted:!1,microphoneEnded:!1,playbackBlocked:!1}),this.audioSession=(t=this.navigator)==null?void 0:t.audioSession,this.audioSession){try{this.previousType=this.audioSession.type,this.audioSession.type="play-and-record"}catch{this.previousType=void 0}this.audioChanged=()=>{this.active&&(this.onState({audioSessionState:this.audioSession.state}),this.syncMicrophone(),this.audioSession.state==="active"&&this.resumePlayback())},(r=(a=this.audioSession).addEventListener)==null||r.call(a,"statechange",this.audioChanged),this.audioChanged()}if(this.mediaSession=(o=this.navigator)==null?void 0:o.mediaSession,!!this.mediaSession){try{this.previousMetadata=this.mediaSession.metadata,this.previousPlaybackState=this.mediaSession.playbackState,this.Metadata&&(this.metadata=new this.Metadata({title:"Amplifier voice call"}),this.mediaSession.metadata=this.metadata),this.mediaSession.playbackState="playing"}catch{}for(const[i,s]of[["togglemicrophone",()=>this.onAction("call.mute",{muted:!this.muted})],["hangup",()=>this.onAction("call.end")]]){const l=this.epoch;try{this.mediaSession.setActionHandler(i,()=>{if(!(!this.active||l!==this.epoch))try{Promise.resolve(s()).catch(c=>this.onError(c))}catch(c){this.onError(c)}}),this.handlers.push(i)}catch{}}}}}attachStream(t){this.removeTrackListeners(),this.tracks=t.getAudioTracks();for(const a of this.tracks)for(const r of["mute","unmute","ended"]){const o=()=>{this.active&&(this.syncMicrophone(),r==="unmute"&&this.resumePlayback())};a.addEventListener(r,o),this.trackListeners.push([a,r,o])}this.syncMicrophone()}setMuted(t){this.muted=t,this.syncMicrophone()}syncMicrophone(){var r,o,i;if(!this.active)return;const t=this.tracks.filter(s=>s.readyState!=="ended"),a=t.some(s=>s.muted);this.onState({microphoneInterrupted:a,microphoneEnded:this.tracks.length>0&&!t.length});try{Promise.resolve((i=(r=this.mediaSession)==null?void 0:r.setMicrophoneActive)==null?void 0:i.call(r,!this.muted&&((o=this.audioSession)==null?void 0:o.state)!=="interrupted"&&t.some(s=>s.enabled&&!s.muted))).catch(()=>{})}catch{}}async resumePlayback(){var o;const t=this.getAudio();if(!this.active||!(t!=null&&t.srcObject)||((o=this.audioSession)==null?void 0:o.state)==="interrupted"||this.playPending)return;const a=this.epoch;let r;try{r=Promise.resolve(t.play())}catch(i){r=Promise.reject(i)}this.playPending=r;try{await r,this.active&&a===this.epoch&&this.onState({playbackBlocked:!1})}catch{this.active&&a===this.epoch&&this.onState({playbackBlocked:!0})}finally{this.playPending===r&&(this.playPending=null)}}removeTrackListeners(){for(const[t,a,r]of this.trackListeners)t.removeEventListener(a,r);this.trackListeners=[],this.tracks=[]}stop(){var t,a,r,o;if(this.active){this.active=!1,++this.epoch,this.playPending=null,this.removeTrackListeners(),(a=(t=this.audioSession)==null?void 0:t.removeEventListener)==null||a.call(t,"statechange",this.audioChanged);try{this.previousType!==void 0&&this.audioSession.type==="play-and-record"&&(this.audioSession.type=this.previousType)}catch{}for(const i of this.handlers)try{this.mediaSession.setActionHandler(i,null)}catch{}this.handlers=[];try{Promise.resolve((o=(r=this.mediaSession)==null?void 0:r.setMicrophoneActive)==null?void 0:o.call(r,!1)).catch(()=>{})}catch{}try{this.mediaSession&&(!this.metadata||this.mediaSession.metadata===this.metadata)&&(this.mediaSession.metadata=this.previousMetadata??null,this.mediaSession.playbackState=this.previousPlaybackState||"none")}catch{}this.audioSession=this.mediaSession=this.metadata=null,this.onState({audioSessionState:"inactive",microphoneInterrupted:!1,microphoneEnded:!1,playbackBlocked:!1})}}dispose(){var t;this.stop(),(t=this.document)==null||t.removeEventListener("visibilitychange",this.onVisibility)}}class fq{constructor({request:t,onState:a=()=>{},onError:r=()=>{},onAction:o}){this.request=t,this.onState=a,this.onError=r,this.state={status:"idle",muted:!1,keepAwake:!0,wakeLock:"off"},this.wakeLock=new mq({onState:i=>this.update({wakeLock:i})}),this.generation=0,this.peer=null,this.stream=null,this.events=null,this.audio=null,this.callAudio=new hq({getAudio:()=>this.audio,onState:i=>this.update(i),onError:r,onAction:o||((i,s)=>i==="call.mute"?this.setMuted(s.muted):this.end())}),this.readySent=!1,this.onPageHide=()=>{++this.generation,this.state.id&&this.request("/api/voice/end",{method:"POST",body:{id:this.state.id},keepalive:!0}).catch(()=>{}),this.release(),this.update({status:"ended",id:null})},window.addEventListener("pagehide",this.onPageHide)}update(t){this.state={...this.state,...t},this.onState({...this.state}),t.status&&this.wakeLock.setActive(["connecting","connected"].includes(t.status))}async start({provider:t="auto",sessionId:a=null}={}){var o;if(["connecting","connected"].includes(this.state.status))return this.state;if(!((o=navigator.mediaDevices)!=null&&o.getUserMedia)||!window.RTCPeerConnection)throw new Error("Voice needs a browser with microphone and WebRTC support, on localhost or HTTPS.");const r=++this.generation;this.update({status:"connecting",error:null,muted:!1});try{const i=await this.request("/api/voice/config");if(!i.available)throw new Error(i.reason||"Voice is not configured on the host.");if(r!==this.generation)return this.state;this.callAudio.start(),this.callAudio.setMuted(!1);const s=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});if(r!==this.generation)return s.getTracks().forEach(p=>p.stop()),this.state;this.stream=s,s.getAudioTracks().forEach(p=>{p.enabled=!this.state.muted}),this.callAudio.attachStream(s);const l=this.peer=new RTCPeerConnection;this.audio=new Audio,this.audio.autoplay=!0,this.audio.setAttribute("playsinline",""),l.addEventListener("track",p=>{r!==this.generation||!this.audio||(this.audio.srcObject=p.streams[0]||new MediaStream([p.track]),this.callAudio.resumePlayback())}),s.getTracks().forEach(p=>l.addTrack(p,s));const c=this.events=l.createDataChannel("oai-events");this.readySent=!1;const u=async()=>{if(!(this.readySent||!this.state.id||l.connectionState!=="connected"||c.readyState!=="open")){this.readySent=!0;try{await this.request("/api/voice/ready",{method:"POST",body:{id:this.state.id}}),r===this.generation&&this.update({status:"connected"})}catch(p){this.onError(p),await this.end()}}};c.addEventListener("open",u),c.addEventListener("message",p=>{try{JSON.parse(p.data).type==="session.closed"&&r===this.generation&&(this.release(),this.update({status:"ended",finalized:!0}))}catch{}}),l.addEventListener("connectionstatechange",()=>{u(),l.connectionState==="failed"&&r===this.generation&&(this.onError(new Error("The voice connection failed. Your background work continues.")),this.end().catch(this.onError))}),await l.setLocalDescription(await l.createOffer());const d=await this.request("/api/voice/connect",{method:"POST",body:{sdp:l.localDescription.sdp,provider:t,sessionId:a}});return r!==this.generation?(await this.request("/api/voice/end",{method:"POST",body:{id:d.id}}),this.state):(this.update({id:d.id,provider:d.provider,model:d.model,fallbackReason:d.fallbackReason||null}),await l.setRemoteDescription({type:"answer",sdp:d.sdp}),await u(),this.connectionTimer=setTimeout(()=>{r===this.generation&&this.state.status==="connecting"&&(this.onError(new Error("Voice media could not connect. Check microphone and network access, then try again.")),this.end().catch(this.onError))},25e3),this.state)}catch(i){if(r!==this.generation)return this.state;if(this.state.id)try{await this.request("/api/voice/end",{method:"POST",body:{id:this.state.id}})}catch{}this.release();const s=i.name==="NotAllowedError"?"Microphone access was declined. Allow microphone access for this site, then call again.":i.message;throw this.update({status:"error",error:s,id:null}),new Error(s)}}setKeepAwake(t){this.update({keepAwake:!!t}),this.wakeLock.setEnabled(!!t)}setMuted(t){var r;const a=!!t;(r=this.stream)==null||r.getAudioTracks().forEach(o=>{o.enabled=!a}),this.update({muted:a}),this.callAudio.setMuted(a)}async end(){var a;++this.generation,this.update({status:"ending"}),(a=this.stream)==null||a.getAudioTracks().forEach(r=>{r.enabled=!1});let t;try{return t=await this.request("/api/voice/end",{method:"POST",body:{id:this.state.id||null}}),t}finally{this.release(),this.update({status:"ended",finalized:(t==null?void 0:t.finalized)||!1,id:null})}}release(){var t,a,r;this.callAudio.stop(),this.wakeLock.setActive(!1),clearTimeout(this.connectionTimer),(t=this.stream)==null||t.getTracks().forEach(o=>o.stop()),(a=this.events)==null||a.close(),(r=this.peer)==null||r.close(),this.audio&&(this.audio.pause(),this.audio.srcObject=null),this.peer=this.stream=this.events=this.audio=null}dispose(){++this.generation,this.onPageHide(),window.removeEventListener("pagehide",this.onPageHide),this.wakeLock.dispose(),this.callAudio.dispose()}}function gq(e,t){return new Promise((a,r)=>{let o=!1,i;const s=(c,u)=>{var d,p;if(o){(d=u==null?void 0:u.close)==null||d.call(u);return}o=!0,clearTimeout(l),i!==void 0&&((p=t.cancelVideoFrameCallback)==null||p.call(t,i)),c?r(c):a(u)},l=setTimeout(()=>s(Error("No fresh screen frame arrived.")),2e3);try{globalThis.ImageCapture?new globalThis.ImageCapture(e).grabFrame().then(c=>s(null,c),c=>s(c)):t.requestVideoFrameCallback?i=t.requestVideoFrameCallback(()=>s(null,t)):s(Error("Fresh frame capture is unsupported by this browser."))}catch(c){s(c)}})}class vk{constructor({request:t,onState:a=()=>{},getVoice:r,scope:o="voice",media:i=(s=>(s=globalThis.navigator)==null?void 0:s.mediaDevices)()}){var l;Object.assign(this,{request:t,onState:a,getVoice:r,media:i,scope:o}),this.generation=0,this.stream=null,this.grant=null,this.video=null,this.onPageHide=()=>this.stop(),(l=globalThis.window)==null||l.addEventListener("pagehide",this.onPageHide)}url(t){return`/api/${this.scope}/visual/${t}`}target(t){return{sessionId:t.sessionId,callId:this.scope==="voice"?t.id:null}}state(t){this.value={...this.value,...t},this.onState(this.value)}active(t){const a=this.getVoice();return(a==null?void 0:a.status)==="connected"&&a.id===t}async choose(){var r;const t=this.getVoice();if((t==null?void 0:t.status)!=="connected"||!t.id)throw Error(this.scope==="voice"?"Connect a voice call before choosing a screen source.":"Open a conversation before choosing a screen source.");if(!((r=this.media)!=null&&r.getDisplayMedia))throw Error("Screen capture is unavailable in this browser. Use a desktop browser on localhost or HTTPS.");this.stop();const a=this.generation;this.state({status:"choosing",error:null});try{const o=await this.media.getDisplayMedia({video:{width:{ideal:1280},height:{ideal:1280}},audio:!1});if(a!==this.generation||!this.active(t.id))throw o.getTracks().forEach(d=>d.stop()),Error("The chat or call changed while choosing a source.");this.stream=o;const i=o.getVideoTracks()[0];if(!i)throw Error("The selected source has no video track.");i.addEventListener("ended",()=>this.stop());const s=document.createElement("video");if(s.muted=!0,s.playsInline=!0,s.srcObject=o,this.video=s,await s.play(),a!==this.generation||!this.active(t.id))throw Error("The chat or call ended while preparing the source.");const l=i.getSettings().displaySurface||"unknown",c={kind:["browser","window","monitor"].includes(l)?l:"unknown",label:(i.label||"User-selected source").slice(0,200)},u=await this.request(this.url("grant"),{method:"POST",body:{...this.target(t),source:c}});if(a!==this.generation||!this.active(t.id))throw await this.request(this.url("revoke"),{method:"POST",body:{grantId:u.id}}).catch(()=>{}),Error("The chat or call changed; source permission was discarded.");this.grant=u,this.expiry=setTimeout(()=>this.stop(),Math.max(0,u.expiresAt*1e3-Date.now())),this.state({status:"ready",source:c,grantId:u.id})}catch(o){throw a===this.generation&&(this.stop(),this.state({status:"error",error:o.name==="NotAllowedError"?"Screen permission was not granted.":o.message})),o}}async checkNative(){const t=this.getVoice(),a=await this.request(this.url("native/status"),{method:"POST",body:this.target(t)});if(!this.active(t.id))throw Error("The chat or call ended while checking the desktop host.");return this.state({native:a}),a}async chooseNative(){var i;const t=this.getVoice(),a=(i=this.value)==null?void 0:i.native;if(!(a!=null&&a.available)||!this.active(t.id))throw Error("Check the desktop host before granting access.");this.stop();const r=this.generation,o=await this.request(this.url("grant"),{method:"POST",body:{...this.target(t),source:{kind:"native-foreground",hostId:a.host.id,hostInstanceId:a.hostInstanceId}}});if(r!==this.generation||!this.active(t.id))throw await this.request(this.url("revoke"),{method:"POST",body:{grantId:o.id}}).catch(()=>{}),Error("The chat or call changed; source permission was discarded.");this.grant=o,this.expiry=setTimeout(()=>this.stop(),Math.max(0,o.expiresAt*1e3-Date.now())),this.state({status:"ready",source:o.source,grantId:o.id})}sync(t,a,r){var i,s,l,c,u;const o=(i=this.getVoice())==null?void 0:i.id;this.scope==="computer"&&this.lastIdentity!==void 0&&this.lastIdentity!==o&&(this.stop(),this.state({native:null,capturedAt:null})),this.lastIdentity=o,this.grant&&(!a||!this.active(((s=this.grant)==null?void 0:s.callId)||((l=this.grant)==null?void 0:l.sessionId)||(t==null?void 0:t.id))||this.grant&&((r==null?void 0:r.available)===!1||r!=null&&r.id&&r.id!==this.grant.id))&&this.stop(),this.grant&&((c=r==null?void 0:r.lastCapture)==null?void 0:c.grantId)===this.grant.id&&r.lastCapture.capturedAt!==((u=this.value)==null?void 0:u.capturedAt)&&this.state({capturedAt:r.lastCapture.capturedAt})}async capture(t){var i,s;const a=this.grant,r=this.generation,o={requestId:t.id,grantId:t.grantId,sessionId:t.sessionId,callId:t.callId};try{if(!a||t.grantId!==a.id||t.callId!==a.callId||t.sessionId!==a.sessionId||!this.active(a.callId||a.sessionId))throw Error("This screen source is no longer authorized.");const l=(i=this.stream)==null?void 0:i.getVideoTracks()[0];if(!l||l.readyState!=="live"||l.muted)throw Error("The selected source is unavailable or paused.");const c=this.video,u=await gq(l,c);let d;try{if(r!==this.generation||!this.active(a.callId||a.sessionId)||l.readyState!=="live"||l.muted)throw Error("Screen sharing ended before capture.");const m=u===c?c.videoWidth:u.width,h=u===c?c.videoHeight:u.height;if(!m||!h)throw Error("The source did not provide visible pixels.");const f=document.createElement("canvas"),g=Math.min(1,1280/Math.max(m,h));if(f.width=Math.max(1,Math.round(m*g)),f.height=Math.max(1,Math.round(h*g)),f.getContext("2d").drawImage(u,0,0,f.width,f.height),d=f.toDataURL("image/png").split(",")[1],d.length>666668)throw Error("This image is too large. Select a smaller window.")}finally{u!==c&&u.close()}const p=Date.now()/1e3;await this.request(this.url("complete"),{method:"POST",body:{...o,image:d,capturedAt:p}}),r===this.generation&&((s=this.grant)==null?void 0:s.id)===a.id&&this.state({status:"ready",capturedAt:p,error:null})}catch(l){this.state({error:l.message}),await this.request(this.url("complete"),{method:"POST",body:{...o,error:l.message}}).catch(()=>{})}}stop(){var a;++this.generation,clearTimeout(this.expiry);const t=this.grant;this.grant=null,(a=this.stream)==null||a.getTracks().forEach(r=>r.stop()),this.stream=null,this.video&&(this.video.pause(),this.video.srcObject=null,this.video=null),this.state({status:"idle",source:null,grantId:null,capturedAt:null}),t&&this.request(this.url("revoke"),{method:"POST",body:{grantId:t.id},keepalive:!0}).catch(()=>{})}dispose(){var t;this.stop(),(t=globalThis.window)==null||t.removeEventListener("pagehide",this.onPageHide)}}class vq extends vk{constructor({getSession:t,...a}){super({...a,scope:"computer",getVoice:()=>{const r=t();return{sessionId:r,id:r,status:r?"connected":"idle"}}})}}function bq({sessionId:e,visual:t,client:a,dispatch:r,onError:o}){const i=u=>Promise.resolve().then(u).catch(o),s="this chat in this browser",l="computer.visual",c={sessionId:e};return e?n.createElement("section",{className:"a-card","aria-label":"Computer use"},n.createElement("h3",null,"Screen context for ",s),n.createElement("p",{className:"a-caption"},"Choose a window, tab, display, or the named desktop host. Only explicit captures are sent. Amplifier may capture that source when you ask about it. Access expires after 15 minutes or when you stop sharing, switch chats or disconnect. Sharing works with both text and voice, and stays active when a call starts or ends. Saved snapshots stay in the conversation."),n.createElement("div",{"data-runtime-section":"desktop-host",tabIndex:-1},n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",onClick:()=>i(()=>a.current.checkNative())},"Check desktop host")),t.native&&n.createElement("div",{role:"status"},n.createElement("p",null,"Desktop host: ",t.native.host.label,". This is the server's desktop, which may differ from this browser's device."),t.native.available?n.createElement("button",{className:"a-soft",onClick:()=>i(()=>a.current.chooseNative())},"Allow foreground snapshots from ",t.native.host.label," for ",s):n.createElement(n.Fragment,null,n.createElement("p",null,"Native observation is unavailable (",t.native.code||t.native.status,"). ",t.native.code==="backend_not_installed"?"The optional native-desktop library is missing from the serving app environment; a worker installation does not supply it.":t.native.code==="unsupported"?"The native source requires a local macOS host. Choose a browser screen source instead.":"Check the named host and its Screen Recording permission. Checking does not request permission or capture the screen."),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i(()=>r("view.update",{patch:{panel:"settings",settingsSection:"setup",settingsExpanded:["desktop"]}}))},"Open desktop setup")))),n.createElement("div",{"data-runtime-section":"screen-source",tabIndex:-1},t.source&&n.createElement("p",null,"Selected ",t.source.kind,": ",t.source.label),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:t.status==="choosing",onClick:()=>{a.current.choose().catch(o)}},"Choose screen source"))),n.createElement("div",{"data-runtime-section":"capture",tabIndex:-1,className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":l+".capture",disabled:t.status!=="ready",onClick:()=>i(()=>r(l+".capture",c))},"Capture screen"),n.createElement("button",{className:"a-soft","data-action":l+".revoke",disabled:t.status!=="ready",onClick:()=>i(async()=>{a.current.stop(),await r(l+".revoke",c)})},"Stop screen sharing")),t.capturedAt&&n.createElement("p",{className:"a-caption"},"Last captured ",new Date(t.capturedAt*1e3).toLocaleTimeString(),". Available for the next text or spoken request for 30 seconds."),t.error&&n.createElement("p",{role:"status"},t.error),n.createElement("p",{className:"a-caption"},"Native foreground snapshots identify the visible window on the explicitly selected host. Desktop control is not granted.")):null}function yq({sessionId:e,visual:t,client:a,dispatch:r,onError:o}){return t.status!=="ready"||!t.source?null:n.createElement("div",{className:"a-sharing-strip",role:"status","aria-label":"Screen sharing active","data-part":"screen-sharing"},n.createElement("span",null,n.createElement("strong",null,"Sharing active"),n.createElement("small",null,t.source.label||t.source.kind)),n.createElement("button",{type:"button",className:"a-soft","data-action":"computer.visual.revoke",onClick:()=>{a.current.stop(),r("computer.visual.revoke",{sessionId:e}).catch(o)}},"Stop sharing"))}function Eq({state:e,act:t}){var m,h;const[a,r]=v.useState(""),[o,i]=v.useState(!1),[s,l]=v.useState(null),c=v.useRef(!1),u=(((m=e.feedback)==null?void 0:m.requests)||[]).filter(f=>f.status==="unknown"),d=(((h=e.feedback)==null?void 0:h.followups)||[]).find(f=>f.requestId===s);async function p(f){if(c.current)return;c.current=!0,i(!0),r("");const g=crypto.randomUUID();l(g);try{await t("feedback.reconcile",{requestId:g,feedbackId:f})}catch(y){r(y.message)}finally{c.current=!1,i(!1)}}return n.createElement("section",{"aria-label":"Unconfirmed feedback delivery"},!!u.length&&n.createElement(n.Fragment,null,n.createElement("h3",null,"Unconfirmed delivery"),n.createElement("p",null,"Check for the original report using its saved identity. Checking never sends it again."),u.map(f=>n.createElement("div",{key:f.requestId},n.createElement("strong",null,f.title),n.createElement("button",{type:"button",className:"a-soft","data-action":"feedback.reconcile",disabled:o||["queued","sending"].includes(d==null?void 0:d.status),onClick:()=>p(f.requestId)},"Check delivery")))),d&&n.createElement("p",{role:"status"},d.message),a&&n.createElement("p",{role:"alert"},a))}function wq({state:e,report:t,act:a}){var x,A;const r=(x=e.view)==null?void 0:x.feedbackCorrectionDraft,[o,i]=v.useState(r||null),[s,l]=v.useState(!1),[c,u]=v.useState(""),d=v.useRef(o),p=v.useRef(Promise.resolve()),m=v.useRef(!1),h=v.useRef(null),f=v.useRef(!1);v.useEffect(()=>()=>{clearTimeout(h.current),f.current&&b(d.current).catch(()=>{})},[]),v.useEffect(()=>{!f.current&&!m.current&&(d.current=r||null,i(r||null))},[r]);const g=(((A=e.feedback)==null?void 0:A.followups)||[]).find(C=>{var O;return C.requestId===((O=o==null?void 0:o.pending)==null?void 0:O.requestId)}),y=(o==null?void 0:o.feedbackId)===t.feedbackId,E=["submitted","unknown","failed"].includes(g==null?void 0:g.status);function b(C){clearTimeout(h.current),f.current=!0,d.current=C,i(C);const O=p.current.catch(()=>{}).then(()=>a("view.update",{patch:{feedbackCorrectionDraft:C}})).then(k=>{if((k==null?void 0:k.accepted)===!1)throw Error("The correction draft could not be saved.");d.current===C&&(f.current=!1)});return p.current=O,O.catch(k=>u(k.message)),O}function S(C){f.current=!0,d.current={...d.current,...C},i(d.current),clearTimeout(h.current),h.current=setTimeout(()=>void b(d.current).catch(()=>{}),250)}function w(){u(""),b({feedbackId:t.feedbackId,title:t.editableTitle,body:t.editableBody,expectedRevision:t.revision})}async function N(C){if(C.preventDefault(),!(m.current||E)){m.current=!0,l(!0),u("");try{const O=d.current,k=O.pending||{requestId:crypto.randomUUID(),feedbackId:O.feedbackId,title:O.title,body:O.body,expectedRevision:O.expectedRevision};await b({...O,pending:k}),await a("feedback.update",k)}catch(O){u(O.message||"Delivery was not acknowledged. Retry only this same request.")}finally{m.current=!1,l(!1)}}}return y?n.createElement("form",{onSubmit:N,"aria-label":"Feedback correction"},n.createElement("h4",null,"Correction version"),n.createElement("p",null,"The correction is added as a comment. The original report and maintainer edits stay intact."),n.createElement("label",{htmlFor:"feedback-corrected-title"},"Corrected title"),n.createElement("input",{id:"feedback-corrected-title",maxLength:200,required:!0,disabled:!!o.pending||s,value:o.title,onChange:C=>S({title:C.target.value}),onBlur:()=>void b(d.current).catch(()=>{})}),n.createElement("label",{htmlFor:"feedback-corrected-body"},"Corrected description"),n.createElement("textarea",{id:"feedback-corrected-body",maxLength:16e3,required:!0,disabled:!!o.pending||s,value:o.body,onChange:C=>S({body:C.target.value}),onBlur:()=>void b(d.current).catch(()=>{})}),o.expectedRevision!==t.revision&&!o.pending&&n.createElement(n.Fragment,null,n.createElement("p",null,"The report changed. Review the refreshed report before using it as the correction's starting revision."),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>b({...d.current,expectedRevision:t.revision})},"Use reviewed revision")),!E&&n.createElement("button",{className:"a-primary","data-action":"feedback.update",disabled:s||["queued","sending"].includes(g==null?void 0:g.status)||o.expectedRevision!==t.revision||!o.title.trim()||!o.body.trim()},o.pending?"Check correction status":"Publish correction comment"),g&&n.createElement("p",{role:"status"},g.message),(g==null?void 0:g.commentUrl)&&n.createElement("a",{href:g.commentUrl,target:"_blank",rel:"noopener noreferrer"},"View correction"),(E||!o.pending)&&n.createElement("button",{type:"button",className:"a-soft",disabled:s,onClick:()=>b(null)},"Close correction draft"),c&&n.createElement("p",{role:"alert"},c)):n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-soft",onClick:w,disabled:!!(o!=null&&o.body)},"Draft a correction"),(o==null?void 0:o.body)&&n.createElement("p",null,"A correction for another report is saved. Return to that report before starting another."))}function kq({state:e,report:t,act:a}){var f,g;const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1),c=(f=e.view)==null?void 0:f.feedbackLifecycleDraft,u=(c==null?void 0:c.feedbackId)===t.feedbackId?c:null,d=(((g=e.feedback)==null?void 0:g.followups)||[]).find(y=>y.requestId===(u==null?void 0:u.requestId)),p=u&&!["submitted","failed","unknown"].includes(d==null?void 0:d.status);async function m(){if(l.current)return;l.current=!0,o(!0),s("");const y=t.state==="closed"?"feedback.reopen":"feedback.close",E=p?u:{action:y,requestId:crypto.randomUUID(),feedbackId:t.feedbackId,expectedRevision:t.revision};try{const b=await a("view.update",{patch:{feedbackLifecycleDraft:{...E,readRequestId:t.requestId}}});if((b==null?void 0:b.accepted)===!1)throw Error("Could not save the change request.");const{action:S,readRequestId:w,...N}=E;await a(S,N)}catch(b){s(b.message||"The state change was not acknowledged. Check this same request.")}finally{l.current=!1,o(!1)}}const h=d&&["submitted","unknown"].includes(d.status)&&t.requestId===(u==null?void 0:u.readRequestId);return n.createElement("section",{"aria-label":"Feedback report state"},n.createElement("button",{type:"button",className:"a-soft","data-action":t.state==="closed"?"feedback.reopen":"feedback.close",disabled:r||["queued","sending"].includes(d==null?void 0:d.status)||h,onClick:m},p?"Check state change":t.state==="closed"?"Reopen my report":"Close my report"),d&&n.createElement("p",{role:"status"},d.message," Refresh the report to review its current state."),i&&n.createElement("p",{role:"alert"},i))}function xq({state:e,act:t}){var I,F,z,U,H,te,j;const a=(((I=e.feedback)==null?void 0:I.requests)||[]).filter(_=>_.status==="submitted"),r=(F=e.view)==null?void 0:F.feedbackFollowupDraft,[o,i]=v.useState(r||{feedbackId:"",body:""}),[s,l]=v.useState(""),[c,u]=v.useState(!1),d=v.useRef(o),p=v.useRef(!1),m=v.useRef(!1),h=v.useRef(null),f=v.useRef(null);v.useEffect(()=>()=>{clearTimeout(h.current),p.current&&A().catch(()=>{})},[]),v.useEffect(()=>{r&&!p.current&&!m.current&&(d.current=r,i(r))},[r]);const g=o.pending,y=g&&(((z=e.feedback)==null?void 0:z.followups)||[]).find(_=>_.requestId===g.requestId),E=y||(((U=e.feedback)==null?void 0:U.followups)||[]).find(_=>_.requestId===o.submittedRequestId&&_.feedbackId===o.feedbackId&&_.status==="submitted");v.useEffect(()=>{var _;(y==null?void 0:y.status)!=="submitted"||((_=d.current.pending)==null?void 0:_.requestId)!==y.requestId||(l(""),C({feedbackId:d.current.feedbackId,body:"",submittedRequestId:y.requestId}).catch(()=>l("The comment was sent, but the cleared draft could not be saved. Reconnect and try again.")))},[y==null?void 0:y.status,y==null?void 0:y.requestId]);const b=(((H=e.feedback)==null?void 0:H.followups)||[]).find(_=>{var P;return _.feedbackId===o.feedbackId&&_.requestId===((P=e.feedback)==null?void 0:P.readRequestId)}),S=((j=(te=e.feedback)==null?void 0:te.report)==null?void 0:j.feedbackId)===o.feedbackId?e.feedback.report:null,w=c||["queued","sending"].includes(y==null?void 0:y.status),N=["submitted","unknown","failed"].includes(y==null?void 0:y.status);function x(_){p.current=!0,d.current={...d.current,..._},i(d.current),clearTimeout(h.current),h.current=setTimeout(()=>A().catch(()=>l("The draft could not be saved.")),250)}async function A(){if(clearTimeout(h.current),f.current)return await f.current,A();if(!p.current)return;const _=d.current,P=t("view.update",{patch:{feedbackFollowupDraft:_}});f.current=P;try{const G=await P;if(!G||G.accepted===!1)throw Error("The draft could not be saved.");d.current===_&&(p.current=!1)}finally{f.current=null}if(p.current)return A()}async function C(_){d.current=_,p.current=!0,i(_),await A()}async function O(_=1){l("");try{await C(d.current),await t("feedback.get",{requestId:crypto.randomUUID(),feedbackId:d.current.feedbackId,page:_})}catch{l("Could not load the report. Check the connection and try again.")}}async function k(_){if(_.preventDefault(),m.current||w||N)return;m.current=!0,u(!0),l("");const P=d.current.pending||{requestId:crypto.randomUUID(),feedbackId:d.current.feedbackId,body:d.current.body},G={...d.current,pending:P};d.current=G,i(G);try{await C(G),await t("feedback.comment",P)}catch{l("The comment was not acknowledged. Check the same request below; it will not post twice.")}finally{m.current=!1,u(!1)}}async function T(){const _={feedbackId:o.feedbackId,body:""};try{await C(_),d.current=_,i(_),l("")}catch{l("Could not start a new comment.")}}return a.length?n.createElement("section",{className:"a-feedback-followup","aria-label":"Feedback follow-up"},n.createElement("h3",null,"Follow up on feedback"),n.createElement("label",{htmlFor:"feedback-report"},"Submitted report"),n.createElement("select",{id:"feedback-report","data-action":"view.update",disabled:!!g||c,value:o.feedbackId,onChange:_=>x({feedbackId:_.target.value})},n.createElement("option",{value:""},"Choose a report"),a.map(_=>n.createElement("option",{key:_.requestId,value:_.requestId},_.title))),n.createElement("button",{type:"button",className:"a-soft","data-action":"feedback.get",disabled:!o.feedbackId||c||["queued","sending"].includes(b==null?void 0:b.status),onClick:()=>O()},"Refresh report"),b&&n.createElement(nt,{phase:b.status==="failed"?"error":b.status==="completed"?"success":"working",message:b.message}),S&&n.createElement("div",{className:"a-feedback-report"},n.createElement("h4",null,S.title," · ",S.state),n.createElement("a",{href:S.url,target:"_blank",rel:"noopener noreferrer"},"Open issue on GitHub"),n.createElement("pre",null,S.body),S.comments.map(_=>n.createElement("div",{key:_.id},n.createElement("strong",null,_.author.login),n.createElement("small",null," ",_.createdAt),n.createElement("pre",null,_.body))),n.createElement("div",null,S.page>1&&n.createElement("button",{type:"button",className:"a-link","data-action":"feedback.get",onClick:()=>O(S.page-1)},"Previous comments"),S.hasMore&&n.createElement("button",{type:"button",className:"a-link","data-action":"feedback.get",onClick:()=>O(S.page+1)},"More comments"))),S&&n.createElement(wq,{key:S.feedbackId,state:e,report:S,act:t}),S&&n.createElement(kq,{state:e,report:S,act:t}),n.createElement("form",{onSubmit:k,"data-action":"feedback.comment"},n.createElement("label",{htmlFor:"feedback-comment"},"Add a comment"),n.createElement("textarea",{id:"feedback-comment","data-action":"view.update",maxLength:16e3,required:!0,disabled:!!g||c,value:(g==null?void 0:g.body)??o.body,onChange:_=>x({body:_.target.value}),onBlur:()=>C(d.current).catch(()=>l("The draft could not be saved."))}),n.createElement("p",{className:"a-caption"},"Only this text is added to the selected report, using the host’s GitHub sign-in. The report must belong to that account."),E&&n.createElement(nt,{phase:E.status==="submitted"?"success":["unknown","failed"].includes(E.status)?"error":"working",message:E.message}),s&&n.createElement(nt,{phase:"error",message:s}),(E==null?void 0:E.commentUrl)&&n.createElement("a",{href:E.commentUrl,target:"_blank",rel:"noopener noreferrer"},"View comment"),(y==null?void 0:y.status)==="unknown"&&n.createElement("a",{href:y.url,target:"_blank",rel:"noopener noreferrer"},"Check the issue before starting another comment"),!N&&n.createElement("button",{type:"submit",className:"a-primary","data-action":"feedback.comment",disabled:w||!o.feedbackId||!o.body.trim()},w?"Sending…":g?"Check comment status":"Send comment"),N&&n.createElement("button",{type:"button",className:"a-soft",onClick:T},"New comment"))):null}function Sq({state:e,act:t,frozen:a,onStage:r}){var i;const o=(i=e.sessions)==null?void 0:i.find(s=>s.id===e.selectedSessionId);return o?n.createElement(Cq,{key:o.id,session:o,act:t,frozen:a,onStage:r}):null}function Cq({session:e,act:t,frozen:a,onStage:r}){var te,j;const o=(e.messages||[]).filter(_=>_.id&&["user","assistant"].includes(_.role)&&!_.streaming),[i,s]=v.useState(!1),[l,c]=v.useState(((te=o.at(-1))==null?void 0:te.id)||""),[u,d]=v.useState(((j=o.at(-1))==null?void 0:j.id)||""),[p,m]=v.useState(null),[h,f]=v.useState(""),[g,y]=v.useState(!1),[E,b]=v.useState(""),[S,w]=v.useState(!1),[N,x]=v.useState(!1),[A,C]=v.useState(!1),O=v.useRef(0),k=v.useRef(null);v.useEffect(()=>()=>{O.current++},[]);function T(){O.current++,m(null),w(!1),x(!1),b(""),C(!1),k.current=null}async function I(_=!1){var G,W;const P=++O.current;y(!0),b(""),w(!1),x(!1),k.current=null;try{const D=_?p.snapshotId:(W=(G=await t("session.export",{id:e.id,format:"markdown",destination:"none",scope:"range",minimal:!0,fromMessageId:l,throughMessageId:u}))==null?void 0:G.result)==null?void 0:W.snapshotId;if(!D)throw Error("The selected excerpt could not be prepared.");const ne=await t("feedback.excerpt.review",{id:e.id,snapshotId:D,..._?{text:h}:{}});if(!(ne!=null&&ne.result))throw Error("The excerpt or destination could not be checked. Nothing was sent.");P===O.current&&(m(ne.result),f(ne.result.text),C(!1))}catch(D){P===O.current&&b(D.message)}finally{P===O.current&&y(!1)}}async function F(){const _=++O.current;y(!0),b(""),k.current||(k.current={id:e.id,reviewId:p.reviewId,requestId:crypto.randomUUID(),acknowledgeDisclosure:!0,acknowledgeWarnings:N});try{await r(k.current),_===O.current&&(C(!0),k.current=null)}catch(P){_===O.current&&b(P.message||"The attachment was not acknowledged. Check again using the same review.")}finally{_===O.current&&y(!1)}}const z=p&&h!==p.text,U=a||g,H=o.map((_,P)=>n.createElement("option",{key:_.id+P,value:_.id},P+1,". ",_.role==="user"?"You":"Amplifier",": ",String(_.text||"").replace(/\s+/g," ").slice(0,80)));return n.createElement("section",{"aria-label":"Optional conversation excerpt"},n.createElement("button",{type:"button",className:"a-soft",disabled:U,onClick:()=>s(!i)},i?"Hide excerpt review":"Attach transcript excerpt"),i&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Optional. Starts with one message; choose only the context needed. Hidden instructions, tool payloads and file contents are excluded. Nothing uploads until you send feedback."),n.createElement("label",null,"Excerpt start",n.createElement("select",{"aria-label":"Excerpt start",value:l,disabled:U,onChange:_=>{T(),c(_.target.value)}},H)),n.createElement("label",null,"Excerpt end",n.createElement("select",{"aria-label":"Excerpt end",value:u,disabled:U,onChange:_=>{T(),d(_.target.value)}},H)),n.createElement("button",{type:"button",className:"a-soft",disabled:U||!l||!u,onClick:()=>I()},"Preview selected excerpt"),p&&n.createElement("div",{"aria-label":"Reviewed feedback excerpt"},n.createElement("p",null,n.createElement("strong",null,p.visibility==="public"?"Publicly visible on GitHub":"Private GitHub repository"),": ",p.repository,". Submitted content may remain in repository history and cannot be retracted through this app."),n.createElement("p",null,p.summary.messageCount," source messages · ",p.bytes.toLocaleString()," bytes · ",p.filename),n.createElement("p",{className:"a-caption"},p.redactions.length?p.redactions.map(_=>`${_.count} ${_.kind.toLowerCase()} redaction(s)`).join(" · "):"No additional redactions in this review."),p.warnings.map(_=>n.createElement("p",{className:"a-caption",key:_},_)),n.createElement("textarea",{"aria-label":"Edit feedback excerpt",rows:8,maxLength:64e3,value:h,disabled:U||A,onChange:_=>{O.current++,k.current=null,f(_.target.value),w(!1),x(!1)}}),z&&n.createElement("button",{type:"button",className:"a-soft",disabled:U,onClick:()=>I(!0)},"Review edited excerpt"),n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox",checked:S,disabled:U||z||A,onChange:_=>w(_.target.checked)}),"I reviewed this exact text and agree to share it with ",p.visibility==="public"?"the public":"people with access to this repository",", where it may be retained."),p.requiresExtraReview&&n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox",checked:N,disabled:U||z||A,onChange:_=>x(_.target.checked)}),"I reviewed the scope, sensitive-content warnings and automatic redactions."),n.createElement("button",{type:"button",className:"a-soft",disabled:U||z||!S||p.requiresExtraReview&&!N||A,onClick:F},A?"Excerpt attached locally":"Attach reviewed excerpt")),g&&n.createElement("p",{role:"status"},"Preparing the local excerpt and checking its destination…"),E&&n.createElement("p",{role:"alert"},E)))}const Dc=()=>({title:"",body:"",category:"bug",includeDiagnostics:!0,attachments:[],confirmExcerpts:!1,confirmedExcerpts:[]}),Nq=e=>e<1024?`${e} B`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,Rq=e=>new Promise((t,a)=>{const r=new FileReader;r.onerror=()=>a(new Error("Could not read this file.")),r.onload=()=>t(String(r.result).split(",")[1]),r.readAsDataURL(e)});function Tq({state:e,act:t}){var _e,Je,De,ue,ye;const a=(_e=e.view)==null?void 0:_e.feedbackDraft,r=v.useRef(e.selectedSessionId);r.current=e.selectedSessionId;const o=v.useRef(!0);v.useEffect(()=>(o.current=!0,()=>{o.current=!1}),[]);const[i,s]=v.useState(()=>a||Dc()),[l,c]=v.useState(!1),[u,d]=v.useState(""),[p,m]=v.useState(!1),[h,f]=v.useState(!1),[g,y]=v.useState(null),E=v.useRef(i),b=v.useRef(!1),S=v.useRef(null),w=v.useRef(!1),N=v.useRef(!1),x=v.useRef(null),A=v.useRef(null);v.useEffect(()=>()=>{clearTimeout(x.current),N.current&&j().catch(()=>{})},[]),v.useEffect(()=>{a&&!N.current&&!b.current&&(E.current=a,s(a))},[a]);const C=((Je=e.feedback)==null?void 0:Je.requests)||[],O=i.pending,k=O&&C.find(M=>M.requestId===O.requestId),T=O||i;v.useEffect(()=>{k&&["submitted","failed","unknown"].includes(k.status)&&d("")},[k==null?void 0:k.status]),v.useEffect(()=>{var M;(k==null?void 0:k.status)!=="submitted"||((M=E.current.pending)==null?void 0:M.requestId)!==k.requestId||(y(null),_(Dc()).catch(()=>d("Feedback was sent, but the cleared draft could not be saved. Reconnect and try again.")))},[k==null?void 0:k.status,k==null?void 0:k.requestId]);const I=l||["queued","sending"].includes(k==null?void 0:k.status),F=["submitted","failed","unknown"].includes(k==null?void 0:k.status),z=!!O||p,U=i.previewId,H=(i.attachments||[]).filter(M=>{var Y;return!O||((Y=O.attachmentIds)==null?void 0:Y.includes(M.id))}),te=((De=e.feedback)==null?void 0:De.issuesUrl)||"https://github.com/microsoft/amplifier-unified/issues";async function j(){if(clearTimeout(x.current),A.current)return await A.current,j();if(!N.current)return;const M=E.current,Y=t("view.update",{patch:{feedbackDraft:M}});A.current=Y;try{const se=await Y;if(!se||se.accepted===!1)throw Error("The draft could not be saved.");E.current===M&&(N.current=!1)}finally{A.current=null}if(N.current)return j()}function _(M){return E.current=M,N.current=!0,s(M),j()}function P(M){d(""),E.current={...E.current,...M},N.current=!0,s(E.current),clearTimeout(x.current),x.current=setTimeout(()=>j().catch(()=>d("The draft could not be saved. Reconnect and try again.")),250)}function G(M){P({previewId:M})}async function W(M){if(w.current||E.current.pending)throw Error("Wait for the current attachment or submission to finish.");w.current=!0,m(!0);try{if(await j(),r.current!==M.id)throw Error("The selected conversation changed. Review its excerpt again.");const Y=await t("feedback.excerpt.stage",M);if(!(Y!=null&&Y.result))throw Error("The excerpt was not attached. Check the same review again.");o.current&&r.current===M.id&&D(Y)}finally{w.current=!1,m(!1)}}function D(M){var se,Fe;const Y=(Fe=(se=M==null?void 0:M.state)==null?void 0:se.view)==null?void 0:Fe.feedbackDraft;if(Y){const je=JSON.stringify(Y.attachments)!==JSON.stringify(E.current.attachments);E.current={...E.current,attachments:Y.attachments,...je?{confirmExcerpts:!1,confirmedExcerpts:[]}:{}},s(E.current),je&&(N.current=!0,j().catch(()=>d("The updated attachment list could not be saved.")))}}async function ne(M,Y){if(!(w.current||E.current.pending)){w.current=!0,m(!0),d(""),f(!1);try{await j(),Y&&(D(await t("feedback.attachment.add",Y)),y(null));for(const se of M){if(!se.size||se.size>8*1024*1024)throw new Error("Choose nonempty files up to 8 MB each.");const Fe={requestId:crypto.randomUUID(),name:se.name||"pasted-image.png",base64:await Rq(se)};try{D(await t("feedback.attachment.add",Fe))}catch(je){throw y(Fe),je}}}catch(se){d((se==null?void 0:se.message)||"The file could not be added. Check the draft and retry; it will not be added twice.")}finally{w.current=!1,m(!1)}}}async function q(M){if(!z){d("");try{await j(),D(await t("feedback.attachment.remove",{id:M})),U===M&&G(null)}catch(Y){d((Y==null?void 0:Y.message)||"The attachment could not be removed.")}}}function Z(M){var se;const Y=Array.from(((se=M.clipboardData)==null?void 0:se.files)||[]);Y.length&&(M.preventDefault(),M.stopPropagation(),z||ne(Y))}function ie(M){var Y,se;(se=(Y=M.dataTransfer)==null?void 0:Y.types)!=null&&se.includes("Files")&&(M.preventDefault(),M.stopPropagation(),f(!1),z||ne(Array.from(M.dataTransfer.files||[])))}async function ke(M){if(M.preventDefault(),b.current||w.current||I||F||g)return;b.current=!0,c(!0),d("");const Y=E.current,se=Y.pending||{requestId:crypto.randomUUID(),title:Y.title,body:Y.body,category:Y.category,includeDiagnostics:Y.includeDiagnostics!==!1,...Y.includeDiagnostics!==!1?{deviceDiagnostics:$w(e)}:{},confirmExcerpts:Y.confirmExcerpts===!0,confirmedExcerpts:Y.confirmedExcerpts||[],attachmentIds:(Y.attachments||[]).map(Fe=>Fe.id)};try{await _({...Y,pending:se}),await t("feedback.submit",se)}catch{d("The submission was not acknowledged. Check its status using the same request below; this will not post it twice.")}finally{b.current=!1,c(!1)}}async function me(){if(!(l||p)){d(""),y(null);try{await _(Dc())}catch{d("Could not start a new draft. Reconnect and try again.")}}}return n.createElement("section",{className:`a-feedback${h?" is-dragging":""}`,"data-part":"feedback",onPaste:Z,onDrop:ie,onDragOver:M=>{var Y,se;(se=(Y=M.dataTransfer)==null?void 0:Y.types)!=null&&se.includes("Files")&&(M.preventDefault(),M.stopPropagation(),z||f(!0))},onDragLeave:M=>{M.currentTarget.contains(M.relatedTarget)||f(!1)}},n.createElement("p",null,"Send a bug report, idea, or question to ",n.createElement("a",{href:te,target:"_blank",rel:"noopener noreferrer"},"microsoft/amplifier-unified"),". Uses the host’s GitHub sign-in."),(k||u)&&n.createElement("div",{className:"a-feedback-result"},n.createElement(nt,{phase:(k==null?void 0:k.status)==="submitted"?"success":["failed","unknown"].includes(k==null?void 0:k.status)?"error":"working",message:k==null?void 0:k.message}),u&&n.createElement(nt,{phase:"error",message:u})," ",(k==null?void 0:k.url)&&n.createElement("a",{className:"a-feedback-link",href:k.url,target:"_blank",rel:"noopener noreferrer"},"View issue ",n.createElement(sa,{size:14}))," ",(k==null?void 0:k.status)==="unknown"&&n.createElement(n.Fragment,null,n.createElement("a",{href:te,target:"_blank",rel:"noopener noreferrer"},"Check repository issues ",n.createElement(sa,{size:14})),k.attachmentsUrl&&n.createElement("a",{href:k.attachmentsUrl,target:"_blank",rel:"noopener noreferrer"},"Check attachment branch ",n.createElement(sa,{size:14})))),n.createElement("form",{onSubmit:ke,"data-action":"feedback.submit"},n.createElement("label",{htmlFor:"feedback-category"},"Type"),n.createElement("select",{id:"feedback-category","data-action":"view.update",value:T.category||"bug",disabled:z,onChange:M=>P({category:M.target.value})},n.createElement("option",{value:"bug"},"Bug report"),n.createElement("option",{value:"idea"},"Feature idea"),n.createElement("option",{value:"question"},"Question"),n.createElement("option",{value:"other"},"Other feedback")),n.createElement("label",{htmlFor:"feedback-title"},"Title"),n.createElement("input",{id:"feedback-title","data-action":"view.update",maxLength:200,required:!0,disabled:z,value:T.title||"",onChange:M=>P({title:M.target.value}),placeholder:"A short description"}),n.createElement("label",{htmlFor:"feedback-body"},"Details"),n.createElement("textarea",{id:"feedback-body","data-action":"view.update",maxLength:16e3,rows:4,required:!0,disabled:z,value:T.body||"",onChange:M=>P({body:M.target.value}),placeholder:"What happened, what you expected, or what you’d like to do…","aria-describedby":T.category==="bug"?"feedback-reproduction-help":void 0}),T.category==="bug"&&n.createElement("p",{id:"feedback-reproduction-help",className:"a-caption"},"What action triggered it? Was this a new chat or an existing one? Describe what you expected, what happened, and whether it repeats. Leave out private conversation text and credentials."),n.createElement("div",{className:"a-feedback-files","aria-label":"Feedback attachments"},n.createElement("input",{ref:S,type:"file",multiple:!0,hidden:!0,disabled:z,"aria-label":"Choose feedback files",onChange:M=>{const Y=Array.from(M.target.files||[]);M.target.value="",ne(Y)}}),!O&&n.createElement("button",{type:"button",className:"a-soft a-feedback-add-files","data-action":"feedback.attachment.add",disabled:p||!!g,onClick:()=>{var M;return(M=S.current)==null?void 0:M.click()}},n.createElement(Fu,{size:16}),p?"Adding files…":"Add files or images"),!O&&n.createElement("p",{className:"a-caption"},"Or drop files here, or paste an image. Up to 8 files, 8 MB each, 24 MB total."),!!H.length&&n.createElement("ul",null,H.map(M=>{var Y;return n.createElement("li",{key:M.id},n.createElement("button",{type:"button",className:"a-feedback-file-preview","data-action":"view.update",disabled:p,"aria-label":`Preview ${M.name}`,onClick:()=>G(U===M.id?null:M.id)},(Y=M.mime)!=null&&Y.startsWith("image/")&&/^[a-f0-9]{32}$/.test(M.id)?n.createElement("img",{src:`/api/attachments/${M.id}`,alt:""}):n.createElement(ql,{size:22}),n.createElement("span",null,n.createElement("strong",null,M.name),n.createElement("small",null,Nq(M.size)," · ",O?"Included":M.excerpt?`Reviewed excerpt · ${M.excerpt.visibility}`:"Ready to include"))),!O&&n.createElement("button",{type:"button",className:"a-icon","data-action":"feedback.attachment.remove","aria-label":`Remove ${M.name}`,disabled:p,onClick:()=>q(M.id)},n.createElement(nn,{size:16})))})),H.filter(M=>M.id===U&&/^[a-f0-9]{32}$/.test(M.id)).map(M=>{var Y,se;return n.createElement("div",{className:"a-feedback-preview",key:M.id},(Y=M.mime)!=null&&Y.startsWith("image/")?n.createElement("img",{src:`/api/attachments/${M.id}`,alt:`Preview of ${M.name}`}):n.createElement(ql,{size:32}),n.createElement("a",{href:`/api/attachments/${M.id}`,download:M.name},(se=M.mime)!=null&&se.startsWith("image/")?n.createElement(Wk,{size:14}):n.createElement(ql,{size:14}),"Open ",M.name))}),g&&n.createElement("div",{className:"a-feedback-upload-retry"},n.createElement("button",{type:"button",className:"a-soft",disabled:p,onClick:()=>ne([],g)},"Check attachment: ",g.name),n.createElement("button",{type:"button",className:"a-soft",disabled:p,onClick:()=>{y(null),d("")}},"Stop retrying"))),!O&&n.createElement(Sq,{state:e,act:t,frozen:z,onStage:W}),H.some(M=>M.excerpt)&&n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox",checked:T.confirmExcerpts===!0,disabled:z,onChange:M=>P({confirmExcerpts:M.target.checked,confirmedExcerpts:M.target.checked?H.filter(Y=>Y.excerpt).map(Y=>({id:Y.id,sha256:Y.excerpt.sha256})):[]})}),"Include the reviewed conversation excerpts listed above when I send this feedback."),n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:T.includeDiagnostics!==!1,disabled:z,onChange:M=>P({includeDiagnostics:M.target.checked})}),"Include reproduction diagnostics"),T.includeDiagnostics!==!1&&n.createElement(Qf,{key:k?`receipt:${k.requestId}`:e.selectedSessionId||"current",state:e,act:t,requestId:k==null?void 0:k.requestId,device:O==null?void 0:O.deviceDiagnostics}),n.createElement("p",{className:"a-caption"},"Your text, selected diagnostics and the files listed above are sent when you submit. Files stay in repository history and are linked from the issue. Reviewed excerpts use the visibility shown during review; other file uploads require a private repository; your GitHub sign-in needs repository Contents write access. Chats, paths, provider settings, and credentials are not attached automatically."),n.createElement("div",{className:"a-dialog-actions"},!F&&n.createElement("button",{type:"submit",className:"a-primary","data-action":"feedback.submit",disabled:I||p||!!g||H.some(M=>M.excerpt)&&!T.confirmExcerpts||!((ue=T.title)!=null&&ue.trim())||!((ye=T.body)!=null&&ye.trim())},n.createElement(cx,null),I?"Sending…":O?"Check submission":"Send feedback"),(F||O&&!l)&&n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:me},n.createElement(Ln,null),"New feedback"))),!!C.filter(M=>M.requestId!==(O==null?void 0:O.requestId)).length&&n.createElement("div",{className:"a-feedback-recent"},n.createElement("h3",null,"Submissions"),C.filter(M=>M.requestId!==(O==null?void 0:O.requestId)).map(M=>{var Y;return n.createElement("div",{key:M.requestId,className:"a-feedback-receipt"},n.createElement("strong",null,M.title),n.createElement(nt,{phase:M.status==="submitted"?"success":["failed","unknown"].includes(M.status)?"error":"working",message:M.message}),M.url&&n.createElement("a",{href:M.url,target:"_blank",rel:"noopener noreferrer"},"View issue ",n.createElement(sa,{size:14})),n.createElement(Qf,{state:e,act:t,requestId:M.requestId}),M.status==="unknown"&&n.createElement("a",{href:te,target:"_blank",rel:"noopener noreferrer"},"Check repository issues"),(((Y=e.attention)==null?void 0:Y.items)||[]).filter(se=>se.requestId===M.requestId&&!se.read).map(se=>n.createElement("button",{key:se.id,className:"a-link",type:"button","data-action":"attention.read",onClick:()=>br(t,[se])},"Mark reviewed")))})),n.createElement(Eq,{state:e,act:t}),n.createElement(xq,{state:e,act:t}))}function Qf({state:e,act:t,requestId:a,device:r}){const[o,i]=v.useState(null),[s,l]=v.useState(!1),[c,u]=v.useState(""),d=v.useRef(!1),p=v.useRef(!1),m=v.useRef(!0);v.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]);async function h(){if(!d.current){d.current=!0,l(!0),u("");try{const f=await t("feedback.diagnostics",a?{requestId:a}:{deviceDiagnostics:r||$w(e)});if(!(f!=null&&f.result))throw Error("Unavailable");m.current&&(i(f.result),p.current=!0)}catch{m.current&&u("Diagnostics could not be loaded. Try Refresh.")}finally{d.current=!1,m.current&&l(!1)}}}return n.createElement("details",{"data-part":"feedback-diagnostics",onToggle:f=>{f.currentTarget.open&&!p.current&&h()}},n.createElement("summary",null,a?"Submitted diagnostics":"Preview reproduction diagnostics"),n.createElement("p",{className:"a-caption"},a?"This is the snapshot saved when this submission was accepted.":"Loads only when opened. This is a current preview; live status may change before you submit."," Host active component generation does not prove which code a running worker loaded. Reported online views counts device reports, not live event-stream connections. No message text, workspace paths, raw logs, or credentials."),s&&n.createElement("p",{role:"status"},"Loading diagnostics…"),c&&n.createElement("p",{role:"alert"},c),o&&(o.diagnostics?n.createElement("pre",{className:"a-state-view"},JSON.stringify(o.diagnostics,null,2)):n.createElement("p",null,"No diagnostics were saved with this submission.")),n.createElement("button",{type:"button",className:"a-soft","data-action":"feedback.diagnostics",disabled:s,onClick:()=>void h()},"Refresh diagnostics"))}function Iq({state:e,act:t}){var s,l,c,u,d,p;if(["feedback","activity"].includes((s=e.view)==null?void 0:s.panel))return null;const a=(((l=e.attention)==null?void 0:l.items)||[]).filter(m=>m.requestId&&!m.read),r=(u=(c=e.feedback)==null?void 0:c.requests)==null?void 0:u.find(m=>["queued","sending"].includes(m.status)),o=a[0],i=r||((p=(d=e.feedback)==null?void 0:d.requests)==null?void 0:p.find(m=>m.requestId===(o==null?void 0:o.requestId)));return i?n.createElement("aside",{className:"a-feedback-notice","aria-label":"Feedback status"},n.createElement("div",{role:"status"},n.createElement(nt,{phase:r?"working":i.status==="submitted"?"success":"error",message:r?"Feedback received — sending in the background.":i.message})),n.createElement("div",{className:"a-feedback-notice-actions"},n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>t("view.update",{patch:{panel:"feedback"}})},"View ",r?"status":"feedback"),i.url&&n.createElement("a",{href:i.url,target:"_blank",rel:"noopener noreferrer"},"View issue ",n.createElement(sa,{size:14})),!r&&o&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Dismiss feedback notification","data-action":"attention.read",onClick:()=>br(t,[o])},n.createElement(nn,{size:16})))):null}function Aq(e,t={}){var a;return t.preview===!0?((a=e.text)==null?void 0:a.slice(0,180))||"Your response is ready.":"Your Amplifier response is ready."}function _q(e={}){return e.desktop!==!1}function Xf(e){if(Array.isArray(e.notificationMessages))return e.notificationMessages.filter(a=>a.id&&a.sessionId&&a.role==="assistant"&&a.via==="text");const t=new Map;for(const a of e.sessions||[])for(const r of a.messages||[])r.id&&r.role==="assistant"&&r.via==="text"&&t.set(r.id,{...r,sessionId:a.id});return[...t.values()]}const bk=(e,t,a)=>e.has(t)||a==="detailed"&&!e.has("closed:"+t);function Pq(e,t,a){const r=new Set(e),o=bk(r,t,a);return r.delete(t),r.delete("closed:"+t),r.add(o?"closed:"+t:t),r}const fr=e=>typeof e=="string"?e:e==null?"":JSON.stringify(e,null,2);function eg(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}const io=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{};function Oq(e){const t=io(e);return Object.hasOwn(t,"output")?t.output:e}function yk(e){return(typeof e=="string"?e:"").replace(/^Tool completed\. Expand any delegated actions below for their progress and results\.\s*/,"")}const La=(e,t)=>t.map(a=>e[a]).find(a=>typeof a=="string"&&a.length)||"",Tr=e=>fr(e).replace(/\s+/g," ").slice(0,180);function Mq(e,t=e.input,a=e.output){const r=eg(t),o=io(r),i=eg(a),s=Oq(i),l=io(s),c=String(e.tool||e.label||"Tool"),u=c.toLowerCase().replace(/.*[.:/]/,""),d=e.status||e.phase,p=["running","working","starting","pending","queued","retrying"].includes(d),m=["error","failed","cancelled","interrupted"].includes(d)||io(i).success===!1,h=["completed","complete","success","done"].includes(d)&&!m,f=La(o,["file_path","path","filename"]),g=La(o,["command","cmd"]),y=La(o,["patch","diff"])||La(l,["diff","patch"])||(/apply_patch/.test(u)&&typeof r=="string"?r:""),E=La(o,["old_string","old_text"]),b=La(o,["new_string","new_text"]),S=Array.isArray(o.todos)?o.todos:Array.isArray(l.todos)?l.todos:null,w=yk(e.summary||e.detail),N=w.replace(new RegExp(`^(?:Completed|Running|Failed) ${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?: · )?`),""),x=l.returncode??l.exit_code??l.exitCode,A=(O,k,T)=>h?O:p?k:T,C={tool:c,input:r,args:o,result:i,output:s,out:l,phase:d,running:p,failed:m,done:h,path:f,exit:x,preview:Tr(N)};if(g)return{...C,kind:"command",title:A("Ran","Running","Run"),target:g,command:g,preview:typeof l.stdout=="string"?Tr(l.stdout.trim().split(` -`).filter(Boolean).at(-1))+(x!=null?` · exit ${x}`:""):Tr(s)};if(y||/edit_file|apply_patch/.test(u)&&(E||b)){const O=y||["@@",...E.split(` +amplifier-unified continue --resume SESSION_ID "Continue the work"`),n.createElement("p",{className:"a-caption"},"Use --bundle to choose a bundle and --provider / --model to select a model. JSON output is suitable for scripts; json-trace also includes execution events. Headless runs cannot answer an interactive approval prompt.")),n.createElement(Pa,{id:"repair",title:"Backup and repair",state:e,act:t},n.createElement("p",null,"Save a full private backup of your configuration, credentials, and conversations, or repair installed runtime dependencies. Repair waits until work is idle."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","aria-busy":l("maintenance.backup")||void 0,"data-action":"maintenance.backup",disabled:s,onClick:()=>t("maintenance.backup")},"Create full backup"),n.createElement("button",{className:"a-soft","aria-busy":l("maintenance.repair")||void 0,"data-action":"maintenance.repair",disabled:s,onClick:()=>t("maintenance.repair")},"Repair runtime")),n.createElement("p",{className:"a-caption"},"Backups contain credentials and are not encrypted. Keep them private."),((b=e.maintenance)==null?void 0:b.backup)&&n.createElement("p",{className:"a-caption a-wrap"},"Saved backup: ",e.maintenance.backup),((S=e.maintenance)==null?void 0:S.detail)&&n.createElement("p",null,e.maintenance.detail)),n.createElement(Pa,{id:"reset",title:"Advanced recovery",state:e,act:t},n.createElement("p",null,"Reset selected app data when ordinary repair is not enough. Your workspace files and original CLI data are kept."),[["runtime","Rebuild installed runtime"],["cache","Clear downloaded bundle and module caches"],["settings","Reset app configuration and credentials"],["conversations","Remove saved conversations from the app"]].map(([N,x])=>n.createElement("label",{className:"a-inline-checkbox",key:N},n.createElement("input",{type:"checkbox",checked:d.includes(N),"data-action":"view.update",onChange:A=>c({resetParts:A.target.checked?[...d,N]:d.filter(C=>C!==N),resetConfirmation:""})}),x)),n.createElement("button",{className:"a-soft",disabled:s||!d.length,"aria-busy":l("maintenance.reset")||void 0,"data-action":"maintenance.reset",onClick:()=>t("maintenance.reset",{parts:d})},"Preview selected reset"),m&&n.createElement("div",{className:"a-selection-card"},n.createElement("p",null,"These locations will be moved into a recovery folder:"),n.createElement("ul",{className:"a-catalog-list"},(p.paths||[]).map((N,x)=>n.createElement("li",{className:"a-wrap",key:x},n.createElement("code",null,typeof N=="string"?N:JSON.stringify(N))))),n.createElement("label",{htmlFor:"reset-confirmation"},"Type RESET to apply this selection"),n.createElement("input",{id:"reset-confirmation",value:o.resetConfirmation||"","data-action":"view.update",onChange:N=>c({resetConfirmation:N.target.value})}),n.createElement("button",{className:"a-soft a-danger",disabled:s||o.resetConfirmation!=="RESET","aria-busy":l("maintenance.reset")||void 0,"data-action":"maintenance.reset",onClick:()=>t("maintenance.reset",{parts:d,apply:!0,confirmation:o.resetConfirmation})},"Apply selected reset")),((w=e.maintenance)==null?void 0:w.retained)&&n.createElement("p",{className:"a-caption a-wrap"},"Original files retained at: ",e.maintenance.retained)))}function BD(e={},t={}){var b,S,w,N,x,A,C,O,k,T,I,F,z,q,W;const a=e.application||(e.items||[]).find(X=>X.kind==="app")||{},r=e.sequence||{},o=(e.items||[]).filter(X=>X.kind!=="app"&&X.id!=="application"),i=o.filter(X=>["check_failed","local_changes"].includes(X.status)),s=Math.max(o.filter(X=>X.status==="update").length,(((b=r.included)==null?void 0:b.available)||0)+(((S=r.other)==null?void 0:S.available)||0)),l=a.status==="update",c=l||s>0||!!e.pendingApp||!!e.pendingRelease,u=l&&a.canInstall===!1||e.pendingReplacement!=null||!!e.pendingRestart||!!(r.stage==="included"&&((w=r.included)!=null&&w.issues)),d=e.pendingReplacement!=null||!!e.error||["error","interrupted"].includes(e.phase)||((N=e.pendingRestart)==null?void 0:N.requestStatus)==="rejected"||a.status==="check_failed"||!!(r.stage==="included"&&((x=r.included)!=null&&x.issues)),p=["checking","staging","validating","activating"].includes(e.phase),m=r.nextStage||r.stage||"application",h=(A=e.diagnostics)==null?void 0:A.batch,f=(h==null?void 0:h.attemptId)===((C=e.diagnostics)==null?void 0:C.attemptId)?h:null,g=e.probeProgress,E=f&&(g==null?void 0:g.attemptId)===f.attemptId&&e.phase==="validating"&&Number.isInteger(g.total)&&Number.isInteger(g.completed)&&g.total>=0&&g.completed>=0&&g.completed<=g.total?g:null,y={stage:m,installable:c,blocked:u,busy:p||!!r.nextStage||e.pendingReplacement!=null,continuing:!!r.install,currentBatch:f,currentProgress:E,completedBatches:(((O=e.diagnostics)==null?void 0:O.completedBatches)||[]).slice(-5),title:"Check for updates",detail:"We’ll check Amplifier and the components it uses.",tone:"neutral"};if(d)return{...y,title:"Updates need attention",tone:"error",detail:e.pendingReplacement!=null?"The installation needs verification before work can continue. Open details for the recovery steps.":e.pendingRestart?"The app update needs help finishing its restart. Open details for the next step.":(k=r.included)!=null&&k.issues?"Some required components could not be updated. Your existing configuration is preserved. Review the issue below.":"The update could not finish. Review the issue below before trying again."};if(e.pendingRestart)return{...y,title:e.pendingRestart.requestStatus==="uncertain"?"Waiting for restart confirmation":"Restarting Amplifier",detail:"Waiting for a healthy restarted app before continuing with the remaining updates.",tone:"working"};if(e.pendingRelease&&((T=e.plan)==null?void 0:T.activation)==="per-worker")return{...y,title:"Making components available",detail:"New work will use the prepared components. Active conversations keep their current version until their work finishes.",tone:"working"};if(e.pendingApp||e.pendingRelease||(I=e.pendingSmartTools)!=null&&I.length)return{...y,title:"Waiting for your work to finish",detail:"The update is ready. It will continue automatically when conversations, tools, and calls are idle.",tone:"working"};if(p){const X=E?`${E.phase==="prepare"?"Preparing":"Checking"} configurations: ${E.completed} of ${E.total} completed. Failed checks do not count as completed.`:null;return{...y,title:e.phase==="checking"?"Checking for updates":(f==null?void 0:f.kind)==="smart-tools"?"Updating Smart Tools":m==="application"?"Updating Amplifier":m==="included"?"Updating included components":"Updating other components",detail:X||e.detail||(e.phase==="checking"?m==="application"?"Checking for a new app version first.":m==="included"?"Checking included components…":"Checking other components…":"Preparing and verifying the update…"),tone:"working"}}return r.nextStage||r.install&&c?{...y,title:"Updating Amplifier",detail:m==="included"?"Continuing with included components…":"Continuing with other components…",tone:"working"}:c?{...y,title:"Updates available",detail:(l?String(a.current||"").replace(/^v/,"")===String(a.latest||"").replace(/^v/,"")?"App component updates are ready. ":"A new app version is ready. ":"")+(s?`${s} component ${s===1?"update is":"updates are"} ${l?"also ":""}ready. `:"")+(t.autoInstall!==!1?"Component updates prepare automatically. App restarts wait for work to finish.":"One update request handles the app and all eligible components."),tone:"available"}:i.length||(F=r.included)!=null&&F.issues||(z=r.other)!=null&&z.issues?{...y,title:"Some updates need attention",detail:"No installable updates remain, but some checks or local changes need review.",tone:"error"}:r.stage==="complete"?{...y,title:"You’re up to date",detail:(q=r.included)!=null&&q.protected||(W=r.other)!=null&&W.protected?"All eligible updates are complete. Pinned versions and local overrides were kept.":"Amplifier and its eligible components are up to date.",tone:"ready"}:a.status==="release_channel_needed"?{...y,title:"Automatic app updates aren’t configured",detail:"This installation needs a release channel. Component updates and technical details are available below."}:e.lastCheck?{...y,title:"App checked · components not fully checked",detail:"Run a check to confirm the full update status."}:y}const HD={"candidate-install":"Prepare application","candidate-probe":"Check candidate package","candidate-version":"Check candidate version","candidate-record":"Save candidate validation","target-discovery":"Find active installation","runtime-close":"Stop idle runtimes","recovery-record":"Save recovery reference","replacement-install":"Install application","replacement-probe":"Check installed package","replacement-version":"Check installed version","restart-configuration":"Prepare restart settings","restart-helper-file":"Prepare restart helper","restart-helper":"Start restart helper","service-restart":"Restart system service","service-restart-request":"Request service restart","restart-request":"Request restart","restart-readiness":"Check restarted host readiness","restart-ack":"Confirm restarted version","restart-reconcile":"Verify current installation","activation-validation":"Check staged release","ecosystem-copy":"Prepare ecosystem copy","ecosystem-source-preflight":"Check cached source changes","ecosystem-runtime-preflight":"Check installed worker sources","ecosystem-runtime-lock":"Resolve worker dependencies","ecosystem-runtime-policy":"Prepare worker installer policy","ecosystem-runtime-freeze":"Record qualified worker","ecosystem-runtime-freeze-install":"Verify recorded worker","ecosystem-validation":"Validate ecosystem","ecosystem-fetch":"Fetch source update","ecosystem-checkout":"Switch staged source","ecosystem-probe":"Check bundles and modules","ecosystem-prepare":"Prepare bundle dependencies","ecosystem-compatibility":"Check frozen bundle compatibility","smart-tool-stage":"Prepare Smart Tool update","smart-tool-activate":"Verify and activate Smart Tool","ecosystem-activation":"Activate ecosystem","ecosystem-stage":"Prepare ecosystem",stage:"Prepare application update"},Uf={"host-component-conflict":"App behavior module identities conflict. Review duplicate module declarations and instance IDs in Bundles & modules; the current ecosystem is preserved.","module-prepare-failed":"A module could not be prepared in the new worker. The current ecosystem is preserved; review its dependencies before retrying.","bundle-not-found":"A configured bundle could not be found. Review its registration in Bundles & modules.","bundle-load-failed":"A configured bundle could not be loaded. Review its source and dependencies in Bundles & modules.","bundle-validation-failed":"A configured bundle did not pass validation. Review its configuration before retrying.","bundle-dependency-failed":"A bundle dependency could not be prepared. Review its source and dependency configuration.","protected-runtime-source":"Local source changes or an explicit dependency override were preserved. Review this module in Bundles & modules and preserve its source configuration before checking for updates again.","runtime-source-changed":"Worker sources changed while checking. Let source changes finish, then check for updates again."},VD={started:"Running",accepted:"Accepted",rejected:"Rejected",uncertain:"Unconfirmed",succeeded:"Succeeded",failed:"Failed",interrupted:"Interrupted"},jf=["failed","interrupted","rejected"],As=e=>HD[e]||(e==null?void 0:e.replaceAll("-"," "))||"Update";function WD(e,t){const a=["id","at","attemptId","kind","phase","status","revision","commandId","durationMs","exitCode","stdoutBytes","stderrBytes","errorType","timedOut","expectedVersion","observedVersion","expectedRevision","observedRevision","reason","package"],r=i=>{if(!i)return;const s=Object.fromEntries(a.filter(l=>i[l]!==void 0).map(l=>[l,i[l]]));return i.probe&&(s.probe=Object.fromEntries(["ok","isolated","packageInEnvironment","frontendPresent","loginAvailable","standalone","providersPresent","cliAbsent","dependenciesPrepared","stage","errorType","version","pythonVersion","reason"].filter(l=>i.probe[l]!==void 0).map(l=>[l,i.probe[l]]))),s},o=t?Object.fromEntries(["attemptId","version","revision","verifiedAt"].filter(i=>t[i]!==void 0).map(i=>[i,t[i]])):void 0;return JSON.stringify({attemptId:e.attemptId,lastFailure:r(e.lastFailure),reconciliation:o,events:(e.events||[]).slice(-50).map(r)},null,2)}function nk(e){var o;const t=e.reconciliation,a=(o=e.diagnostics)==null?void 0:o.lastFailure,r=e.application||(e.items||[]).find(i=>i.kind==="app")||{};return!!(a!=null&&a.attemptId&&(t==null?void 0:t.attemptId)===a.attemptId&&Number.isFinite(t.verifiedAt)&&t.verifiedAt>0&&typeof t.version=="string"&&t.version===r.current&&(!r.runningRevision||t.revision===r.runningRevision)&&!e.error&&!e.pendingRestart&&!e.pendingApp&&e.pendingReplacement==null)}function di(e){var a,r,o,i;const t=[];return e.package&&t.push(e.package),Uf[e.reason||((a=e.probe)==null?void 0:a.reason)]&&t.push(Uf[e.reason||((r=e.probe)==null?void 0:r.reason)]),(o=e.probe)!=null&&o.errorType?t.push(e.probe.errorType):e.errorType&&t.push(e.errorType),(i=e.probe)!=null&&i.stage&&e.probe.stage!=="complete"&&t.push("Probe: "+e.probe.stage),e.timedOut&&t.push("Timed out"),e.exitCode!==void 0&&t.push("Exit "+e.exitCode),e.expectedVersion&&t.push("Expected "+e.expectedVersion),e.observedVersion&&t.push("Found "+e.observedVersion),e.expectedRevision&&t.push("Expected revision "+e.expectedRevision.slice(0,12)),e.observedRevision&&t.push("Found revision "+e.observedRevision.slice(0,12)),e.durationMs!==void 0&&t.push(e.durationMs<1e3?e.durationMs+" ms":(e.durationMs/1e3).toFixed(1)+" s"),t.join(" · ")}function ZD({state:e}){var o,i;const t=e.updates||{},a=(o=t.diagnostics)==null?void 0:o.lastFailure;return!a||nk(t)?null:a.attemptId&&((i=t.diagnostics)==null?void 0:i.attemptId)&&a.attemptId!==t.diagnostics.attemptId&&!t.error&&["checking","staging","validating","staged","activating"].includes(t.phase)?n.createElement("p",{className:"a-caption",role:"status"},"A previous attempt failed. This is a different update attempt; its progress is shown above. The earlier failure remains in update details."):n.createElement("div",{className:"a-update-failure",role:"alert"},n.createElement(zn,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,"Last update did not finish: ",As(a.phase)),n.createElement("p",null,a.phase==="target-discovery"?"This installation cannot be replaced by the in-app updater. Ask the person who runs Amplifier to update this installation.":di(a)||"Open Component updates & details for the failure receipt.")))}function JD({state:e,act:t}){var m,h;const a=e.updates||{},r=a.diagnostics||{},o=r.lastFailure,i=r.events||[];if(!i.length&&!o)return null;const s=!!((h=(m=e.view)==null?void 0:m.maintenanceDraft)!=null&&h.updateDiagnosticsExpanded),l=i.filter(f=>f.attemptId===r.attemptId),c=l.filter(f=>f.status!=="started"||!l.some(g=>g.commandId&&g.commandId===f.commandId&&g.status!=="started")),u=nk(a),d=i.find(f=>f.attemptId===((o==null?void 0:o.attemptId)||r.attemptId)&&jf.includes(f.status))||o,p=u?Pt:zn;return n.createElement("div",{className:"a-update-diagnostics","data-part":"update-diagnostics"},o&&n.createElement("div",{className:"a-update-failure"+(u?" resolved":""),role:"status"},n.createElement(p,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,u?"Previous update issue resolved":"Last update issue",": ",As(o.phase)),n.createElement("p",null,u?"The current installation is verified healthy. The original failure remains in the receipt for reference.":di(o)||"The phase did not finish. Review the receipt before retrying."),n.createElement("span",{className:"a-caption"},"Attempt ",n.createElement("code",null,o.attemptId||"Not recorded")))),n.createElement("button",{type:"button",className:"a-link a-update-diagnostics-toggle","data-action":"view.update","aria-expanded":s,onClick:()=>{var f;return t("view.update",{patch:{maintenanceDraft:{...(f=e.view)==null?void 0:f.maintenanceDraft,updateDiagnosticsExpanded:!s}}})}},s?n.createElement(el,null):n.createElement(en,null),s?"Hide update details":"View update details"),s&&n.createElement("div",{className:"a-update-diagnostic-details"},d&&d.id!==(o==null?void 0:o.id)&&n.createElement("p",{className:"a-caption"},u?"First historical issue":"First recorded issue",": ",As(d.phase)," · ",di(d)),r.attemptId&&n.createElement("p",{className:"a-caption"},"Latest attempt ",n.createElement("code",null,r.attemptId)),n.createElement("ol",{className:"a-update-phase-list"},c.map(f=>{const g=jf.includes(f.status),E=u&&g&&f.attemptId===o.attemptId,y=f.status==="succeeded"?Pt:g?zn:Ps;return n.createElement("li",{key:f.id,className:f.status+(E?" historical":"")},n.createElement("div",null,n.createElement(y,{"aria-hidden":"true"}),n.createElement("span",null,As(f.phase)),n.createElement("span",{className:"a-update-phase-status"},VD[f.status]||f.status,E?" (historical)":"")),di(f)&&n.createElement("p",{className:"a-caption"},di(f)))})),n.createElement("label",{className:"a-caption",htmlFor:"update-diagnostic-receipt"},"Sanitized receipt — select and copy to share"),n.createElement("textarea",{id:"update-diagnostic-receipt",className:"a-update-receipt",readOnly:!0,rows:5,spellCheck:!1,value:WD(r,a.reconciliation)}),n.createElement("p",{className:"a-caption"},"Includes phase, timing, exit code and probe results. Command output, credentials, environment values and local paths are excluded.")))}const _u=(e,t)=>`release-notice:${e.version}:${t.id}`,$f=e=>String(e||"").replace(/^v/,"").split(".").map(Number),ak=(e,t)=>{const a=$f(e),r=$f(t);for(let o=0;o<3;o++)if(a[o]!==r[o])return a[o]>r[o];return!1},rk=(e,t)=>e.version===t.current?"Installed":ak(e.version,t.current)?"Upcoming":"Earlier release";function ok({notice:e}){return n.createElement(n.Fragment,null,n.createElement("strong",null,e.title),n.createElement("p",null,e.detail),n.createElement("p",null,n.createElement("b",null,"What to do:")," ",e.action))}function KD({application:e,state:t,act:a}){var i;const r=new Map((((i=t.attention)==null?void 0:i.items)||[]).map(s=>[s.id,s])),o=(e.releaseNotes||[]).flatMap(s=>s.notices.map(l=>({release:s,notice:l,item:r.get(_u(s,l))}))).filter(({item:s})=>s);return o.length?n.createElement("section",{className:"a-release-notices","aria-label":"High-impact changes"},n.createElement("h4",null,n.createElement(zn,{"aria-hidden":"true"}),"High-impact changes"),n.createElement("p",{className:"a-caption"},"Changes that may affect your settings or workflow. Notices are marked read as you view them."),o.map(({release:s,notice:l,item:c})=>n.createElement("article",{key:c.id,className:"a-release-notice"},n.createElement("span",{className:"a-caption"},"Version ",s.version," · ",rk(s,e)),n.createElement(Ui,{item:c,act:a},n.createElement(ok,{notice:l}))))):null}function YD({application:e,state:t,act:a}){var s;const r=e.releaseNotes||[],o=new Set((((s=t.attention)==null?void 0:s.items)||[]).filter(l=>l.read).map(l=>l.id)),i=/^v?\d+\.\d+\.\d+$/.test(e.latest||"")?e.latest:null;return n.createElement("section",{className:"a-release-history","aria-label":"Changelog"},n.createElement("details",{className:"a-update-disclosure"},n.createElement("summary",null,"Changelog"),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement("p",{className:"a-caption"},"Application release history · installed notes are available offline."),e.releaseNotesWarning&&n.createElement("p",{className:"a-release-notes-warning",role:"status"},e.releaseNotesWarning," ",i&&n.createElement("a",{href:"https://github.com/microsoft/amplifier-unified/releases/tag/"+i,target:"_blank",rel:"noreferrer"},"View published release")),!r.length&&n.createElement("p",{className:"a-caption"},"No release notes are included with this installation."),r.map(l=>n.createElement("details",{key:l.version,className:"a-release-entry",open:l.version===e.current||ak(l.version,e.current)},n.createElement("summary",null,n.createElement("strong",null,l.version," · ",l.title),n.createElement("span",{className:"a-caption"},rk(l,e)),l.notices.length>0&&n.createElement("span",{className:"a-release-impact"},"High impact")),n.createElement("ul",null,l.changes.map((c,u)=>n.createElement("li",{key:u},c))),l.notices.map(c=>{var u;return n.createElement("div",{key:c.id,className:"a-release-notice archived"},n.createElement(Ui,{item:(((u=t.attention)==null?void 0:u.items)||[]).find(d=>d.id===_u(l,c)),act:a},n.createElement(ok,{notice:c})),o.has(_u(l,c))&&n.createElement("span",{className:"a-release-reviewed"},n.createElement(Pt,{"aria-hidden":"true"}),"Reviewed"))}))))))}const Pu=e=>e.label.split("/").pop().replace(/^amplifier-(bundle-|module-)/,""),ik=(e,t)=>Pu(e).localeCompare(Pu(t),void 0,{sensitivity:"base",numeric:!0})||e.label.localeCompare(t.label)||String(e.ref||"").localeCompare(String(t.ref||""))||String(e.current||"").localeCompare(String(t.current||"")),Pc={update:"Update available",current:"Current",pinned:"Pinned",check_failed:"Check failed",local_changes:"Local changes",not_checked:"Not checked",release_channel_needed:"Release channel not configured",historical:"Older saved configuration"};function ri({items:e,state:t,act:a,id:r}){const[o,i,s]=xa(t,a,r,[...e].sort(ik),l=>[l.label,l.id,l.kind,l.status,l.ref,l.detail,l.usage,...l.usageEvidence||[],...(l.members||[]).flatMap(c=>[c.package,c.subdirectory,c.kind])],"Filter update sources");return n.createElement(n.Fragment,null,(e.length>6||s)&&i,n.createElement("ul",{id:r+"-list",className:"a-update-list a-source-list"},o.map(l=>{var p,m,h,f,g,E,y;const c=["check_failed","local_changes"].includes(l.status),u=l.status==="historical"?Ps:c?zn:l.status==="update"?jc:l.status==="pinned"?qu:Pt,d=(m=(p=t.attention)==null?void 0:p.items)==null?void 0:m.some(b=>b.id==="source:"+l.id&&!b.read);return n.createElement("li",{key:l.id},n.createElement("div",{className:"a-source-line"},n.createElement(u,{className:c?"a-source-warning":"a-source-status","aria-label":Pc[l.status]||l.status},n.createElement("title",null,l.detail||Pc[l.status]||l.status)),d&&n.createElement("span",{className:"a-unread-dot","aria-label":"Unread"}),n.createElement(Ui,{item:(f=(h=t.attention)==null?void 0:h.items)==null?void 0:f.find(b=>b.id==="source:"+l.id),act:a},n.createElement("strong",{title:l.label},Pu(l))),l.cacheCopies>1&&n.createElement("span",{title:"Source cache copies"},"×",l.cacheCopies),n.createElement("span",{className:"a-source-ref"},l.ref||l.kind),n.createElement("code",{title:l.current&&l.latest?l.current+" → "+l.latest:void 0},(g=l.current)==null?void 0:g.slice(0,7),l.latest&&l.latest!==l.current?" → "+l.latest.slice(0,7):"")),(((E=l.members)==null?void 0:E.length)>1||l.package)&&n.createElement("details",{className:"a-source-roles"},n.createElement("summary",null,l.packageCount?`${l.packageCount} package${l.packageCount===1?"":"s"} · `:"","Source details"),n.createElement("p",{className:"a-caption"},l.label),n.createElement("ul",null,(l.members||[l]).map(b=>n.createElement("li",{key:b.id},n.createElement("strong",null,b.package||"Source cache"),b.subdirectory&&n.createElement("code",null,b.subdirectory),n.createElement("span",null,b.kind,b.usage==="unknown"?" · Usage unknown":""))))),l.usage&&n.createElement("p",{className:"a-caption"},l.usage==="configured"?"Configured: "+(l.usageEvidence||[]).join(", "):"Usage unknown; it may still be needed."),(c||l.kind==="history")&&n.createElement(nt,{phase:l.status==="check_failed"?"error":"neutral",message:l.detail||Pc[l.status]}),((y=l.sourceIssues)==null?void 0:y.length)>0&&n.createElement("ul",null,l.sourceIssues.map((b,S)=>n.createElement("li",{key:S,style:{overflowWrap:"anywhere"}},n.createElement("strong",null,b.reference||"Settings"),n.createElement("p",null,b.reason),b.workspace&&n.createElement("p",null,b.workspace),b.sessionId&&n.createElement("p",null,"Session ID: ",n.createElement("code",null,b.sessionId)),b.appSessionId&&n.createElement("button",{type:"button",className:"a-soft","data-action":"session.select",onClick:async()=>{const w=await a("session.select",{id:b.appSessionId});w&&w.accepted!==!1&&await a("view.update",{patch:{panel:null}})}},"Open conversation")))))})))}function GD({updates:e,items:t,busy:a}){const r=e.sequence||{};return n.createElement("div",{className:"a-update-summary","aria-label":"Component update summary"},[["included","Included components"],["other","Other components"]].map(([o,i])=>{const s=t.filter(d=>(d.updateTier||"other")===o),l=r[o]||{status:e.lastCheck?"current":"waiting",available:s.filter(d=>d.status==="update").length,issues:s.filter(d=>["check_failed","local_changes"].includes(d.status)).length},u=a&&e.phase==="checking"&&r.stage===o?"Checking…":l.available?`${l.available} available${l.missing?` · ${l.missing} to install`:""}${l.issues?` · ${l.issues} need attention`:""}`:l.status==="waiting"?r.stage==="application"?"After app update":o==="other"?"After included components":"Not checked":l.issues?`${l.issues} need attention`:l.protected?`${l.protected} kept as configured`:"Up to date";return n.createElement("div",{key:o},n.createElement("span",null,i),n.createElement("strong",null,u))}))}function QD({state:e,act:t}){var U,_,P,G,Z,D,ne,H;const a=(((U=e.attention)==null?void 0:U.items)||[]).filter(j=>j.page==="updates"&&!j.read),r=a.filter(j=>j.id.startsWith("release-notice:")),o=a.filter(j=>!j.id.startsWith("release-notice:")),i=e.updates||{},s=((_=e.settings)==null?void 0:_.updates)||{},l=i.pendingReplacement!=null,c=l||["checking","staging","validating","activating"].includes(i.phase),u=s.intervalHours??4,d=![1,4,8,24].includes(u),p=i.application||(i.items||[]).find(j=>j.kind==="app")||{},m=(i.items||[]).filter(j=>j.kind!=="app"&&j.id!=="application"),h=m.filter(j=>j.status==="update").sort(ik),f=m.filter(j=>["check_failed","local_changes"].includes(j.status)),g=m.filter(j=>j.usage==="unknown"),E=f.filter(j=>j.usage!=="unknown"),y=g.filter(j=>["check_failed","local_changes"].includes(j.status)),b=[["check_failed","check failed"],["local_changes","with local changes"],["update","with updates"],["pinned","pinned"],["current","current"],["not_checked","not checked"]].map(([j,ie])=>[g.filter(Ee=>Ee.status===j).length,ie]).filter(([j])=>j).map(([j,ie])=>`${j} ${ie}`).join(", ");p.status;const S=i.pendingApp||i.pendingRelease||i.pendingRestart,w=!!i.pendingRestart&&(!!i.error||["error","interrupted"].includes(i.phase)||i.pendingRestart.requestStatus==="rejected"),N=((P=i.pendingRestart)==null?void 0:P.requestStatus)==="uncertain",x=l?"failed":i.pendingRestart?w?"failed":N?"restart_pending":"restarting":i.pendingApp?i.error?"failed":"staged":p.status==="check_failed"?"failed":p.releaseBehind?"ahead":p.status||"not_checked",A={restarting:"Restarting",restart_pending:"Awaiting restarted host",staged:"Ready to restart",update:"Update available",current:"Latest release installed",failed:"Needs attention",ahead:"Ahead of published release",not_checked:"Not checked",release_channel_needed:"Release channel not configured",historical:"Older saved configuration"},C=x==="current"?Pt:x==="update"?jc:x==="failed"?zn:Ps,O=l?i.error||i.detail||"The installation outcome is unknown. Work remains paused until the qualified app and dependencies are verified on a new host.":i.pendingRestart?i.error||i.detail||(w?"The app installed, but its restart did not complete. Restart Amplifier Unified manually to continue.":"The app is installed. Waiting for a healthy restarted host before resuming work."):i.pendingApp?i.error||"The app passed validation and will restart when conversations, worker lanes, smart tools, and calls are idle.":p.detail,k=w||i.error||["error","interrupted"].includes(i.phase)?"error":i.pendingRestart||c?"working":i.phase==="installed"?"success":"neutral",T=i.error||(["error","interrupted"].includes(i.phase)?i.detail||"The update did not finish.":c||S||i.phase==="installed"?i.detail:""),I=BD(i,s),F=n.useRef(null);xg(a.filter(j=>j.id==="updates:pending"||j.id==="source:application"),t,F);const z=!!((Z=(G=e.view)==null?void 0:G.maintenanceDraft)!=null&&Z.updatesExpanded),q=c||I.busy,W=q||S?I.detail:I.blocked?"App updates for this development preview are managed by its owner.":"",X=j=>t("settings.update",{patch:{updates:j}});return n.createElement(Xt,{as:"section",name:"updates",busy:c,className:"a-updates","data-part":"updates"},n.createElement("div",{ref:F,className:"a-app-update","data-part":"application-update","aria-label":"Overall update status",role:"status","aria-live":"polite"},n.createElement("div",{className:"a-update-overall"},I.tone==="error"?n.createElement(zn,null):I.tone==="ready"?n.createElement(Pt,null):I.tone==="available"?n.createElement(jc,null):n.createElement(Ps,null),n.createElement("div",null,n.createElement("h4",null,I.title),n.createElement("p",null,I.detail))),(I.tone==="working"||I.tone==="available")&&n.createElement("div",{className:"a-update-progress","aria-label":"Update order"},[["application","App"],["included","Included components"],["other","Other components"]].map(([j,ie],Ee)=>n.createElement("span",{key:j,"data-active":I.stage===j},Ee>0&&"→ ",ie))),n.createElement("p",{className:"a-update-version-line"},"Amplifier ",p.current||"version not reported",p.latest&&p.latest.replace(/^v/,"")!==((D=p.current)==null?void 0:D.replace(/^v/,""))?" · Latest "+p.latest:"",i.lastCheck?" · Checked "+new Date(i.lastCheck*1e3).toLocaleString():""),I.currentBatch&&I.tone==="working"&&n.createElement("p",{className:"a-caption","data-part":"update-batch"},"Current batch: ",((ne=I.currentBatch.components)==null?void 0:ne.join(", "))||I.currentBatch.kind,I.currentBatch.componentCount>5?` and ${I.currentBatch.componentCount-5} more`:"",". Started ",new Date(I.currentBatch.startedAt*1e3).toLocaleTimeString(),"."),!!I.completedBatches.length&&n.createElement("div",{"data-part":"update-completed-batches"},n.createElement("h5",null,"Recently installed"),n.createElement("ul",null,I.completedBatches.map(j=>{var ie;return n.createElement("li",{key:j.attemptId},j.tier==="included"?"Included components":j.kind==="smart-tools"?"Smart Tools":j.kind==="application"?"App":"Other components"," installed at ",new Date(j.completedAt*1e3).toLocaleTimeString(),(ie=j.components)!=null&&ie.length?`: ${j.components.join(", ")}`:"",".")})),n.createElement("p",{className:"a-caption"},"Completed batches stay listed while any newly detected updates are prepared."))),I.tone!=="working"&&n.createElement(Ui,{item:a.find(j=>j.id==="updates:error"),act:t},n.createElement(nt,{phase:k,message:T})),n.createElement(ZD,{state:e}),n.createElement(Hw,null),p.canInstall===!1&&n.createElement("p",{className:"a-ai-hint",role:"status"},"This is a development preview. App updates are deployed by its owner; this preview cannot replace the installed app."),i.checkTiming&&n.createElement("p",{className:"a-caption"},"Last check: ",(i.checkTiming.elapsedMs/1e3).toFixed(1),"s · ",i.checkTiming.requests||0," lookups · ",i.checkTiming.cached||0," cached results"),n.createElement("div",{className:"a-update-controls","data-part":"update-controls"},n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:I.installable?"a-soft":"a-primary",disabled:q||!!S,"aria-describedby":W?"update-action-status":void 0,"data-action":"updates.check",onClick:()=>t("updates.check")},n.createElement(Mt,{className:q?"a-progress-spinner":void 0}),q?i.phase==="checking"?"Checking…":"Update in progress…":S?"Waiting for update…":"Check for updates"),I.installable&&(!I.continuing||I.tone==="error")&&n.createElement("button",{className:"a-primary",disabled:q||I.blocked,"aria-describedby":W?"update-action-status":void 0,"data-action":"updates.install",onClick:()=>t("updates.install")},n.createElement(wa,null),"Update Amplifier")),W&&n.createElement("p",{id:"update-action-status",role:"status",className:"a-caption"},W," ",q?"You can keep working; this page will update automatically.":""),((H=i.adoption)==null?void 0:H.pendingWorkers)>0&&n.createElement("p",{className:"a-caption"},i.adoption.pendingWorkers," active conversation workers will adopt the prepared update when their work finishes."),n.createElement("p",{className:"a-caption"},"One request handles everything in order. Prepared components are available to new work immediately. Active conversations finish their current work before switching; an app update waits for work and calls before restarting the server."),n.createElement("div",{className:"a-update-simple-options"},n.createElement("label",null,n.createElement("input",{type:"checkbox","data-action":"settings.update",checked:s.autoCheck!==!1&&s.autoInstall!==!1,onChange:j=>X(j.target.checked?{autoCheck:!0,autoInstall:!0}:{autoInstall:!1})}),"Keep Amplifier up to date automatically"),n.createElement("p",{className:"a-caption"},"Prepare eligible components automatically. App restarts wait for work to finish. Existing pins and local edits are kept.")),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Update preferences"),n.createElement("div",{className:"a-update-options"},n.createElement("label",null,n.createElement("input",{type:"checkbox","data-action":"settings.update",checked:s.autoCheck!==!1,onChange:j=>X({autoCheck:j.target.checked,...j.target.checked?{}:{autoInstall:!1}})}),"Automatically check for updates"),n.createElement("label",{htmlFor:"update-frequency"},"Check for updates"),n.createElement("select",{id:"update-frequency","data-action":"settings.update",value:d?"":u,"aria-describedby":d?"update-frequency-saved":void 0,onChange:j=>X({intervalHours:Number(j.target.value)})},d&&n.createElement("option",{value:"",disabled:!0},"Choose a new interval"),n.createElement("option",{value:"1"},"Every 1 hour"),n.createElement("option",{value:"4"},"Every 4 hours"),n.createElement("option",{value:"8"},"Every 8 hours"),n.createElement("option",{value:"24"},"Daily")),d&&n.createElement("p",{id:"update-frequency-saved",className:"a-caption"},"Your saved schedule checks every ",u," hours. It stays in effect until you choose a new interval.")))),n.createElement("details",{className:"a-update-disclosure","data-part":"ecosystem-update-details",open:I.tone==="error"||void 0},n.createElement("summary",null,I.tone==="error"?"Review update issue":"Component updates & details",n.createElement(Da,{count:o.length})),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement(zs,{state:e,act:t,page:"updates",items:o,showItems:!0}),n.createElement(GD,{updates:i,items:m,busy:c}),n.createElement("div",{className:"a-app-update-heading"},n.createElement("h4",null,"App release"),n.createElement("span",{className:"a-app-update-status "+x},n.createElement(C,{"aria-hidden":"true"}),A[x]||x)),O&&(x==="failed"?n.createElement(nt,{phase:"error",message:O}):n.createElement("p",{className:"a-caption a-wrap"},O)),n.createElement(JD,{state:e,act:t}),i.canRollback&&n.createElement("button",{className:"a-soft",disabled:c||!!S,"data-action":"updates.rollback",onClick:()=>t("updates.rollback")},n.createElement(bx,null),"Roll back ecosystem"),n.createElement("div",{"data-part":"available-updates"},n.createElement("h4",null,"Ecosystem updates ",h.length>0&&n.createElement("span",{className:"a-update-count"},h.length," available")),h.length?n.createElement(ri,{items:h,state:e,act:t,id:"available-updates"}):n.createElement("p",{className:"a-caption"},I.stage!=="complete"?"Remaining components are checked after the preceding update stage.":"No eligible component updates remain.")),!!E.length&&n.createElement("div",null,n.createElement("h4",null,"Needs attention"),n.createElement(ri,{items:E,state:e,act:t,id:"update-issues"})),!!g.length&&n.createElement("div",null,n.createElement("h4",null,"Other cached sources"),n.createElement("p",{className:"a-caption"},g.length," sources: ",b,". Usage is unknown; these files may still be needed and are kept."),!!y.length&&n.createElement(ri,{items:y,state:e,act:t,id:"unknown-source-issues"})),!!m.length&&n.createElement("div",null,n.createElement("button",{className:"a-link","aria-expanded":z,"data-action":"view.update",onClick:()=>{var j;return t("view.update",{patch:{maintenanceDraft:{...(j=e.view)==null?void 0:j.maintenanceDraft,updatesExpanded:!z}}})}},z?"Hide all sources":"Show all "+m.length+" "+(m.length===1?"source":"sources")),z&&n.createElement(ri,{items:m,state:e,act:t,id:"update-sources"})))),n.createElement("details",{className:"a-update-disclosure"},n.createElement("summary",null,"Release notices",n.createElement(Da,{count:r.length})),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement(zs,{state:e,act:t,page:"updates",items:r}),n.createElement(KD,{application:p,state:e,act:t}))),m.some(j=>j.kind==="history")&&n.createElement("details",{className:"a-update-disclosure","data-part":"historical-source-settings"},n.createElement("summary",null,"Older conversation settings"),n.createElement("div",{className:"a-update-disclosure-body"},n.createElement(ri,{items:m.filter(j=>j.kind==="history"),state:e,act:t,id:"historical-source-settings"}))),n.createElement(YD,{application:p,state:e,act:t}))}function XD({state:e,act:t}){var h;const a=(h=e.runtime)==null?void 0:h.retention,[r,o]=v.useState("32"),[i,s]=v.useState("12"),[l,c]=v.useState(!0),[u,d]=v.useState(!1);if(v.useEffect(()=>{a&&(o(String(a.max_warm_workers)),s(String(a.idle_timeout_hours)),c(a.prewarm_on_select))},[a==null?void 0:a.max_warm_workers,a==null?void 0:a.idle_timeout_hours,a==null?void 0:a.prewarm_on_select]),!a)return null;const p=r!==""&&i!==""&&Number.isInteger(Number(r))&&Number(r)>=0&&Number.isFinite(Number(i))&&Number(i)>=0;async function m(f){if(f.preventDefault(),!(!p||u)){d(!0);try{await t("runtime.retention.update",{patch:{max_warm_workers:Number(r),idle_timeout_hours:Number(i),prewarm_on_select:l}})}finally{d(!1)}}}return n.createElement("form",{id:"settings-readiness-form","aria-label":"Ready conversations",onSubmit:m},n.createElement("p",null,"Keep recently used conversations ready for their next message. These limits apply to idle conversations on this host; work in progress and pending interactions stay protected."),n.createElement("label",{htmlFor:"warm-worker-count"},"Conversations to keep ready"),n.createElement("input",{id:"warm-worker-count",type:"number",min:"0",step:"1",value:r,onChange:f=>o(f.target.value)}),n.createElement("label",{htmlFor:"warm-worker-hours"},"Hours to keep an idle conversation ready"),n.createElement("input",{id:"warm-worker-hours",type:"number",min:"0",step:"any",value:i,onChange:f=>s(f.target.value)}),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:l,onChange:f=>c(f.target.checked)}),"Prepare a conversation in the background when I select it"),n.createElement("p",{className:"a-caption"},"Setting either limit to zero releases idle conversations as soon as they settle and disables background preparation. Saved history remains available."),n.createElement(Rn,null,n.createElement("button",{form:"settings-readiness-form",type:"submit",className:"a-primary","data-action":"runtime.retention.update",disabled:!p||u},u?"Saving…":"Save readiness settings")))}function eF({results:e,run:t,busy:a,active:r}){var i;const o=e["native.status"]||e["native.compact"];return n.createElement("section",{className:"a-settings-section","data-part":"native-provider-settings"},n.createElement("h3",null,"Live direction & saved context"),n.createElement("p",null,"Check whether this model can apply new direction during a response. Other models receive it at the next request."),n.createElement("button",{className:"a-soft",disabled:a,"data-action":"runtime.control",onClick:()=>t("native.status")},"Check provider support"),o&&n.createElement(n.Fragment,null,n.createElement("p",null,o.supported?"Native direction is available for this selected model.":o.reason||"Direction is delivered at the next request."),((i=o.receipt)==null?void 0:i.outcome)==="unknown"&&n.createElement("p",{role:"alert"},"The previous request’s outcome is unknown. It was not replayed."),o.checkpoint&&n.createElement("p",null,"Saved provider context: ",o.checkpoint,"."),n.createElement("button",{className:"a-soft",disabled:a||r||!o.compactAvailable,"data-action":"runtime.control",onClick:()=>t("native.compact")},"Compact provider context"),n.createElement("p",{className:"a-caption"},"Original conversation history stays intact. Compaction makes a model request; its private provider state is never displayed.")))}const hs=e=>(e==null?void 0:e.value)==null?"Unknown":e.value.toLocaleString(void 0,{maximumFractionDigits:6});function tF({session:e,act:t}){var w,N;const[a,r]=v.useState(null),[o,i]=v.useState(null),[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(0),[m,h]=v.useState({enabled:!1,maxTotalTokens:"",maxCostUsd:"",warningFraction:.8,unknownPolicy:"pause",includeEstimatedCost:!1}),f=(x,A=!0)=>{if(r(x),!A)return;const C=x.budget;p(C.revision),h({enabled:!!C.enabled,maxTotalTokens:C.maxTotalTokens??"",maxCostUsd:C.maxCostUsd??"",warningFraction:C.warningFraction??.8,unknownPolicy:C.unknownPolicy??"pause",includeEstimatedCost:!!C.includeEstimatedCost})},g=async(x,A={})=>{l(!0),u("");try{const C=await t(x,{sessionId:e.id,...A});C!=null&&C.result?x==="capacity.quota"?i(C.result):f(C.result):C!=null&&C.error&&u(C.error)}catch(C){u(C.message)}finally{l(!1)}},E=x=>h(A=>({...A,...x})),y=(((w=e.execution)==null?void 0:w.nodes)||[]).filter(x=>x.kind==="llm").map(x=>`${x.id}:${x.revision||0}:${x.phase}`).join("|");v.useEffect(()=>{if(!a)return;let x=!1;return t("capacity.read",{sessionId:e.id}).then(A=>{!x&&(A!=null&&A.result)&&f(A.result,!1)}).catch(()=>{}),()=>{x=!0}},[y]);const b=((N=a==null?void 0:a.usage)==null?void 0:N.metrics)||{},S=!m.maxTotalTokens&&!m.maxCostUsd&&m.enabled||m.maxTotalTokens!==""&&(!Number.isInteger(Number(m.maxTotalTokens))||Number(m.maxTotalTokens)<=0)||m.maxCostUsd!==""&&!(Number(m.maxCostUsd)>0);return n.createElement("section",{className:"a-settings-section","aria-label":"Task usage and budget","data-part":"capacity-controls"},n.createElement("h3",null,"Task usage & budget"),n.createElement("p",null,"Track this conversation and its observed workers. Existing calls may finish and exceed a limit; new model calls wait when the budget is reached."),n.createElement("button",{className:"a-soft",disabled:s,"data-action":"capacity.read",onClick:()=>g("capacity.read")},"Inspect task usage"),c&&n.createElement("p",{role:"alert"},c),a&&n.createElement(n.Fragment,null,n.createElement("p",{role:"status"},"Budget ",a.admission.state," · ",a.usage.calls," recorded model calls"),a.admission.reasons.map(x=>n.createElement("p",{key:x},x)),a.admission.warnings.map(x=>n.createElement("p",{key:x},x)),n.createElement("dl",{className:"a-capability-counts"},n.createElement("div",null,n.createElement("dt",null,"Total tokens including cache writes"),n.createElement("dd",null,hs(b.grossTotalTokens)," · ",b.grossTotalTokens.status)),n.createElement("div",null,n.createElement("dt",null,"Cost (USD)"),n.createElement("dd",null,hs(b.costUsd)," · ",b.costUsd.status,b.costUsd.estimatedCalls>0?" · includes estimates":""))),n.createElement("p",{className:"a-caption"},b.grossTotalTokens.unknownCalls," calls with unknown token totals · ",b.costUsd.unknownCalls," calls with unknown cost · ",a.admission.inFlightCalls," in flight. Totals cover observed calls; missing telemetry is not zero."),n.createElement("details",null,n.createElement("summary",null,"Model breakdown and receipts"),a.usage.providers.map(x=>n.createElement("p",{key:x.provider+"|"+x.model},x.provider," / ",x.model," · ",x.calls," calls · ",hs(x.metrics.grossTotalTokens)," tokens · ",hs(x.metrics.costUsd)," USD")),n.createElement("p",{className:"a-caption"},"Receipts ",a.usage.offset+1,"–",a.usage.offset+a.usage.receipts.length," of ",a.usage.receiptCount,". Observed ",new Date(a.observedAt*1e3).toLocaleTimeString(),"."),n.createElement("pre",{className:"a-state-view"},JSON.stringify(a.usage.receipts,null,2)),a.usage.nextOffset!=null&&n.createElement("button",{className:"a-soft",disabled:s,"data-action":"capacity.read",onClick:()=>g("capacity.read",{offset:a.usage.nextOffset})},"Next receipts")),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:m.enabled,onChange:x=>E({enabled:x.target.checked})}),"Enable cumulative task budget"),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"capacity-tokens"},"Total token limit"),n.createElement("input",{id:"capacity-tokens",type:"number",min:"1",value:m.maxTotalTokens,onChange:x=>E({maxTotalTokens:x.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"capacity-cost"},"Cost limit (USD)"),n.createElement("input",{id:"capacity-cost",type:"number",min:"0.000001",step:"any",value:m.maxCostUsd,onChange:x=>E({maxCostUsd:x.target.value})}))),n.createElement("label",{htmlFor:"capacity-warning"},"Warn at percentage"),n.createElement("input",{id:"capacity-warning",type:"number",min:"1",max:"100",value:Math.round(m.warningFraction*100),onChange:x=>E({warningFraction:Number(x.target.value)/100})}),n.createElement("label",{htmlFor:"capacity-unknown"},"When settled usage is unknown"),n.createElement("select",{id:"capacity-unknown",value:m.unknownPolicy,onChange:x=>E({unknownPolicy:x.target.value})},n.createElement("option",{value:"pause"},"Pause future model calls"),n.createElement("option",{value:"allow"},"Allow calls with incomplete totals")),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:m.includeEstimatedCost,onChange:x=>E({includeEstimatedCost:x.target.checked})}),"Include attributed estimates in the cost limit"),d!==a.budget.revision&&n.createElement("p",{role:"alert"},"This budget changed. Inspect usage again before saving your changes."),n.createElement("button",{className:"a-primary",disabled:d!==a.budget.revision||s||S||!(m.warningFraction>0&&m.warningFraction<=1),"data-action":"capacity.set",onClick:()=>g("capacity.set",{...m,expectedRevision:d,maxTotalTokens:m.maxTotalTokens===""?null:Number(m.maxTotalTokens),maxCostUsd:m.maxCostUsd===""?null:Number(m.maxCostUsd)})},"Save budget"),n.createElement("p",{className:"a-caption"},"Saving updates the next admission check. It does not send a message or resume a separately paused task. Revision ",a.budget.revision,".")),n.createElement("button",{className:"a-soft",disabled:s,"data-action":"capacity.quota",onClick:()=>g("capacity.quota")},"Inspect provider quota"),o&&n.createElement("div",null,!o.providers.length&&n.createElement("p",null,"No provider quota capability is available."),o.providers.map(x=>n.createElement("div",{key:x.provider},n.createElement("p",null,x.provider,": ",x.status,x.status==="unsupported"?" · remaining capacity and reset time unknown":""),x.windows&&n.createElement("pre",{className:"a-state-view"},JSON.stringify(x.windows,null,2))))))}const nF=(e,t)=>Object.fromEntries(new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(new Date(e)).map(a=>[a.type,a.value])),Bf=(e,t)=>{const a=nF(e,t);return{startDate:`${a.year}-${a.month}-${a.day}`,localTime:`${a.hour}:${a.minute}`}};function aF({session:e,act:t}){const a=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",r=()=>({prompt:"",destination:"same_task",newTaskTitle:"Scheduled task",newTaskMaxTurns:1,kind:"monitor",recurrence:"daily",timezone:a,...Bf(Date.now()+36e5,a),intervalMinutes:60,weekdays:[0],missedRunPolicy:"latest",notificationPolicy:"changes"}),o=v.useRef(0),[i,s]=v.useState(r),[l,c]=v.useState(null),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=w=>{o.current++,s(N=>({...N,...w})),d(null)},E=()=>({prompt:i.prompt,destination:i.destination,...i.destination==="new_task"?{newTaskTitle:i.newTaskTitle,newTaskMaxTurns:Number(i.newTaskMaxTurns)}:{},kind:i.kind,missedRunPolicy:i.missedRunPolicy,notificationPolicy:i.notificationPolicy,spec:{kind:i.recurrence,timezone:i.timezone,startDate:i.startDate,localTime:i.localTime,...i.recurrence==="interval"?{intervalSeconds:Number(i.intervalMinutes)*60}:{},...i.recurrence==="weekly"?{weekdays:i.weekdays}:{}}}),y=async(w,N={})=>{m(!0);try{return await t(w,{sessionId:e.id,...N})}finally{m(!1)}},b=w=>{o.current++,c(w),d(null),s({prompt:w.prompt,destination:w.destination||"same_task",newTaskTitle:w.newTaskTitle||"Scheduled task",newTaskMaxTurns:w.newTaskMaxTurns||1,kind:w.kind,recurrence:w.spec.kind,timezone:w.spec.timezone,...w.spec.startAt?Bf(w.spec.startAt,w.spec.timezone):{startDate:w.spec.startDate,localTime:w.spec.localTime},intervalMinutes:(w.spec.intervalSeconds||3600)/60,weekdays:w.spec.weekdays||[0],missedRunPolicy:w.missedRunPolicy,notificationPolicy:w.notificationPolicy})},S=async()=>{const w=o.current,N=await y(l?"schedule.update":"schedule.create",{...E(),...l?{id:l.id}:{},expectedRevision:(l==null?void 0:l.revision)||0,previewHash:u.previewHash});N!=null&&N.accepted&&o.current===w&&(c(null),d(null),s(r()))};return n.createElement("section",{className:"a-settings-section","aria-label":"Scheduled work","data-part":"schedules"},n.createElement("h3",null,"Scheduled work"),n.createElement("p",null,"Continue this task or create a new task for each run. Each run uses normal tool permissions. Stops and changes to the reviewed configuration require schedule review."),n.createElement("button",{className:"a-soft","data-action":"schedule.list",disabled:p,onClick:()=>y("schedule.list")},"Refresh schedules"),(e.schedules||[]).map(w=>{var N;return n.createElement("article",{className:"a-selection-card",key:w.id,"data-schedule-id":w.id},n.createElement("p",null,n.createElement("strong",null,w.prompt)),n.createElement("p",null,w.destination==="new_task"?"Creates a new task for each run":"Continues this saved task"),n.createElement("p",{role:"status"},"Schedule ",w.status.replaceAll("_"," ")),w.nextDue&&w.status==="active"&&n.createElement("p",null,"Next: ",new Date(w.nextDue*1e3).toLocaleString(void 0,{timeZone:w.spec.timezone})," (",w.spec.timezone,")"),w.status==="needs_review"&&w.reviewReason&&n.createElement("p",{role:"alert"},w.reviewReason),n.createElement("p",{className:"a-caption"},"Notifications: ",w.notificationPolicy==="changes"?"changes and failures":w.notificationPolicy==="always"?"every result and failure":"failures only"," · Missed runs: ",w.missedRunPolicy==="skip"?"skip after one minute":"run only the latest occurrence"),n.createElement("div",{className:"a-dialog-actions"},w.status!=="cancelled"&&n.createElement(n.Fragment,null,n.createElement("button",{className:"a-soft",onClick:()=>b(w)},"Review schedule"),w.status==="active"&&n.createElement("button",{className:"a-soft","data-action":"schedule.pause",disabled:p,onClick:()=>y("schedule.pause",{id:w.id,expectedRevision:w.revision})},"Pause schedule"),n.createElement("button",{className:"a-soft","data-action":"schedule.cancel",disabled:p,onClick:()=>y("schedule.cancel",{id:w.id,expectedRevision:w.revision})},"Cancel schedule"))),((N=w.runs)==null?void 0:N.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Recent runs (",w.runs.length,")"),w.runs.map(x=>n.createElement("div",{key:x.id,"data-run-id":x.id},n.createElement("p",null,n.createElement("strong",null,x.phase)," · ",new Date(x.dueAt*1e3).toLocaleString()),n.createElement("p",null,x.detail),x.destinationSessionId&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Reserved task: ",x.destinationSessionId),x.creationConfirmed&&n.createElement("button",{className:"a-soft","data-action":"session.select",onClick:()=>t("session.select",{id:x.destinationSessionId})},"Open new task")),x.notificationDecision&&n.createElement("p",{className:"a-caption"},x.notificationDecision.notify?"Notification requested":"Stayed quiet"," · evidence: ",x.notificationDecision.source.replaceAll("_"," ")),x.report&&n.createElement("details",null,n.createElement("summary",null,"Reported evidence"),n.createElement("p",null,x.report.detail),"values"in x.report&&n.createElement("pre",{className:"a-state-view"},JSON.stringify(x.report.values,null,2))),x.phase==="unknown"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"schedule-evidence-"+w.id},"Reconciliation evidence"),n.createElement("textarea",{id:"schedule-evidence-"+w.id,value:h,onChange:A=>f(A.target.value)}),n.createElement("p",{className:"a-caption"},"These actions record your finding and never send the old input again. Review the schedule separately to enable future runs."),n.createElement("div",{className:"a-dialog-actions"},["abandoned","completed"].map(A=>n.createElement("button",{className:"a-soft",key:A,disabled:p||!h.trim(),"data-action":"schedule.reconcile",onClick:()=>y("schedule.reconcile",{runId:x.id,expectedRevision:x.revision,resolution:A,evidence:h.trim()})},"Mark run ",A))))))))}),n.createElement("h4",null,l?"Review this schedule":"New schedule"),n.createElement("label",{htmlFor:"schedule-destination"},"Where to run"),n.createElement("select",{id:"schedule-destination",value:i.destination,onChange:w=>g({destination:w.target.value})},n.createElement("option",{value:"same_task"},"Continue this task"),n.createElement("option",{value:"new_task"},"Create a new task for each run")),i.destination==="new_task"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"schedule-title"},"New task title"),n.createElement("input",{id:"schedule-title",value:i.newTaskTitle,onChange:w=>g({newTaskTitle:w.target.value})}),n.createElement("label",{htmlFor:"schedule-turns"},"Maximum turns in each new task"),n.createElement("input",{id:"schedule-turns",type:"number",min:"1",max:"100",value:i.newTaskMaxTurns,onChange:w=>g({newTaskMaxTurns:w.target.value})}),n.createElement("p",{className:"a-caption"},"Uses this task’s reviewed workspace, bundle and model configuration. Starts fresh without copying its conversation or objective.")),n.createElement("label",{htmlFor:"schedule-prompt"},"Saved instructions"),n.createElement("textarea",{id:"schedule-prompt",value:i.prompt,onChange:w=>g({prompt:w.target.value})}),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-kind"},"Purpose"),n.createElement("select",{id:"schedule-kind",value:i.kind,onChange:w=>g({kind:w.target.value})},n.createElement("option",{value:"monitor"},"Monitor changes"),n.createElement("option",{value:"task"},"Work on the saved instructions"))),n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-recurrence"},"Repeat"),n.createElement("select",{id:"schedule-recurrence",value:i.recurrence,onChange:w=>g({recurrence:w.target.value})},n.createElement("option",{value:"once"},"Once"),n.createElement("option",{value:"daily"},"Daily"),n.createElement("option",{value:"weekly"},"Weekly"),n.createElement("option",{value:"interval"},"At an interval"))),n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-date"},"Start date"),n.createElement("input",{id:"schedule-date",type:"date",value:i.startDate,onChange:w=>g({startDate:w.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"schedule-time"},"Local time"),n.createElement("input",{id:"schedule-time",type:"time",value:i.localTime,onChange:w=>g({localTime:w.target.value})}))),n.createElement("label",{htmlFor:"schedule-zone"},"Timezone"),n.createElement("input",{id:"schedule-zone",value:i.timezone,onChange:w=>g({timezone:w.target.value})}),i.recurrence==="interval"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"schedule-interval"},"Repeat every (minutes)"),n.createElement("input",{id:"schedule-interval",type:"number",min:"1",value:i.intervalMinutes,onChange:w=>g({intervalMinutes:w.target.value})})),i.recurrence==="weekly"&&n.createElement("div",null,["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map((w,N)=>n.createElement("label",{className:"a-inline-checkbox",key:w},n.createElement("input",{type:"checkbox",checked:i.weekdays.includes(N),onChange:x=>g({weekdays:x.target.checked?[...i.weekdays,N]:i.weekdays.filter(A=>A!==N)})}),w))),n.createElement("label",{htmlFor:"schedule-missed"},"If the app misses a run"),n.createElement("select",{id:"schedule-missed",value:i.missedRunPolicy,onChange:w=>g({missedRunPolicy:w.target.value})},n.createElement("option",{value:"latest"},"Run only the latest missed occurrence"),n.createElement("option",{value:"skip"},"Skip occurrences more than a minute late")),n.createElement("label",{htmlFor:"schedule-notify"},"Notify me"),n.createElement("select",{id:"schedule-notify",value:i.notificationPolicy,onChange:w=>g({notificationPolicy:w.target.value})},n.createElement("option",{value:"changes"},"For changes and failures"),n.createElement("option",{value:"always"},"After every result and failure"),n.createElement("option",{value:"failures_only"},"For failures only")),n.createElement("button",{className:"a-soft",disabled:p||!i.prompt.trim(),"data-action":"schedule.preview",onClick:async()=>{const w=o.current,N=await y("schedule.preview",E());o.current===w&&d((N==null?void 0:N.result)||null)}},"Preview schedule"),u&&n.createElement("div",{className:"a-selection-card","data-part":"schedule-preview"},n.createElement("h4",null,"Confirm scheduled work"),n.createElement("p",null,u.binding.prompt),u.binding.destination==="new_task"?n.createElement("div",{"data-part":"schedule-destination-preview"},n.createElement("p",null,"Create a new task for each run: ",u.binding.newTaskTitle),n.createElement("p",null,"Workspace: ",u.binding.newTaskConfiguration.workspace),n.createElement("p",null,"Bundle: ",u.binding.newTaskConfiguration.bundle),n.createElement("p",null,"Model configuration: ",JSON.stringify(u.binding.newTaskConfiguration.selection||"Bundle defaults")),n.createElement("p",null,"Maximum turns: ",u.binding.newTaskMaxTurns)):n.createElement("p",null,"Continue this saved task."),n.createElement("ul",null,u.occurrences.map(w=>n.createElement("li",{key:w.utc},new Date(w.dueAt*1e3).toLocaleString(void 0,{timeZone:u.binding.spec.timezone})," (",u.binding.spec.timezone,")"))),n.createElement("p",{className:"a-caption"},u.daylightSaving),n.createElement("p",null,"Approval applies to this saved prompt and schedule. Normal tool permissions still apply during each run."),n.createElement("button",{className:"a-primary","data-action":l?"schedule.update":"schedule.create",disabled:p||!u.occurrences.length,onClick:S},"Save and activate schedule")))}function rF({state:e,session:t,act:a}){var x,A,C,O,k;const r=((A=(x=e.runtimeControl)==null?void 0:x[t.id])==null?void 0:A["task.get"])||{},o=r.task||t.task,i=r.continuity||t.continuity,[s,l]=v.useState(""),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(""),[E,y]=v.useState(!1),[b,S]=v.useState(""),w=async(T,I={})=>{y(!0),S("");try{await a(T,{sessionId:t.id,...T==="task.get"?{}:{expectedRevision:(o==null?void 0:o.revision)||0},...I})}catch(F){S(F.message||String(F))}finally{y(!1)}},N=o&&o.status!=="completed";return n.createElement("section",{className:"a-settings-section","data-part":"task-continuity","aria-label":"Saved task"},n.createElement("h3",null,"Saved task"),n.createElement("p",null,"Keep the objective, corrections, and evidence across restarts and long conversations. Saving a task does not send a message."),n.createElement("button",{className:"a-soft",disabled:E,"data-action":"task.get",onClick:()=>w("task.get")},"Load saved task"),o&&n.createElement("div",{className:"a-selection-card"},n.createElement("p",null,n.createElement("strong",null,o.objective)),n.createElement("p",{role:"status"},"Task ",o.status," · revision ",o.revision,o.appliedRevision!==o.revision?" · applies at the next request":""),((C=o.constraints)==null?void 0:C.length)>0&&n.createElement("ul",null,o.constraints.map((T,I)=>n.createElement("li",{key:I},T))),o.status==="blocked"&&o.blockedReason&&n.createElement("p",null,"Waiting because: ",o.blockedReason),((O=o.corrections)==null?void 0:O.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Saved corrections (",o.corrections.length,")"),n.createElement("ul",null,o.corrections.map((T,I)=>n.createElement("li",{key:I},T.text)))),((k=o.completionEvidence)==null?void 0:k.length)>0&&n.createElement("ul",null,o.completionEvidence.map((T,I)=>n.createElement("li",{key:I},T))),n.createElement("details",null,n.createElement("summary",null,"Linked questions, operations, and artifacts"),["questionIds","operationIds","artifactRefs"].map(T=>{var I;return n.createElement("p",{key:T},T==="questionIds"?"Questions":T==="operationIds"?"Operations":"Artifacts",": ",((I=o[T])==null?void 0:I.join(", "))||"None")}))),!N&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"task-objective"},"Task objective"),n.createElement("textarea",{id:"task-objective",value:s,onChange:T=>l(T.target.value)}),n.createElement("label",{htmlFor:"task-constraints"},"Constraints (one per line)"),n.createElement("textarea",{id:"task-constraints",value:c,onChange:T=>u(T.target.value)}),n.createElement("button",{className:"a-primary","data-action":"task.create",disabled:E||!s.trim(),onClick:()=>w("task.create",{objective:s.trim(),constraints:c.split(` +`).map(T=>T.trim()).filter(Boolean)})},"Save task")),N&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"task-correction"},"Correction to retain"),n.createElement("textarea",{id:"task-correction",value:d,onChange:T=>p(T.target.value)}),n.createElement("button",{className:"a-soft","data-action":"task.update",disabled:E||!d.trim(),onClick:()=>w("task.update",{correction:d.trim()})},"Save correction"),n.createElement("div",{className:"a-dialog-actions"},o.status==="active"?n.createElement("button",{className:"a-soft","data-action":"task.pause",disabled:E,onClick:()=>w("task.pause")},"Pause task"):n.createElement("button",{className:"a-primary","data-action":"task.resume",disabled:E,onClick:()=>w("task.resume")},"Resume task")),n.createElement("p",{className:"a-caption"},"Pause stops future automatic continuation. Current work can finish. Resume does not send a message or answer a pending question."),n.createElement("details",null,n.createElement("summary",null,"Record a blocker or completion"),n.createElement("label",{htmlFor:"task-blocker"},"What is blocking this task?"),n.createElement("input",{id:"task-blocker",value:m,onChange:T=>h(T.target.value)}),n.createElement("button",{className:"a-soft","data-action":"task.block",disabled:E||!m.trim(),onClick:()=>w("task.block",{reason:m.trim()})},"Mark blocked"),n.createElement("label",{htmlFor:"task-evidence"},"Evidence that the objective is complete (one per line)"),n.createElement("textarea",{id:"task-evidence",value:f,onChange:T=>g(T.target.value)}),n.createElement("button",{className:"a-soft","data-action":"task.complete",disabled:E||!f.trim(),onClick:()=>w("task.complete",{condition:o.objective,evidence:f.split(` +`).map(T=>T.trim()).filter(Boolean)})},"Complete task with evidence"))),o&&r.continuationSupported===!1&&n.createElement("p",{role:"alert"},"This runtime cannot automatically continue saved tasks. Update its task support before resuming."),i&&n.createElement("p",{className:"a-caption"},"Conversation continuity: ",i.supported?i.status:"not available in this context module",i.reason?` — ${i.reason}`:"",". The original transcript remains available."),b&&n.createElement("p",{role:"alert",className:"a-danger"},b))}function oF({session:e,act:t}){var b,S;const[a,r]=v.useState("HEAD"),[o,i]=v.useState(""),[s,l]=v.useState(!1),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(!1),f=async(w,N={})=>{h(!0);try{return await t(w,{sessionId:e.id,...N})}finally{h(!1)}},g=e.worktreeInspection,E=e.workingDirectory||e.workspace,y=w=>f("worktree.handoff",{id:w,expectedExecutionRevision:e.executionRevision||0});return n.createElement("section",{className:"a-settings-section","aria-label":"Task worktrees","data-part":"worktrees"},n.createElement("h3",null,"Task execution folder"),n.createElement("p",null,"Run this task in a separate Git checkout while keeping its saved conversation, voice history, artifacts and settings in their original home."),n.createElement("dl",null,n.createElement("dt",null,"Saved history and settings home"),n.createElement("dd",{className:"a-state-view"},e.workspace),n.createElement("dt",null,"Execution host"),n.createElement("dd",{"data-part":"execution-host"},((b=g==null?void 0:g.executionHost)==null?void 0:b.label)||((S=e.executionHost)==null?void 0:S.label)||"Inspect to identify this local host"),n.createElement("dt",null,"Execution folder"),n.createElement("dd",{className:"a-state-view","data-part":"execution-directory"},E)),n.createElement("button",{className:"a-soft",disabled:m,"data-action":"worktree.inspect",onClick:()=>f("worktree.inspect")},"Inspect repository"),E!==e.workspace&&n.createElement("button",{className:"a-soft",disabled:m||e.configurationBusy,"data-action":"worktree.handoff",onClick:()=>y(null)},"Return execution to home"),(g==null?void 0:g.repository)&&n.createElement(n.Fragment,null,n.createElement("p",null,g.repository.branch||"Detached commit"," · ",g.repository.dirty?"Uncommitted changes present":"Checkout clean"),n.createElement("details",null,n.createElement("summary",null,"Source changes"),n.createElement("pre",{className:"a-state-view"},g.repository.status||"No changes")),n.createElement("h4",null,"Create a checkout"),n.createElement("label",{htmlFor:"worktree-ref"},"Starting Git ref or commit"),n.createElement("input",{id:"worktree-ref",value:a,onChange:w=>r(w.target.value)}),n.createElement("label",{htmlFor:"worktree-branch"},"New branch (optional)"),n.createElement("input",{id:"worktree-branch",value:o,onChange:w=>i(w.target.value)}),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:s,onChange:w=>l(w.target.checked)}),"Include my uncommitted changes"),n.createElement("p",{className:"a-caption"},s?"Copy staged, unstaged and untracked files with an inspectable manifest. Ignored files are excluded. Repositories with submodules need separate handling; the source stays intact.":"Start from the committed ref in a clean checkout. Your current uncommitted changes stay in the source."),n.createElement("button",{className:"a-primary",disabled:m||!a.trim(),"data-action":"worktree.create",onClick:()=>f("worktree.create",{sourceRevision:g.repository.sourceRevision,ref:a.trim(),...o.trim()?{branch:o.trim()}:{},mode:s?"carry_dirty":"clean"})},"Create managed checkout")),n.createElement("details",null,n.createElement("summary",null,"Attach an existing checkout"),n.createElement("label",{htmlFor:"worktree-path"},"Existing worktree path"),n.createElement("input",{id:"worktree-path",value:c,onChange:w=>u(w.target.value)}),n.createElement("button",{className:"a-soft",disabled:m||!c.trim(),"data-action":"worktree.attach",onClick:()=>f("worktree.attach",{path:c.trim()})},"Attach checkout"),n.createElement("p",{className:"a-caption"},"The folder must belong to this repository. Attaching does not start work or grant cleanup ownership.")),(e.worktrees||[]).map(w=>{var N;return n.createElement("article",{className:"a-selection-card",key:w.id,"data-worktree-id":w.id},n.createElement("p",{className:"a-state-view"},w.path),n.createElement("p",{role:"status"},"Checkout ",w.status),n.createElement("p",null,"Local host: ",((N=w.executionHost)==null?void 0:N.label)||"Not recorded for this checkout"),w.error&&n.createElement("p",{role:"alert"},w.error),n.createElement("p",null,w.branch||"Detached commit"," · ",w.mode==="carry_dirty"?"Changes copied":w.mode==="attached"?"Existing checkout":"Committed source"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:m,"data-action":"worktree.status",onClick:()=>f("worktree.status",{id:w.id})},"Inspect checkout and manifest"),w.status==="ready"&&n.createElement("button",{className:"a-primary",disabled:m||e.configurationBusy||E===w.path,"data-action":"worktree.handoff",onClick:()=>y(w.id)},"Move execution here"),w.owned&&w.status!=="removed"&&n.createElement("button",{className:"a-soft",disabled:m||E===w.path||e.configurationBusy,"data-action":"worktree.remove",onClick:()=>f("worktree.remove",{id:w.id,expectedRevision:w.revision})},"Remove clean checkout")))}),e.worktreeStatus&&n.createElement("details",{open:!0},n.createElement("summary",null,"Checkout inspection"),n.createElement("pre",{className:"a-state-view"},JSON.stringify(e.worktreeStatus,null,2))),(e.worktreeHandoffs||[]).map(w=>{var N;return n.createElement("article",{className:"a-selection-card",key:w.id,"data-handoff-id":w.id},n.createElement("p",{role:"status"},"Handoff ",w.phase),n.createElement("p",null,"Local host: ",((N=w.executionHost)==null?void 0:N.label)||"Not recorded for this receipt"),n.createElement("p",null,w.detail),w.phase==="unknown"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"handoff-evidence-"+w.id},"What did you verify?"),n.createElement("textarea",{id:"handoff-evidence-"+w.id,value:d,onChange:x=>p(x.target.value)}),n.createElement("p",{className:"a-caption"},"Confirm saved writer release again and choose the execution folder. Neither choice sends a message or replays work."),n.createElement("div",{className:"a-dialog-actions"},["source","target"].map(x=>n.createElement("button",{className:"a-soft",key:x,disabled:m||!d.trim(),"data-action":"worktree.reconcile",onClick:()=>f("worktree.reconcile",{id:w.id,expectedRevision:w.revision,destination:x,evidence:d.trim()})},"Use ",x," folder")))))}))}function Hf({state:e,session:t,act:a}){var T,I,F;const[r,o]=v.useState(null),[i,s]=v.useState(""),[l,c]=v.useState(!1),[u,d]=v.useState(!1),[p,m]=v.useState(""),[h,f]=v.useState(""),[g,E]=v.useState(""),[y,b]=v.useState(""),[S,w]=v.useState(!1),[N,x]=v.useState(""),A=((T=e.portability)==null?void 0:T.receipts)||((I=t==null?void 0:t.portability)==null?void 0:I.receipts)||[],C=async(z,q={})=>{w(!0),x("");try{const W=await a(z,q);return z==="portability.inspect"&&o(W==null?void 0:W.result),W}catch(W){x(W.message||"Transfer could not finish. Inspect the saved receipt.")}finally{w(!1)}},O=()=>C("portability.inspect",t?{sessionId:t.id}:{}),k=(F=t==null?void 0:t.worktreeInspection)==null?void 0:F.repository;return n.createElement("section",{className:"a-settings-section","aria-label":"Move task between hosts","data-part":"portability"},n.createElement("h3",null,"Move task between hosts"),n.createElement("p",null,"Stage a private transfer, verify the destination, then release this host. Your task keeps its saved history and outputs. Moving never sends a message or retries unfinished work."),n.createElement("button",{className:"a-soft",disabled:S,"data-action":"portability.inspect",onClick:O},"Inspect hosts and transfers"),r&&n.createElement(n.Fragment,null,n.createElement("p",null,"This host: ",r.host.label),!Object.keys(r.peers||{}).length&&n.createElement("p",{role:"status"},"No hosts are paired. Configure trusted host keys and upgrade Foundation on both hosts before transferring.")),t&&n.createElement("details",null,n.createElement("summary",null,"Export this task"),n.createElement("p",null,"Inspect the repository above, then choose a paired destination."),n.createElement("label",{htmlFor:"portability-destination"},"Destination"),n.createElement("select",{id:"portability-destination",value:i,onChange:z=>s(z.target.value)},n.createElement("option",{value:""},"Choose a paired host"),Object.entries((r==null?void 0:r.peers)||{}).map(([z,q])=>n.createElement("option",{key:z,value:z},q.label||z))),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:l,onChange:z=>c(z.target.checked)}),"Include staged, unstaged and untracked work"),n.createElement("p",{className:"a-caption"},"Ignored files and local settings stay here. Export stops if a bound is exceeded or recognizable credentials are found. Review the selected history, outputs and files for private credentials before continuing."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:u,onChange:z=>d(z.target.checked)}),"I reviewed this task’s transfer contents"),n.createElement("button",{className:"a-primary",disabled:S||!i||!k||!u||t.configurationBusy,"data-action":"portability.export",onClick:()=>C("portability.export",{sessionId:t.id,destination:i,sourceRevision:k.sourceRevision,expectedExecutionRevision:t.executionRevision||0,mode:l?"carry_dirty":"clean",reviewedContent:!0})},"Stage export and stop execution here")),n.createElement("details",null,n.createElement("summary",null,"Import a staged task"),n.createElement("p",null,"Copy the private signed package over your authenticated host connection. The destination repository must already contain its exact commit. A small provider check uses this host’s credentials."),n.createElement("label",{htmlFor:"portability-package"},"Package path on this host"),n.createElement("input",{id:"portability-package",value:p,onChange:z=>m(z.target.value)}),n.createElement("label",{htmlFor:"portability-repository"},"Destination repository"),n.createElement("input",{id:"portability-repository",value:h,onChange:z=>f(z.target.value)}),n.createElement("button",{className:"a-soft",disabled:S||!p||!h,"data-action":"portability.stage",onClick:()=>C("portability.stage",{path:p,repository:h})},"Verify and stage import")),!!A.length&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"portability-receipt"},"Signed receipt path copied from the other host"),n.createElement("input",{id:"portability-receipt",value:g,onChange:z=>E(z.target.value)}),n.createElement("label",{htmlFor:"portability-evidence"},"What did you verify?"),n.createElement("input",{id:"portability-evidence",value:y,onChange:z=>b(z.target.value),placeholder:"Reason to cancel an unreleased export"})),A.map(z=>n.createElement("article",{className:"a-selection-card",key:z.id,"data-transfer-id":z.id},n.createElement("p",{role:"status"},z.direction==="outgoing"?"Export":"Import"," · ",z.phase),n.createElement("p",{className:"a-state-view"},"Task ",z.sessionId),z.package&&n.createElement("p",{className:"a-state-view"},"Package: ",z.package),z.receiptPath&&n.createElement("p",{className:"a-state-view"},"Receipt: ",z.receiptPath),z.detail&&n.createElement("p",null,z.detail),(z.phase==="prepared"||z.phase==="releasing"||z.phase==="unknown"&&z.previousPhase==="releasing")&&n.createElement("button",{className:"a-primary",disabled:S||!g,"data-action":"portability.release",onClick:()=>C("portability.release",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,path:g})},"Release source ownership"),z.direction==="incoming"&&["ready","active"].includes(z.phase)&&n.createElement("button",{className:"a-primary",disabled:S||!g,"data-action":"portability.activate",onClick:()=>C("portability.activate",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,path:g})},z.phase==="active"?"Verify activation receipt":"Activate on this host"),z.phase==="unknown"&&n.createElement("p",null,"Inspect both hosts before any further action. Original data remains preserved; no work was replayed."))),A.filter(z=>z.direction==="outgoing"&&(z.phase==="prepared"||z.phase==="unknown"&&z.previousPhase==="preparing")).map(z=>n.createElement("button",{key:"cancel-"+z.id,className:"a-soft",disabled:S||!y.trim(),"data-action":"portability.cancel",onClick:()=>C("portability.cancel",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,evidence:y})},"Cancel unreleased export")),A.filter(z=>z.direction==="incoming"&&["ready","unknown"].includes(z.phase)&&!z.releaseCertificate).map(z=>n.createElement("button",{key:"discard-"+z.id,className:"a-soft",disabled:S||!g,"data-action":"portability.discard",onClick:()=>C("portability.discard",{sessionId:z.sessionId,id:z.id,expectedRevision:z.revision,path:g})},"Retain source cancellation")),N&&n.createElement("p",{role:"alert"},N))}const iF=new Set(["working","running","busy","starting","stopping","retrying"]),sF=new Set(["working","running","busy","starting","pending","queued","preparing","retrying"]);function Oc(e){if(typeof e=="number")return e<1e12?e*1e3:e;const t=Date.parse(e);return Number.isFinite(t)?t:null}function lF(e){const t=Math.max(0,Math.floor(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,"0")}s`}const cF={"job.returned":"completed","job.failed":"error","job.cancelled":"cancelled"};function sk(e=[]){const t=new Map,a=new Map;for(const[r,o]of e.entries()){const i=o.callId||o.call_id||o.id||`worker-${r}`,s=t.get(i);if(o.kind==="job"){const l=cF[o.event]||(["completed","cancelled","error","failed","stopped","interrupted"].includes(o.status)?o.status:null);l&&a.set(i,l)}(!s||o.kind==="session"||s.kind!=="session")&&t.set(i,o)}return[...t].map(([r,o])=>a.has(r)?{...o,status:a.get(r),phase:a.get(r)}:o)}function uF(e,t=Date.now()){var g;if(!e)return null;const a=iF.has(e.status),r=sk(e.workers||[]).filter(E=>sF.has(E.status)),o=e.activity,i=new Map;let s=null;if(o!=null&&o.activeTools)for(const E of o.activeTools)i.set(E.callId||E.call_id||E.tool,{tool:E.tool||E.name||"tool",startedAt:E.startedAt});else if(a){const E=new Map;for(const y of e.runtimeEvents||[]){const b=y.type==="runtime.tool"?`tool.${y.phase}`:y.type||y.event,S=y.callId||y.call_id||y.tool_call_id||y.job_id||y.tool,w=y.tool||y.tool_name||y.name;w&&/^(tool[.:]|job\.)/.test(b||"")&&(s=w),["tool.pre","tool:pre","tool.start","tool.started"].includes(b)&&E.set(`tool:${S}`,{id:S,tool:w||"tool",startedAt:y.time||y.createdAt}),["tool.post","tool:post","tool.error","tool:error","tool.end","tool.finished"].includes(b)&&E.delete(`tool:${S}`),b==="job.queued"&&E.set(`job:${S}`,{id:S,tool:w||"delegate",startedAt:y.time||y.createdAt}),["job.returned","job.failed","job.cancelled","job.canceled","job.error"].includes(b)&&E.delete(`job:${S}`),["session.closed","generation.detached"].includes(b)&&E.clear()}for(const y of E.values())i.set(y.id,y)}if(!a&&!r.length)return null;const l=[...i.values()],c=new Map;for(const E of l)c.set(E.tool,(c.get(E.tool)||0)+1);let u,d;e.status==="starting"?(u="Preparing your Amplifier session…",d="preparing"):e.status==="stopping"?(u="Stopping the current work…",d="stopping"):l.length?(u=o?`Running ${l.length} ${l.length===1?"tool":"tools"}`:`${l.length} ${l.length===1?"tool call":"tool calls"} pending`,d="tools"):r.length?(u=`${r.length} ${r.length===1?"worker lane is":"worker lanes are"} active`,d="workers"):(u=e.streaming?"Writing a response…":"Composing a response…",d="composing"),o!=null&&o.phase&&(d=o.phase),typeof(o==null?void 0:o.label)=="string"&&o.label.trim()&&(u=o.label);const p=[...e.messages||[]].reverse().find(E=>E.role==="user"),m=Oc(o==null?void 0:o.startedAt)||Oc(p==null?void 0:p.createdAt)||Math.min(...l.map(E=>Oc(E.startedAt)).filter(Boolean)),h=Number.isFinite(m)?lF(t-m):null,f=[...c].map(([E,y])=>y>1?`${E} × ${y}`:E);return!s&&((g=o==null?void 0:o.lastEvent)!=null&&g.tool)&&(s=o.lastEvent.tool),{phase:d,label:u,elapsed:h,toolLabels:f,workerCount:r.length,lastTool:l.length?null:s}}function dF(e){var c,u,d,p;if((u=(c=e==null?void 0:e.execution)==null?void 0:c.nodes)!=null&&u.length||(p=(d=e==null?void 0:e.execution)==null?void 0:d.turns)!=null&&p.length){const m=e.execution.nodes||[],h=[...e.execution.turns||[]];for(const f of m)f.turnId&&!h.some(g=>g.id===f.turnId)&&h.push({id:f.turnId});return{nodes:m,turns:h,segments:e.execution.segments||[]}}const t=sk((e==null?void 0:e.workers)||[]),a=(e==null?void 0:e.runtimeEvents)||[];if(!t.length&&!a.some(m=>m.type==="runtime.tool"||String(m.type).startsWith("tool.")))return{nodes:[],turns:[]};const r="observed-activity",o=[],i=new Map;for(const m of a){const h=m.type==="runtime.tool"?m.phase:String(m.type).replace(/^tool[.:]/,"");if(m.type!=="runtime.tool"&&!/^tool[.:]/.test(m.type||""))continue;const f=m.callId||m.call_id||m.tool_call_id;if(!f)continue;const g=i.get(f)||{id:`tool:${f}`,kind:"tool",turnId:r,label:m.tool||m.tool_name||"Tool call",callId:f,startedAt:m.at||m.time};g.status=["post","end","finished"].includes(h)?"completed":["error","failed"].includes(h)?"error":"running",g.actualSessionId=m.actualSessionId||g.actualSessionId,i.set(f,g)}const s=new Map(t.map(m=>[m.sessionId||m.id,m]));for(const m of i.values())s.has(m.actualSessionId)&&(m.parentId=`worker:${m.actualSessionId}`),o.push(m);for(const m of t){const h=m.sessionId||m.id,f=m.callId||m.call_id,g=s.get(m.parentSessionId);o.push({id:`worker:${h}`,kind:"worker",turnId:r,routing:m.routing,provider:m.provider,model:m.model,label:m.name||m.agent||m.title||"Worker",status:m.status,phase:m.phase,summary:m.detail||m.report||m.result,summaryDetail:m.detail?m.detailDetail:m.report?m.reportDetail:m.resultDetail,startedAt:m.startedAt,endedAt:m.endedAt,workerId:m.id||h,parentId:i.has(f)?`tool:${f}`:g?`worker:${g.sessionId||g.id}`:null})}const l=["error","failed","cancelled","interrupted"].includes(e==null?void 0:e.status)?e.status:["working","starting","running","stopping"].includes(e==null?void 0:e.status)||o.some(m=>["running","working","starting","queued","pending","retrying","idle"].includes(m.status))?"running":"completed";return{nodes:o,turns:[{id:r,label:"Recent execution activity",status:l}]}}function pF(e,t){var i;const a=new Map,r=[],o=new Set(e.map(s=>s.id));for(const s of t.turns){let l=s.anchorMessageId;if(!Object.hasOwn(s,"anchorMessageId")){const c=e.find(p=>p.role==="user"&&(s.messageId&&s.messageId===p.id||s.userMessageId&&s.userMessageId===p.id||p.inputId&&(s.inputId===p.inputId||s.id===p.inputId))),u=t.nodes.filter(p=>p.turnId===s.id&&Number.isFinite(p.startedAt)).map(p=>p.startedAt),d=Number.isFinite(s.startedAt)?s.startedAt:u.length?Math.min(...u):null;l=(c==null?void 0:c.id)||(d!==null?(i=e.findLast(p=>Number.isFinite(p.createdAt)&&p.createdAt<=d))==null?void 0:i.id:null)}l&&o.has(l)?(a.has(l)||a.set(l,[]),a.get(l).push(s.id)):r.push(s.id)}return{after:a,before:r}}function mF(e){return e>=1e6?`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}const hF=new Set(["running","working","starting","queued","pending","retrying","idle"]);function Bn(e){return hF.has((e==null?void 0:e.status)||(e==null?void 0:e.phase))&&!Number.isFinite(e==null?void 0:e.endedAt)}function Np(e,t=Date.now()/1e3){if(!Number.isFinite(e==null?void 0:e.startedAt))return null;const a=Number.isFinite(e.endedAt)?e.endedAt:Bn(e)?t:null;if(a===null)return null;const r=Math.max(0,a-e.startedAt),o=Math.floor(r);return r>=60?`${Math.floor(o/60)}m ${o%60}s`:Bn(e)?`${o}s`:`${Number(r.toFixed(1))}s`}function Rp(e,{pending:t=!1}={}){if(!e)return t?{text:"usage pending",title:"Usage has not been reported yet."}:null;if(e.calls===0&&!e.totalTokens&&!e.inputTokens&&!e.outputTokens&&!e.costUsd)return t?{text:"usage pending",title:"Usage has not been reported yet."}:null;const a=e.totalTokens??(e.inputTokens!=null||e.outputTokens!=null?(e.inputTokens||0)+(e.outputTokens||0):null),r=e.grossTotalTokens??(a===null?null:a+(e.cacheWriteTokens||0)),o=e.tokenPendingCalls??(t&&e.tokenUnknownCalls||0),i=e.costPendingCalls??(t&&e.unknownCalls||0),s=e.costType||(e.costUsd!=null&&e.unknownCalls===0?"reported":"unavailable"),l=typeof e.costUsd=="number"&&s!=="unavailable"?`${s==="estimated"||e.estimatedCalls>0?"≈":""}$${e.costUsd<.01?e.costUsd.toFixed(6).replace(/0+$/,"").replace(/\.$/,".00"):e.costUsd.toFixed(3)}${s==="partial"&&!i?"+":""}`:null,c=[];if(e.calls>0&&e.tokenUnknownCalls>=e.calls?c.push(o===e.calls?"tokens pending":o?"tokens partly pending":"tokens unavailable"):r!=null&&c.push(`${mF(r)} tokens${e.tokenUnknownCalls?o===e.tokenUnknownCalls?" + pending":" + ?":""}`),l?c.push(l+(i?" + pending":"")):(e.calls||r!=null)&&c.push(i===e.calls?"cost pending":i?"cost partly pending":"cost unavailable"),!c.length)return null;const u=[e.inputTokens!=null&&(e.calls==null||e.tokenUnknownCalls!==e.calls)?`${e.inputTokens} input tokens`:null,e.outputTokens!=null&&(e.calls==null||e.tokenUnknownCalls!==e.calls)?`${e.outputTokens} output tokens`:null,e.cacheReadTokens?`${e.cacheReadTokens} cache-read tokens`:null,e.cacheWriteTokens?`${e.cacheWriteTokens} cache-write tokens`:null,o?`${o} call(s) awaiting token usage`:null,i?`${i} call(s) awaiting cost`:null,s==="partial"?`Partial cost: ${e.pricedCalls||0} of ${e.calls||"?"} calls priced`:s==="estimated"?"Cost is estimated":s==="reported"?"Cost reported by the provider":i===e.calls?"Cost has not been reported yet":"Provider did not report a cost for completed calls",e.estimatedCalls&&s==="partial"?"Includes estimated cost":null].filter(Boolean).join(" · ");return{text:c.join(" · "),title:u}}function fF(e,t){const a=e.nodes.filter(c=>c.turnId===t),r=new Map(a.map(c=>[c.id,c])),o=new Map;for(const c of a){const u=c.parentId&&c.parentId!==c.id&&r.has(c.parentId)?c.parentId:null;o.has(u)||o.set(u,[]),o.get(u).push(c)}const i=o.get(null)||[],s=new Set,l=c=>{if(!s.has(c.id)){s.add(c.id);for(const u of o.get(c.id)||[])l(u)}};i.forEach(l);for(const c of a)s.has(c.id)||(i.push(c),l(c));return{roots:i,children:o}}function gF(e){let t;try{t=JSON.parse(e)}catch{return[]}const a=new Set;function r(o,i=0){if(!(!o||typeof o!="object"||i>8))for(const[s,l]of Object.entries(o).slice(0,100)){if(a.size>=8)return;if(["url","uri","html_url","web_url","artifact_url"].includes(s)&&typeof l=="string")try{const c=new URL(l);["https:","http:"].includes(c.protocol)&&!c.username&&!c.password&&a.add(c.href)}catch{}else typeof l=="object"&&r(l,i+1)}}return r(t),[...a]}function vF(e){const t=e.filter(r=>r.kind==="llm"),a={calls:t.length,pricedCalls:0,unknownCalls:0,estimatedCalls:0,tokenUnknownCalls:0,costPendingCalls:0,tokenPendingCalls:0,costUsd:0};for(const r of["inputTokens","outputTokens","totalTokens","cacheReadTokens","cacheWriteTokens"])a[r]=0;for(const r of t){const o=r.usage||{},i=Bn(r);for(const s of["inputTokens","outputTokens","totalTokens","cacheReadTokens","cacheWriteTokens"])Number.isFinite(o[s])&&(a[s]+=o[s]);o.totalTokens==null&&(o.inputTokens!=null||o.outputTokens!=null)&&(a.totalTokens+=(o.inputTokens||0)+(o.outputTokens||0)),o.totalTokens==null&&o.inputTokens==null&&o.outputTokens==null&&(a.tokenUnknownCalls++,i&&a.tokenPendingCalls++),Number.isFinite(o.costUsd)?(a.costUsd+=o.costUsd,a.pricedCalls++,o.costType==="estimated"&&a.estimatedCalls++):(a.unknownCalls++,i&&a.costPendingCalls++)}return a.costType=a.pricedCalls?a.unknownCalls?"partial":a.estimatedCalls?"estimated":"reported":"unavailable",a}function bF(e,t){const a=[],r=[];for(const o of t.turns){const i=t.nodes.filter(u=>u.turnId===o.id&&!(u.lifecycle==="background"&&u.label==="Session naming")),s=new Map;let l,c=-1/0;for(const u of i){const d=Number.isFinite(u.startedAt)?u.startedAt:Number.isFinite(u.endedAt)?u.endedAt:o.startedAt;let p=o.anchorMessageId??null;if(Object.hasOwn(u,"anchorMessageId"))p=u.anchorMessageId;else if(Number.isFinite(d))for(const f of e)f.timestampKnown!==!1&&Number.isFinite(f.createdAt)&&f.createdAt<=d&&(p=f.id);const m=`${o.id}@${p||"start"}`;s.has(m)||s.set(m,{id:m,anchor:p,nodes:[]}),s.get(m).nodes.push({...u,turnId:m});const h=Number.isFinite(d)?d:-1/0;(l===void 0||h>=c)&&(c=h,l=m)}!i.length&&Bn(o)&&(l=`${o.id}@${o.anchorMessageId||"start"}`,s.set(l,{id:l,anchor:o.anchorMessageId,nodes:[]}));for(const u of s.values()){const d=u.nodes.map(f=>f.startedAt).filter(Number.isFinite),p=u.nodes.map(f=>f.endedAt).filter(Number.isFinite),m=u.id===l&&["error","failed","cancelled","interrupted"].includes(o.status||o.phase)?o.status||o.phase:null,h=!m&&(u.nodes.some(Bn)||u.id===l&&Bn(o));m&&Number.isFinite(o.endedAt)&&p.push(o.endedAt),a.push({...o,id:u.id,originalTurnId:o.id,anchorMessageId:u.anchor,startedAt:d.length?Math.min(...d):o.startedAt,endedAt:h?void 0:p.length?Math.max(...p):o.endedAt,phase:h?"running":m||((o.status||o.phase)&&(p.length||o.endedAt)?"completed":"recorded"),status:void 0,aggregateUsage:vF(u.nodes),nodeCounts:{tools:u.nodes.filter(f=>f.kind==="tool").length,models:u.nodes.filter(f=>f.kind==="llm").length},...(t.segments||[]).find(f=>f.id===u.id)}),r.push(...u.nodes)}}return{nodes:r,turns:a}}function yF({sessionId:e,act:t}){const[a,r]=v.useState(null),[o,i]=v.useState(!1),[s,l]=v.useState(""),c=v.useRef(0);v.useEffect(()=>(c.current++,r(null),i(!1),l(""),()=>{c.current++}),[e]);async function u(d=!1){const p=++c.current;i(!0),l("");try{const m=await t("runtime.dependencies",{sessionId:e,...d?{verifyImports:!0}:{}});if(c.current===p){if(!(m!=null&&m.result))throw Error("Runtime inspection did not return a result.");r(m.result)}}catch(m){c.current===p&&l(m.message)}finally{c.current===p&&i(!1)}}return n.createElement(Xt,{as:"section",name:"runtime.dependencies",busy:o,className:"a-settings-section"},n.createElement("h3",null,"Document and data tools"),n.createElement("p",null,"Check the tools available for documents, spreadsheets, PDFs and plots."),n.createElement("button",{className:"a-soft","data-action":"runtime.dependencies",disabled:o,onClick:()=>u()},n.createElement(Mt,null),"Inspect document tools"),n.createElement("button",{className:"a-soft","data-action":"runtime.dependencies",disabled:o,onClick:()=>u(!0)},"Check library imports"),s&&n.createElement("p",{role:"alert",className:"a-danger"},s),a&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Availability is separate from a successful render, visual review or formula calculation."),Object.entries(a).map(([d,p])=>n.createElement("section",{key:d,"aria-label":d==="host"?"App environment":"Conversation environment"},n.createElement("h4",null,d==="host"?"App environment":"Conversation environment"),p.status!=="available"?n.createElement("p",null,p.reason||"Environment not available."):n.createElement(n.Fragment,null,n.createElement("p",{className:"a-wrap"},"Python ",p.python.version,n.createElement("br",null),n.createElement("code",null,p.python.path)),n.createElement("ul",{className:"a-catalog-list"},p.python.packages.map(m=>n.createElement("li",{key:m.name},n.createElement("strong",null,m.name)," — ",m.version||m.status,m.importStatus&&` · Import ${m.importStatus}`))),Object.entries(p.executables).map(([m,h])=>n.createElement("p",{key:m,className:"a-wrap"},n.createElement("strong",null,{node:"Node.js",libreoffice:"LibreOffice",pdftoppm:"PDF renderer"}[m]||m)," — ",h.version||h.status,h.path&&n.createElement(n.Fragment,null,n.createElement("br",null),n.createElement("code",null,h.path)),h.reason&&n.createElement(n.Fragment,null,n.createElement("br",null),h.reason))))))))}const fs=e=>JSON.stringify(e,null,2),EF={tab:"overview",goalCondition:"",goalMaxTurns:"",mode:"",maxIterations:"",contextTokens:"",tool:"",toolArgs:"{}",clearConfirm:!1};function lk({state:e,session:t,act:a,computerControls:r}){var W,X,U,_,P,G,Z,D,ne;const o=(W=e.view)==null?void 0:W.runtimeDraft,i=v.useRef(null),[s,l]=v.useState({...EF,...o});v.useEffect(()=>{o&&l(H=>({...H,...o}))},[o]);const c=H=>{l(j=>({...j,...H})),a("view.update",{patch:{runtimeDraft:H}})};v.useLayoutEffect(()=>{var j;if(!s.section)return;const H=[...((j=i.current)==null?void 0:j.querySelectorAll("[data-runtime-section]"))||[]].find(ie=>ie.dataset.runtimeSection===s.section);H==null||H.scrollIntoView({block:"nearest"}),H==null||H.focus({preventScroll:!0})},[s.section,s.tab,s.revealRevision]);const u=((X=e.runtimeControl)==null?void 0:X[t==null?void 0:t.id])||{},d=u["catalog.inspect"]||{},p=u["mode.list"]||{},m=u["goals.get"]||u["goals.set"]||{},h=u["budget.get"]||u["budget.set"]||{},f=u["usage.inspect"],g=d.capabilities||{},E=((U=u["task.get"])==null?void 0:U.task)||(t==null?void 0:t.task),y=e.management||{},b=["working","running","pending","queued"].includes(y.phase),S=(_=e.actionStatus)==null?void 0:_["runtime.control"],w=H=>{var j,ie;return["queued","working"].includes(S==null?void 0:S.phase)&&((j=S==null?void 0:S.target)==null?void 0:j.sessionId)===(t==null?void 0:t.id)&&((ie=S==null?void 0:S.target)==null?void 0:ie.operation)===H},N=t&&["working","starting","running","stopping","busy"].includes(t.status),x=(H,j={})=>a("runtime.control",{sessionId:t.id,operation:H,args:j}),A=d.tools||[],C=A.find(H=>H.name===s.tool),O=u["tool.invoke"],k=!!g.goals,T=!!g.modes,I=Rp(f==null?void 0:f.usage);let F={},z="";try{if(F=JSON.parse(s.toolArgs),!F||typeof F!="object"||Array.isArray(F))throw new Error("Tool arguments must be a JSON object.")}catch(H){z=H.message}const q=[["overview","Session",tl],["direction","Goals & modes",mm],["limits","Limits & context",Mk],["tools","Tools & skills",Os],["computer","Computer use",Lu]];return t?n.createElement("div",{ref:i,className:"a-runtime-settings","data-part":"runtime-controls"},n.createElement("p",null,"Inspect and control the active Amplifier session. Its bundle determines which capabilities are available."),n.createElement("nav",{className:"a-settings-nav","aria-label":"Session control sections"},q.map(([H,j,ie])=>n.createElement("button",{key:H,className:s.tab===H?"selected":"","data-action":"view.update",onClick:()=>c({tab:H,section:null})},n.createElement(ie,null),j))),n.createElement("div",{"data-runtime-section":s.tab,tabIndex:-1},s.tab==="computer"&&r,y.error&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,y.error)),b&&n.createElement("p",{className:"a-management-status",role:"status"},n.createElement(Mt,{className:"a-progress-spinner"}),y.detail||"Updating the session…"),s.tab==="overview"&&n.createElement(n.Fragment,null,n.createElement(oF,{session:t,act:a}),n.createElement(Xt,{as:"section",name:"runtime-catalog.inspect",busy:w("catalog.inspect"),className:"a-settings-section"},n.createElement("h3",null,"Session capabilities"),n.createElement("button",{className:"a-soft",disabled:b,"data-action":"runtime.control",onClick:()=>x("catalog.inspect")},n.createElement(Mt,null),"Inspect capabilities"),A.length>0&&n.createElement("div",{className:"a-capability-counts"},n.createElement("span",null,n.createElement("strong",null,A.length)," tools"),n.createElement("span",null,n.createElement("strong",null,Object.keys(d.agents||{}).length)," agents"),n.createElement("span",null,n.createElement("strong",null,(d.skills||[]).length)," skills")),Object.keys(g).length>0&&n.createElement("div",{className:"a-capability-tags"},Object.entries(g).map(([H,j])=>n.createElement("span",{key:H,className:j?"available":"unavailable"},H," · ",j?"available":"unavailable")))),n.createElement(Xt,{as:"section",name:"runtime-usage.inspect",busy:w("usage.inspect"),className:"a-settings-section"},n.createElement("h3",null,"Usage & context"),n.createElement("button",{className:"a-soft",disabled:b,"data-action":"runtime.control",onClick:()=>x("usage.inspect")},n.createElement(Mt,null),"Refresh usage"),f&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},f.calls??0," model calls · ",f.messages??0," messages · ",f.userTurns??0," user turns"),I&&n.createElement("p",{title:I.title},I.text),n.createElement("p",{className:"a-caption"},((G=(P=f.contextCharacters)==null?void 0:P.toLocaleString)==null?void 0:G.call(P))??"Unknown"," context characters. Character counts are not token counts.")))),s.tab==="direction"&&n.createElement(n.Fragment,null,n.createElement(rF,{state:e,session:t,act:a}),n.createElement(aF,{session:t,act:a}),!E&&n.createElement(Xt,{as:"section",name:"runtime-goals.get",busy:w("goals.get"),className:"a-settings-section"},n.createElement("h3",null,"Goal"),n.createElement("p",null,"Give the session an explicit condition to work toward and an optional turn limit."),!k&&n.createElement("p",{className:"a-caption"},Object.keys(g).length?"This bundle does not expose a goal controller.":"Inspect session capabilities first to check goal support."),n.createElement("button",{className:"a-soft",disabled:!k||b,"data-action":"runtime.control",onClick:()=>x("goals.get")},n.createElement(Mt,null),"Load current goal"),m.goal&&n.createElement("div",{className:"a-selection-card"},n.createElement("p",null,n.createElement("strong",null,m.goal.condition)),n.createElement("small",null,m.goal.turns_used??0," turns used",m.goal.cap?` of ${m.goal.cap}`:""),m.goal.last_reason&&n.createElement("p",null,m.goal.last_reason)),n.createElement("label",{htmlFor:"runtime-goal"},"Goal condition"),n.createElement("textarea",{id:"runtime-goal",value:s.goalCondition,"data-action":"view.update",onChange:H=>c({goalCondition:H.target.value}),placeholder:"The requested changes are implemented and the checks pass."}),n.createElement("label",{htmlFor:"runtime-goal-turns"},"Maximum continuation turns (optional)"),n.createElement("input",{id:"runtime-goal-turns",type:"number",min:"1",value:s.goalMaxTurns,"data-action":"view.update",onChange:H=>c({goalMaxTurns:H.target.value})}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:!k||!s.goalCondition.trim()||N||b||s.goalMaxTurns!==""&&(!Number.isInteger(Number(s.goalMaxTurns))||Number(s.goalMaxTurns)<1),"data-action":"runtime.control",onClick:()=>x("goals.set",{condition:s.goalCondition.trim(),maxTurns:s.goalMaxTurns?Number(s.goalMaxTurns):null})},n.createElement(mm,null),"Set goal"),n.createElement("button",{className:"a-soft",disabled:!k||N||b,"data-action":"runtime.control",onClick:()=>x("goals.clear")},"Clear goal"))),n.createElement(Xt,{as:"section",name:"runtime-mode.list",busy:w("mode.list"),className:"a-settings-section"},n.createElement("h3",null,"Mode"),n.createElement("p",null,"Use a mode supplied by your bundle to adjust how the session works."),n.createElement("button",{className:"a-soft",disabled:!T||b,"data-action":"runtime.control",onClick:()=>x("mode.list")},n.createElement(Mt,null),"Load modes"),p.active&&n.createElement("p",{className:"a-caption"},"Active: ",typeof p.active=="string"?p.active:fs(p.active)),n.createElement("label",{htmlFor:"runtime-mode"},"Mode"),n.createElement("select",{id:"runtime-mode",value:s.mode,"data-action":"view.update",onChange:H=>c({mode:H.target.value})},n.createElement("option",{value:""},"Choose a mode"),(p.modes||[]).map(H=>n.createElement("option",{value:H.name,key:H.name},H.name,H.description?` — ${H.description}`:""))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:!T||!s.mode||N||b,"data-action":"runtime.control",onClick:()=>x("mode.set",{name:s.mode})},n.createElement(Pt,null),"Apply mode"),n.createElement("button",{className:"a-soft",disabled:!T||N||b,"data-action":"runtime.control",onClick:()=>x("mode.clear")},"Clear mode")),!T&&n.createElement("p",{className:"a-caption"},Object.keys(g).length?"This bundle does not expose modes.":"Inspect session capabilities first to check mode support."))),s.tab==="limits"&&n.createElement(n.Fragment,null,n.createElement(tF,{key:t.id,session:t,act:a}),n.createElement(eF,{results:u,run:x,busy:b,active:N}),n.createElement(Xt,{as:"section",name:"runtime-budget.get",busy:w("budget.get"),className:"a-settings-section"},n.createElement("h3",null,"Session limits"),n.createElement("p",null,"Adjust the active session’s model-turn and context limits."),n.createElement("button",{className:"a-soft",disabled:b,"data-action":"runtime.control",onClick:()=>x("budget.get")},n.createElement(Mt,null),"Load limits"),Object.keys(h).length>0&&n.createElement("p",{className:"a-caption"},"Current: ",h.maxIterations===-1?"unlimited":h.maxIterations??"unknown"," model turns · ",h.contextTokens??"unknown"," context tokens. ",h.contextNote||""),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"runtime-max-iterations"},"Maximum model turns (−1 for unlimited)"),n.createElement("input",{id:"runtime-max-iterations",type:"number",min:"-1","data-action":"view.update",value:s.maxIterations,placeholder:String(h.maxIterations??""),onChange:H=>c({maxIterations:H.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"runtime-context-tokens"},"Context token budget"),n.createElement("input",{id:"runtime-context-tokens",type:"number",min:"1","data-action":"view.update",value:s.contextTokens,placeholder:String(h.contextTokens??""),onChange:H=>c({contextTokens:H.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:N||b||!s.maxIterations&&!s.contextTokens||s.maxIterations!==""&&(!Number.isInteger(Number(s.maxIterations))||Number(s.maxIterations)!==-1&&Number(s.maxIterations)<1)||s.contextTokens!==""&&(!Number.isInteger(Number(s.contextTokens))||Number(s.contextTokens)<1),"data-action":"runtime.control",onClick:()=>x("budget.set",{...s.maxIterations!==""?{maxIterations:Number(s.maxIterations)}:{},...s.contextTokens!==""?{contextTokens:Number(s.contextTokens)}:{}})},n.createElement(Pt,null),"Update limits"))),n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Clear model context"),n.createElement("p",null,"Clear the model’s active context. The saved conversation remains in the app."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:s.clearConfirm,"data-action":"view.update",onChange:H=>c({clearConfirm:H.target.checked})}),"I want to clear the active model context."),n.createElement("button",{className:"a-soft a-danger",disabled:!s.clearConfirm||N||b,"data-action":"runtime.control",onClick:()=>x("context.clear")},n.createElement(ea,null),"Clear context"))),s.tab==="tools"&&n.createElement(n.Fragment,null,n.createElement(Xt,{as:"section",name:"runtime-catalog.inspect",busy:w("catalog.inspect"),className:"a-settings-section"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Tools"),n.createElement("p",null,"Inspect the actual tool schema, then invoke it through the session’s permission checks.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh tool catalog",disabled:b,"data-action":"runtime.control",onClick:()=>x("catalog.inspect")},n.createElement(Mt,null))),n.createElement("label",{htmlFor:"runtime-tool"},"Tool"),n.createElement("select",{id:"runtime-tool","data-action":"view.update",value:s.tool,onChange:H=>c({tool:H.target.value,toolArgs:"{}"})},n.createElement("option",{value:""},"Choose a tool"),A.map(H=>n.createElement("option",{key:H.name,value:H.name},H.name))),C&&n.createElement(n.Fragment,null,n.createElement("p",null,C.description),n.createElement("pre",{className:"a-state-view"},fs(C.inputSchema)),n.createElement("label",{htmlFor:"runtime-tool-arguments"},"Arguments (JSON)"),n.createElement("textarea",{id:"runtime-tool-arguments",className:"a-json-editor",spellCheck:!1,value:s.toolArgs,"data-action":"view.update",onChange:H=>c({toolArgs:H.target.value})}),z&&n.createElement("p",{className:"a-danger"},z),n.createElement("button",{className:"a-primary",disabled:!!z||N||b,"data-action":"runtime.control",onClick:()=>x("tool.invoke",{name:s.tool,arguments:F})},n.createElement(pg,null),"Run tool")),O&&n.createElement("div",{className:"a-tool-result"},n.createElement("h4",null,"Tool result"),((Z=O.result)==null?void 0:Z.error)&&n.createElement("p",{className:"a-danger"},typeof O.result.error=="string"?O.result.error:fs(O.result.error)),n.createElement(ml,{text:typeof((D=O.result)==null?void 0:D.output)=="string"?O.result.output:fs(((ne=O.result)==null?void 0:ne.output)??O)}))),n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Skills"),(d.skills||[]).length?n.createElement("ul",{className:"a-catalog-list"},d.skills.map(H=>n.createElement("li",{key:H.name},n.createElement("strong",null,H.name),n.createElement("p",null,H.description)))):n.createElement("p",null,"Inspect capabilities to see skills available in this bundle."),n.createElement("p",{className:"a-caption"},"Ask Amplifier to use a skill in the conversation, or select its loading tool above to inspect the exact arguments.")),n.createElement("section",{className:"a-settings-section"},n.createElement("h3",null,"Available agents"),n.createElement("ul",{className:"a-catalog-list"},Object.entries(d.agents||{}).map(([H,j])=>{var ie;return n.createElement("li",{key:H},n.createElement("strong",null,H),n.createElement("p",null,j.description||((ie=j.meta)==null?void 0:ie.description)||""))})))),s.tab==="overview"&&n.createElement(yF,{sessionId:t.id,act:a}),s.tab==="overview"&&n.createElement(Hf,{state:e,session:t,act:a}),N&&n.createElement("p",{className:"a-caption"},"Changes and direct tool calls become available when this session and its workers are idle."))):n.createElement(Hf,{state:e,session:null,act:a})}const Vf=e=>new Date(e*1e3).toLocaleString();function Wf({value:e}){return n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Technical environment details"),n.createElement("p",{className:"a-wrap"},e.host.label," · ",e.platform,n.createElement("br",null),"Python ",e.python.version,n.createElement("br",null),n.createElement("code",null,e.python.path),n.createElement("br",null),"Computer-use package: ",e.computerUsePackage.version||e.computerUsePackage.status))}function wF({state:e,session:t,act:a}){var O,k,T,I,F,z,q,W,X;const r=JSON.stringify([t==null?void 0:t.id,(O=e.voice)==null?void 0:O.id,(k=e.voice)==null?void 0:k.status,(I=(T=e.voice)==null?void 0:T.visual)==null?void 0:I.id,(F=e.computerVisual)==null?void 0:F.id,(z=e.computerVisual)==null?void 0:z.available,(q=e.computerVisual)==null?void 0:q.sessionId,(W=e.updates)==null?void 0:W.installedAt]),o=v.useRef(0),[i,s]=v.useState(null),[l,c]=v.useState(!1),[u,d]=v.useState(""),[p,m]=v.useState(!1),[h,f]=v.useState("");v.useEffect(()=>(o.current++,s(null),c(!1),d(""),()=>{o.current++}),[r]);const g=(i==null?void 0:i.context)===r?i.value:null,E=g==null?void 0:g.worker,y=E==null?void 0:E.computerControl,b=g==null?void 0:g.featureSetup,S=Object.values(((X=e.updates)==null?void 0:X.featureResults)||{}).filter(U=>U.feature==="native-desktop"),w=S.sort((U,_)=>_.updatedAt-U.updatedAt)[0],N=p||(b==null?void 0:b.pending)||S.some(U=>["queued","staging","qualified","activating","restart_pending"].includes(U.phase));async function x(){if(!(p||!g)){m(!0),f("");try{const U=await a("updates.featureInstall",{feature:"native-desktop",hostInstanceId:g.host.instanceId});if(!(U!=null&&U.accepted)||!U.requestId)throw Error("The installation request could not be confirmed. Inspect Updates before retrying.")}catch(U){f(U.message)}finally{m(!1)}}}async function A(){const U=++o.current;c(!0),d("");try{const _=await a("desktop.readiness",t!=null&&t.id?{sessionId:t.id}:{});if(U!==o.current)return;if(!(_!=null&&_.result)||_.result.sessionId!==((t==null?void 0:t.id)||null))throw Error("Readiness did not return for this conversation. Check again.");s({context:r,value:_.result})}catch(_){U===o.current&&(d(_.message),s(null))}finally{U===o.current&&c(!1)}}const C=(U="",_="{}")=>a("view.update",{patch:{...Ww("runtime"),runtimeDraft:{tab:"tools",tool:U,toolArgs:_}}});return n.createElement("section",{"aria-label":"Desktop and browser readiness"},n.createElement("p",null,"Check which device and environment supply screen observation and optional computer or browser tools."),n.createElement("p",null,"Checking does not enable desktop control, capture a screen, request OS permission, start a conversation runtime or change your model."),n.createElement("button",{className:"a-soft","data-action":"desktop.readiness",disabled:l,onClick:A},l?"Checking…":"Check desktop and browser setup"),u&&n.createElement("p",{role:"alert"},u),w&&n.createElement("p",{role:"status"},"Native feature request: ",w.phase.replaceAll("_"," "),". ",w.detail),h&&n.createElement("p",{role:"alert"},h),g&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Checked ",Vf(g.observedAt),". This is a setup snapshot; check again after changing the host, tools or permissions."),n.createElement("section",{"aria-label":"Native screen observation"},n.createElement("h4",null,"Native screen observation"),n.createElement("p",null,"The serving app host can differ from your browser device and the conversation worker."),n.createElement(Wf,{value:g.host}),n.createElement("p",{role:"status"},"Native observation: ",g.nativeObservation.available?"ready for explicit consent":g.nativeObservation.code||g.nativeObservation.status),g.nativeObservation.reason&&n.createElement("p",{className:"a-wrap"},g.nativeObservation.reason),n.createElement("p",null,g.nativeObservation.nextStep),b!=null&&b.supported?n.createElement(n.Fragment,null,b.installedExtras.includes("native-desktop")?n.createElement("p",null,"The native observation package is installed. OS permission and consent for this conversation and browser are separate."):n.createElement(n.Fragment,null,n.createElement("p",null,b.detail),n.createElement("button",{className:"a-soft","data-action":"updates.featureInstall",disabled:N||!!h,onClick:x},"Install native screen observation"))):(b==null?void 0:b.reason)&&n.createElement("p",null,b.reason),n.createElement("p",{className:"a-caption"},"The Python path identifies the executing interpreter. It does not identify which parent application macOS lists in Screen Recording settings.")),n.createElement("section",{"aria-label":"Browser screen observation"},n.createElement("h4",null,"Shared screen source"),g.voiceObservation.source?n.createElement("p",null,"Selected ",g.voiceObservation.source.kind,": ",g.voiceObservation.source.label,". Permission expires ",Vf(g.voiceObservation.expiresAt),"."):n.createElement("p",null,"No source is shared for this conversation in this browser."),n.createElement("p",null,g.voiceObservation.nextStep),n.createElement("p",{className:"a-caption"},g.voiceObservation.browserContext)),n.createElement("section",{"aria-label":"Conversation computer tools"},n.createElement("h4",null,"Conversation computer and browser tools"),E.status!=="available"?n.createElement("p",null,E.reason):n.createElement(n.Fragment,null,n.createElement(Wf,{value:E}),n.createElement("p",null,"Computer control: ",y.status.replaceAll("_"," "),". Mounted tools are separate from native screen observation."),y.detail&&n.createElement("p",{className:"a-wrap"},y.detail),n.createElement("p",{className:"a-wrap"},"Mounted tools: ",E.mountedTools.join(", ")||"none"),n.createElement("details",null,n.createElement("summary",null,"Configured tool modules"),n.createElement("ul",null,E.modules.map(U=>n.createElement("li",{key:U.id},U.module," (",U.enabled?"enabled":"disabled",")")))),n.createElement("p",{className:"a-caption"},E.browserContext.reason),y.status==="unavailable"&&n.createElement(n.Fragment,null,n.createElement("p",null,"The computer-use module could not mount a working backend. Its existing setup tool can discover candidate targets, explicitly activate one, and separately persist that choice."),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>C("computer_use_unavailable",'{"action":"discover"}')},"Open computer target setup")),y.status==="not_mounted"&&n.createElement("p",null,"Review a computer-use bundle or connect a browser adapter in Smart Tools. A skill or installed library alone does not mount these tools in this conversation."),y.doctorSupported&&n.createElement(n.Fragment,null,n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>C("desktop",'{"action":"doctor"}')},"Open desktop doctor"),n.createElement("p",{className:"a-caption"},"In Session tools, refresh the catalog and run the prefilled doctor action. It is a prompt-free, no-content diagnostic through normal session policy; policy approval may still be required. It does not clear a halt or prove physical capture/control. Remote facts retain their connection-time ages; guard state is the last recorded state.")),y.status==="mounted"&&!y.doctorSupported&&n.createElement("p",null,"The mounted desktop tool does not advertise doctor. Review its own schema in Session tools."))),n.createElement("section",{"aria-label":"Desktop setup actions"},n.createElement("h4",null,"Set up optional tools"),n.createElement("p",null,"Use bundle review to add or enable tools, and Smart Tools to inspect an adapter's published schemas, connection and reported account identity. Confirm target and account through that adapter before acting."),n.createElement("div",{className:"a-dialog-actions"},g.nextActions.map(U=>n.createElement("button",{className:"a-soft",key:U.label,"data-action":U.action,onClick:()=>a(U.action,U.args)},U.label))),n.createElement("p",null,n.createElement("a",{href:"https://github.com/microsoft/amplifier-bundle-computer-use",target:"_blank",rel:"noreferrer"},"Computer-use installation and target setup")))))}function oi(e,t=!1){if(!e||e.value==null)return(e==null?void 0:e.status)==="empty"?"No recorded calls":(e==null?void 0:e.status)==="pending"?"Pending":"Unavailable";const a=e.value.toLocaleString(void 0,{maximumFractionDigits:t?6:0}),r=[];return e.estimatedCalls>0&&r.push("includes estimates"),e.pendingCalls>0&&r.push(`${e.pendingCalls} pending`),e.unknownCalls>0&&r.push(`${e.unknownCalls} unavailable`),`${t?"$":""}${a}${r.length?" · "+r.join(" · "):""}`}function Zf(e){const{sessionId:t,scope:a,source:r,calls:o,metrics:i,providers:s,coverage:l,excludedUnboundCalls:c}=e.usage;return{observedAt:e.observedAt,sessionId:t,scope:a,source:r,calls:o,metrics:i,providers:s,coverage:l,excludedUnboundCalls:c}}function kF({sessionId:e,act:t}){var E;const[a,r]=v.useState(null),[o,i]=v.useState(!1),[s,l]=v.useState(""),[c,u]=v.useState(!1),d=v.useRef(0);async function p(){var b,S;const y=++d.current;i(!0),l(""),u(!1);try{const w=await t("capacity.read",{sessionId:e,limit:1});if((w==null?void 0:w.accepted)===!1||((S=(b=w==null?void 0:w.result)==null?void 0:b.usage)==null?void 0:S.sessionId)!==e)throw Error("Usage could not be read.");y===d.current&&r(w.result)}catch(w){y===d.current&&l(w.message||"Usage could not be read.")}finally{y===d.current&&i(!1)}}v.useEffect(()=>(r(null),p(),()=>{d.current++}),[e]);const m=((E=a==null?void 0:a.usage)==null?void 0:E.sessionId)===e?a:null,h=m==null?void 0:m.usage,f=(h==null?void 0:h.metrics)||{};async function g(){try{await navigator.clipboard.writeText(JSON.stringify(Zf(m),null,2)),u(!0)}catch{l("Clipboard unavailable. Expand the usage data to select and copy it.")}}return n.createElement("section",{"aria-label":"Conversation usage",className:"a-settings-section"},n.createElement("h3",null,"Conversation usage"),n.createElement("p",{className:"a-caption"},"Recorded model calls in this chat and its observed workers. Cumulative tokens are not the current context-window size."),m&&n.createElement(n.Fragment,null,n.createElement("p",null,h.calls," recorded model calls · Snapshot ",new Date(m.observedAt*1e3).toLocaleTimeString()),n.createElement("dl",{className:"a-capability-counts"},n.createElement("div",null,n.createElement("dt",null,"Total tokens including cache writes"),n.createElement("dd",null,oi(f.grossTotalTokens))),n.createElement("div",null,n.createElement("dt",null,"Cost (USD)"),n.createElement("dd",null,oi(f.costUsd,!0)))),n.createElement("details",null,n.createElement("summary",null,"Token and model breakdown"),n.createElement("dl",null,[["inputTokens","Input tokens (includes cache reads)"],["outputTokens","Output tokens"],["reasoningTokens","Reasoning tokens (part of output)"],["cacheReadTokens","Cache-read tokens"],["cacheWriteTokens","Cache-write tokens"]].map(([y,b])=>n.createElement("div",{key:y},n.createElement("dt",null,b),n.createElement("dd",null,oi(f[y]))))),h.providers.map(y=>n.createElement("p",{key:y.provider+"|"+y.model},y.provider," / ",y.model," · ",y.calls," calls · ",oi(y.metrics.grossTotalTokens)," tokens · ",oi(y.metrics.costUsd,!0)))),n.createElement("p",{className:"a-caption"},"Historical calls without telemetry and provider-internal retries may be missing. Unavailable values are not zero.",h.excludedUnboundCalls>0?` ${h.excludedUnboundCalls} records could not be bound to this chat and are excluded.`:"")),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"capacity.read",disabled:o,onClick:p},o?"Reading usage…":"Refresh usage"),m&&n.createElement("button",{type:"button",className:"a-soft",onClick:g},"Copy usage")),m&&n.createElement("details",null,n.createElement("summary",null,"Usage data"),n.createElement("pre",{className:"a-state-view"},JSON.stringify(Zf(m),null,2))),c&&n.createElement("p",{role:"status"},"Usage copied"),s&&n.createElement("p",{role:"alert"},s))}function ck(e){return["working","running","starting","stopping"].includes(e.status)||e.configurationBusy||(e.workers||[]).some(t=>["queued","starting","running","working","stopping"].includes(t.status))}function uk({session:e,act:t}){var E,y;const[a,r]=v.useState(e.title||""),[o,i]=v.useState(!1),[s,l]=v.useState(""),c=v.useRef(!1),u=v.useRef(!1),d=e.autoName??(e.titleSource!=="manual"&&e.nativeNameSource!=="manual"),p=((E=e.naming)==null?void 0:E.status)==="working",[m,h]=v.useState(d);v.useEffect(()=>h(d),[d]),v.useEffect(()=>{c.current||r(e.title||"")},[e.title]);async function f(b){if(b.preventDefault(),!(u.current||!a.trim())){u.current=!0,i(!0),l("");try{const S=await t("session.rename",{id:e.id,title:a.trim()});if(!S||S.accepted===!1)throw Error("Could not save the name. Your edit is kept.");c.current=!1,r(a.trim())}catch(S){l(S.message)}finally{u.current=!1,i(!1)}}}async function g(b){if(!u.current){u.current=!0,i(!0),l(""),"automatic"in b&&h(b.automatic);try{const S=await t("session.naming",{id:e.id,...b});if(!S||S.accepted===!1)throw Error("Could not update chat naming.")}catch(S){h(d),l(S.message)}finally{u.current=!1,i(!1)}}}return n.createElement(n.Fragment,null,n.createElement("form",{onSubmit:f,"aria-busy":o||p},n.createElement("label",{htmlFor:"session-title"},"Chat name"),n.createElement("div",{className:"a-chat-name-row"},n.createElement("input",{id:"session-title",value:a,disabled:o,required:!0,maxLength:200,onChange:b=>{c.current=!0,r(b.target.value),l("")}}),n.createElement("label",{className:"a-chat-name-auto"},n.createElement("input",{type:"checkbox","aria-label":"Automatic chat naming","data-action":"session.naming",checked:m,disabled:o,onChange:b=>g({automatic:b.target.checked})}),"Auto"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Regenerate chat name",title:"Generate a name from this conversation","data-action":"session.naming",disabled:o||p||a!==e.title,onClick:()=>g({regenerate:!0})},n.createElement(Mt,{className:p?"a-name-spinning":void 0}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"submit",className:"a-soft","data-action":"session.rename",disabled:o||!a.trim()||a===e.title},o?"Saving…":"Save name")),p&&n.createElement("p",{role:"status"},"Generating chat name…"),(s||((y=e.naming)==null?void 0:y.error))&&n.createElement("p",{role:"alert",className:"a-danger"},s||e.naming.error)),n.createElement(xF,{key:e.id,session:e,act:t}))}function xF({session:e,act:t}){const[a,r]=v.useState(e.health),[o,i]=v.useState(""),[s,l]=v.useState(""),[c,u]=v.useState(""),d=v.useRef(!1);v.useEffect(()=>{r(e.health),u(""),l("")},[e.id,e.health,e.status,e.failure]);async function p(){var w;if(!d.current){d.current=!0,i("inspect"),l("");try{const N=await t("session.inspect",{id:e.id});if(!N||N.accepted===!1)throw Error("Could not inspect this conversation.");if((w=N.result)!=null&&w.stale)throw Error("The conversation changed while reading its diagnostics. Try copying again.");return r(N.result),N.result}catch(N){l(N.message)}finally{d.current=!1,i("")}}}v.useEffect(()=>{p()},[e.id]);async function m(){if(!d.current){d.current=!0,i("recover"),l("");try{const w=await t("session.recover",{id:e.id});if(!w||w.accepted===!1)throw Error("Could not create the recovery copy.")}catch(w){l(w.message)}finally{d.current=!1,i("")}}}async function h(w,N){try{await navigator.clipboard.writeText(w),u(N)}catch{l("Clipboard unavailable. Select and copy the session ID below.")}}async function f(){var N;if(d.current)return;const w=p();if((N=navigator.clipboard)!=null&&N.write&&typeof ClipboardItem<"u"){const x=w.then(A=>{if(!A)throw Error("Diagnostics unavailable");return new Blob([JSON.stringify(A,null,2)],{type:"text/plain"})});x.catch(()=>{});try{await navigator.clipboard.write([new ClipboardItem({"text/plain":x})]),u("Diagnostics copied")}catch{l(A=>A||"Clipboard unavailable. Select and copy the session ID below.")}}else{const x=await w;x&&await h(JSON.stringify(x,null,2),"Diagnostics copied")}}const g=a!=null&&a.status&&a.status!==e.status?void 0:a,E=Uu(e),y=(g==null?void 0:g.failure)||e.failure,b=(g==null?void 0:g.moduleFailures)||e.moduleFailures||[],S=ck(e);return n.createElement("div",{className:"a-conversation-details","aria-busy":!!o},n.createElement("div",null,n.createElement("p",null,n.createElement("strong",null,"Session ID"),n.createElement("span",{className:"a-session-identity"},n.createElement("code",null,E),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy session ID",title:"Copy session ID",onClick:()=>h(E,"Session ID copied")},n.createElement(rr,null)))),E!==e.id&&n.createElement("p",null,"App ID: ",n.createElement("code",{style:{overflowWrap:"anywhere"}},e.id)),n.createElement("p",{style:{overflowWrap:"anywhere"}},e.workspace,n.createElement("br",null),"Bundle: ",e.bundle," · Status: ",e.status),(y||e.error||b.length>0)&&(b.length>0?n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,"Configured modules could not load")),n.createElement("ul",null,b.map((w,N)=>n.createElement("li",{key:N},n.createElement("strong",null,w.module),": ",w.guidance)))):n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,(y==null?void 0:y.summary)||"The turn failed. Inspect the recorded details for its cause.")),n.createElement("p",null,(y==null?void 0:y.guidance)||"Work was not automatically replayed."),y&&n.createElement("p",null,"Recorded error: ",y.errorType,y.recordedAt?" · "+new Date(y.recordedAt*1e3||y.recordedAt).toLocaleString():""),(y==null?void 0:y.generationId)&&n.createElement("p",null,"Failed turn: ",n.createElement("code",null,y.generationId)),e.error&&n.createElement("details",null,n.createElement("summary",null,"Runtime message"),n.createElement("p",{style:{overflowWrap:"anywhere"}},e.error)))),n.createElement("p",null,"Create an independent copy with readable history. Old tool calls and image payloads stay in the original; reattach images if needed. Safety stops remain in effect. Nothing runs until you send a new message."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"session.recover",disabled:!!o||S,onClick:m},o==="recover"?"Creating recovery copy…":"Create recovery copy"),n.createElement("button",{type:"button",className:"a-soft",disabled:!!o,onClick:f},"Copy diagnostics")),S&&n.createElement("p",null,"Wait for the current work to stop before creating a copy.")),c&&n.createElement("p",{role:"status"},c),s&&n.createElement("p",{role:"alert",className:"a-danger"},s),n.createElement(kF,{key:e.id,sessionId:e.id,act:t}))}function SF({state:e,session:t,act:a}){var h,f;const[r,o]=v.useState(!1);if(!(t!=null&&t.error))return t!=null&&t.recovery?n.createElement("p",{className:"a-hint"},"Recovery copy · Readable history retained. Old tool and image payloads remain in the original conversation. No work was replayed."):null;const i=(f=(h=e.attention)==null?void 0:h.items)==null?void 0:f.find(g=>g.id==="session:"+t.id),s=t.failure,l=(s==null?void 0:s.category)==="context_limit",c=ck(t);async function u(){if(!(r||c)){o(!0);try{await a("session.recover",{id:t.id})}finally{o(!1)}}}if(i!=null&&i.read)return null;if(l)return n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,n.createElement("strong",null,"Context limit reached.")," ",s.summary," ",s.guidance),n.createElement("button",{type:"button",className:"a-link","data-action":"session.recover",disabled:r||c,onClick:u},r?"Creating recovery copy…":"Create recovery copy"),i&&n.createElement("button",{type:"button","aria-label":"Dismiss conversation error","data-action":"attention.read",onClick:()=>br(a,[i])},n.createElement(nn,null)));const d=(s==null?void 0:s.recordedAt)??t.errorAt,p=Number.isFinite(d)&&d>0?new Date(d*1e3):null,m=p&&Number.isFinite(p.getTime())?p:null;return n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,n.createElement("strong",null,(s==null?void 0:s.category)==="worker_startup"?"Chat could not start.":"A turn stopped.")," ",m&&n.createElement("time",{dateTime:m.toISOString()},m.toLocaleString()," · "),(s==null?void 0:s.summary)||"The cause is not available in the saved details."," Your conversation is saved."),n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>a("view.update",{patch:{panel:"session-details"}})},"View error details"),i&&n.createElement("button",{type:"button","aria-label":"Dismiss conversation error","data-action":"attention.read",onClick:()=>br(a,[i])},n.createElement(nn,null)))}function CF({session:e,act:t}){const[a,r]=v.useState(""),[o,i]=v.useState("workspace"),[s,l]=v.useState(null),[c,u]=v.useState(null),[d,p]=v.useState(null),[m,h]=v.useState([]),[f,g]=v.useState(null),[E,y]=v.useState(""),[b,S]=v.useState("task"),[w,N]=v.useState("available"),[x,A]=v.useState(null),[C,O]=v.useState(""),[k,T]=v.useState(!1),[I,F]=v.useState(null),z=v.useRef(!0),q=v.useRef(!1),W=v.useRef(null),X=e==null?void 0:e.id,U=v.useRef(X);U.current=X,v.useEffect(()=>{W.current=null,u(null),p(null),h([]),g(null),A(null),y(""),l(null),F(null),O("")},[X]),v.useEffect(()=>(z.current=!0,()=>{z.current=!1}),[]);async function _(H,j,ie){if(!q.current){q.current=!0,T(!0),O("");try{const Ee=await t(H,{sessionId:X,...j});if(!(Ee!=null&&Ee.accepted))throw Error("The request was not accepted.");return z.current&&U.current===X&&(ie==null||ie(Ee.result)),Ee.result}catch(Ee){z.current&&O(Ee.message)}finally{q.current=!1,z.current&&T(!1)}}}v.useEffect(()=>{if(!X||(s==null?void 0:s.status)!=="indexing")return;const H=setInterval(()=>_("recall.status",{},l),750);return()=>clearInterval(H)},[X,s]),v.useEffect(()=>{X&&!k&&!q.current&&W.current!==X&&(W.current=X,_("memory.status",{},F))},[X,k]),v.useEffect(()=>{if(!(I!=null&&I.running))return;const H=setInterval(()=>_("memory.status",{},F),750);return()=>clearInterval(H)},[X,I==null?void 0:I.running]);const P=H=>_("memory.configure",{expectedRevision:I.settings.revision,...H},F),G=(H=0)=>_("recall.search",{query:a,scope:o,offset:H},j=>{u(ie=>H?{...j,items:[...ie.items,...j.items]}:j),l(j.coverage)}),Z=(H=0,j=w)=>_("memory.list",{scope:j,offset:H},ie=>{h(Ee=>H?[...Ee,...ie.items]:ie.items),g(ie.nextOffset)}),D=H=>_("recall.read",{sourceSessionId:H.sessionId,messageId:H.messageId,sourceRevision:H.sourceRevision},p),ne=async H=>{H.preventDefault(),await _(x?"memory.update":"memory.create",{...x?{id:x.id,expectedRevision:x.revision,allScopes:w==="all"}:{scope:b},text:E})&&(y(""),A(null),await Z())};return X?n.createElement(n.Fragment,null,n.createElement("section",{className:"a-settings-section","aria-label":"Automatic memory"},n.createElement("h3",null,"Automatic memory"),n.createElement("p",null,"Workspace references can capture your stated preferences, settled decisions, and approaches you said worked. Review their exact sources and correct them when needed."),I&&n.createElement(n.Fragment,null,n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:I.settings.contribute,disabled:k,"data-action":"memory.configure",onChange:H=>P({contribute:H.target.checked})}),"Save useful details from this workspace"),n.createElement("p",null,"Saving memory uses your chosen AI models and may incur provider charges. Review saved details to correct mistakes."),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:I.settings.use,disabled:k,"data-action":"memory.configure",onChange:H=>P({use:H.target.checked})}),"Use saved memory in this workspace"),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:I.settings.excludedSessions.includes(X),disabled:k,"data-action":"memory.configure",onChange:H=>P({excludedSessions:H.target.checked?[...I.settings.excludedSessions,X]:I.settings.excludedSessions.filter(j=>j!==X)})}),"Exclude this conversation from contribution and automatic use"),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Memory activity & limits"),n.createElement("div",null,n.createElement("p",null,"Up to ",I.settings.maxCallsPerDay," model attempts per day, 16,000 source characters and 4,096 output tokens per attempt. Only attributable user statements qualify."),n.createElement("label",{htmlFor:"memory-call-limit"},"Maximum model attempts per day"),n.createElement("input",{id:"memory-call-limit",type:"number",min:1,max:10,disabled:k,value:I.settings.maxCallsPerDay,onChange:H=>{const j=Number(H.target.value);j>=1&&j<=10&&P({maxCallsPerDay:j})}}),n.createElement("button",{type:"button",className:"a-soft",disabled:k||I.running||!I.settings.contribute,"data-action":"memory.consolidate",onClick:()=>_("memory.consolidate",{},F)},"Consolidate eligible past conversations"),n.createElement("p",{role:"status"},I.running?"Consolidating…":"No consolidation running",". Saved references remain inspectable when contribution or use is off."),I.activity&&n.createElement("p",null,I.activity.status,I.activity.reason?" · "+I.activity.reason:""),I.attempts.map(H=>n.createElement("p",{key:H.id},"Conversation ",H.sessionId,": ",H.status,H.saved?` · ${H.saved.length} saved`:"",H.reason?` · ${H.reason}`:"",H.model?` · ${H.model}`:"")),I.lastContext&&n.createElement("div",{"aria-label":"Last memory context"},n.createElement("strong",null,"Last context supplied"),I.lastContext.items.length?I.lastContext.items.map(H=>n.createElement("p",{key:H.id},H.id," · revision ",H.revision," · matched ",H.matchTerms.join(", "))):n.createElement("p",null,"No relevant memory was selected."))))),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.status",onClick:()=>_("memory.status",{},F)},"Refresh memory activity")),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Find past work"),n.createElement("section",{className:"a-settings-section","aria-label":"Indexed recall"},n.createElement("p",null,"Search saved conversation text. Reading a result leaves your current conversation and draft in place."),n.createElement("button",{type:"button",className:"a-soft",disabled:k||(s==null?void 0:s.status)==="indexing","data-action":"recall.refresh",onClick:()=>_("recall.refresh",{},l)},"Update search index"),s&&n.createElement("p",{role:"status"},s.status," · ",s.indexed," of ",s.total??"unknown"," conversations indexed",s.errorCount?` · ${s.errorCount} unavailable`:"",". ",s.checkedAt?"Last checked "+new Date(s.checkedAt*1e3).toLocaleString():""),n.createElement("form",{onSubmit:H=>{H.preventDefault(),G()}},n.createElement("label",{htmlFor:"recall-query"},"Search conversations, tasks and outputs"),n.createElement("input",{id:"recall-query",value:a,maxLength:500,onChange:H=>r(H.target.value)}),n.createElement("label",{htmlFor:"recall-scope"},"Search scope"),n.createElement("select",{id:"recall-scope",value:o,onChange:H=>i(H.target.value)},n.createElement("option",{value:"task"},"This conversation"),n.createElement("option",{value:"workspace"},"This workspace"),n.createElement("option",{value:"all"},"All registered conversations")),n.createElement("button",{type:"submit",className:"a-primary","data-action":"recall.search",disabled:k||!a.trim()},"Search past work")),c&&n.createElement(n.Fragment,null,n.createElement("p",null,"Matches contain all search terms. Coverage and source dates matter; an empty partial search does not prove nothing exists."),c.items.map(H=>n.createElement("div",{className:"a-selection-card",key:H.sessionId+H.messageId},n.createElement("strong",null,H.session.title),n.createElement("p",null,H.snippet),n.createElement("small",null,H.role,H.via==="call"?" · voice":""),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"recall.read",onClick:()=>D(H)},"Read source"))),c.nextOffset!==null&&n.createElement("button",{type:"button",className:"a-soft",disabled:k,onClick:()=>G(c.nextOffset)},"More matches")),d&&n.createElement("div",{className:"a-selection-card","aria-label":"Verified source"},n.createElement("strong",null,"Source verified for this read"),n.createElement("pre",{className:"a-state-view",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}},d.text),n.createElement("small",null,"Conversation ",d.sessionId," · ",d.sourceKind==="message"?"message":"record"," ",d.recordId||d.messageId),d.nextOffset!=null&&n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"recall.read",onClick:()=>_("recall.read",{sourceSessionId:d.sessionId,messageId:d.messageId,sourceRevision:d.sourceRevision,offset:d.nextOffset},H=>p(j=>({...H,text:j.text+H.text})))},"Read more")))),n.createElement("section",{className:"a-settings-section","aria-label":"Saved memory"},n.createElement("h3",null,"Saved memory"),n.createElement("p",null,"Notes are reference material. They do not grant permission or start work. Automatic contribution and use are separately controlled above."),n.createElement("label",{htmlFor:"memory-view"},"Inspect scope"),n.createElement("select",{id:"memory-view",disabled:k,value:w,onChange:H=>{N(H.target.value),Z(0,H.target.value)}},n.createElement("option",{value:"available"},"Notes for this work"),n.createElement("option",{value:"all"},"All saved notes, including removed chats")),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.list",onClick:()=>Z()},"Inspect saved memory"),n.createElement("form",{onSubmit:ne},n.createElement("label",{htmlFor:"memory-text"},"Memory note"),n.createElement("textarea",{id:"memory-text",disabled:k,value:E,maxLength:8e3,rows:4,onChange:H=>y(H.target.value)}),!x&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"memory-scope"},"Remember for"),n.createElement("select",{id:"memory-scope",disabled:k,value:b,onChange:H=>S(H.target.value)},n.createElement("option",{value:"task"},"This conversation"),n.createElement("option",{value:"workspace"},"This workspace"),n.createElement("option",{value:"global"},"All work"))),n.createElement("button",{type:"submit",className:"a-primary","data-action":x?"memory.update":"memory.create",disabled:k||!E.trim()},x?"Save correction":"Save memory"),x&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>{A(null),y("")}},"Cancel edit")),m.map(H=>{var j;return n.createElement("div",{key:H.id,className:"a-selection-card"},n.createElement("strong",null,H.scope," · revision ",H.revision),H.supersededBy&&n.createElement("p",null,"Superseded by ",H.supersededBy,"; excluded from automatic context."),n.createElement("p",{style:{whiteSpace:"pre-wrap"}},H.text),n.createElement("small",null,"Saved through ",H.provenance.origin,H.provenance.wording?" · "+H.provenance.wording:""),((j=H.source)==null?void 0:j.quote)&&n.createElement("blockquote",null,H.source.quote),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.read",onClick:()=>_("memory.read",{id:H.id,allScopes:w==="all"},ie=>{A(ie),y(ie.text)})},"Inspect or correct"),n.createElement("button",{type:"button",className:"a-soft",disabled:k,"data-action":"memory.delete",onClick:async()=>{await _("memory.delete",{id:H.id,expectedRevision:H.revision,allScopes:w==="all"})&&((x==null?void 0:x.id)===H.id&&(A(null),y("")),await Z())}},"Delete memory")),H.source&&n.createElement("button",{type:"button",className:"a-link",disabled:k,onClick:()=>H.source.kind==="attributed-user"?_("memory.source",{id:H.id},p):D(H.source)},"Read original source"))}),f!==null&&n.createElement("button",{type:"button",className:"a-soft",disabled:k,onClick:()=>Z(f)},"More saved notes"),x&&n.createElement("details",null,n.createElement("summary",null,"Retained revisions (",x.versions.length,", up to 50)"),x.versions.map(H=>n.createElement("p",{key:H.revision},"Revision ",H.revision,": ",H.text))),n.createElement("p",null,"Deleting removes the saved note and its retained revisions. Original chats and existing private backups remain.")),C&&n.createElement("p",{role:"alert",className:"a-danger"},C)):n.createElement("p",null,"Open a conversation to manage memory for its workspace. Your existing memory settings are kept.")}function dk(e){return n.createElement(NF,{key:e.session.id,...e})}function NF({session:e,state:t,act:a}){var k,T,I;const[r,o]=v.useState("all"),[i,s]=v.useState(!1),l=(e.messages||[]).filter(F=>F.id&&["user","assistant"].includes(F.role)&&!F.streaming),[c,u]=v.useState(((k=l[0])==null?void 0:k.id)||""),[d,p]=v.useState(((T=l.at(-1))==null?void 0:T.id)||""),[m,h]=v.useState(null),[f,g]=v.useState(!1),[E,y]=v.useState(""),b=v.useRef(0);v.useEffect(()=>()=>{b.current++},[]);const S=(I=t.view)==null?void 0:I.conversationExport,w=(S==null?void 0:S.sessionId)===e.id?S:null,N=f||(w==null?void 0:w.status)==="pending",x=F=>{b.current++,h(null),y(""),F()},A=async()=>{var z;const F=++b.current;g(!0),y(""),h(null);try{const q=await a("session.export",{id:e.id,format:"markdown",destination:"none",scope:r,minimal:i,...r!=="all"?{fromMessageId:c}:{},...r==="range"?{throughMessageId:d}:{}});if(F!==b.current)return;if(!((z=q==null?void 0:q.result)!=null&&z.snapshotId))throw Error("The export could not be prepared. Please try again.");const W=q.result,X=await St(W.url,{cache:"no-store"});if(typeof X.content!="string")throw Error("The reviewed export is unavailable.");F===b.current&&h({...W,text:X.content})}catch(q){F===b.current&&y(q.message||"The export could not be prepared.")}finally{F===b.current&&g(!1)}},C=async F=>{y("");try{await a("session.exportDeliver",{id:e.id,snapshotId:m.snapshotId,destination:F})}catch(z){y(z.message||"The export could not be delivered.")}},O=l.map((F,z)=>n.createElement("option",{key:F.id+":"+z,value:F.id},z+1,". ",F.role==="user"?"You":"Amplifier",": ",String(F.text||"").replace(/\s+/g," ").slice(0,90)));return n.createElement("div",null,n.createElement("p",{className:"a-caption"},"Preview user-visible conversation text before copying or downloading. Full exports include history outside the loaded page. Voice exchanges are included; files are referenced, never embedded."),n.createElement("label",{className:"a-field"},"Export scope",n.createElement("select",{"aria-label":"Export scope",value:r,disabled:N,onChange:F=>x(()=>o(F.target.value))},n.createElement("option",{value:"all"},"Full conversation"),n.createElement("option",{value:"from",disabled:!l.length},"From a message onward"),n.createElement("option",{value:"range",disabled:!l.length},"Selected message range"))),r!=="all"&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Choose boundaries from loaded messages. Load earlier messages in the chat to choose an older starting point."),n.createElement("label",{className:"a-field"},"Starting message",n.createElement("select",{"aria-label":"Starting message",value:c,disabled:N,onChange:F=>x(()=>u(F.target.value))},O)),r==="range"&&n.createElement("label",{className:"a-field"},"Ending message",n.createElement("select",{"aria-label":"Ending message",value:d,disabled:N,onChange:F=>x(()=>p(F.target.value))},O))),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:i,disabled:N,onChange:F=>x(()=>s(F.target.checked))})," Minimal context: omit conversation identifiers"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:N,onClick:A},f?"Preparing preview…":m?"Refresh preview":"Preview Markdown"),n.createElement("button",{type:"button",className:"a-link","data-action":"session.export",disabled:N,onClick:()=>a("session.export",{id:e.id})},"Export JSON")),m&&n.createElement("section",{"aria-label":"Conversation export preview"},n.createElement("p",null,m.summary.messageCount," messages · ",m.summary.bytes.toLocaleString()," bytes · ",m.summary.attachmentCount," attachment references · ",m.summary.artifactCount," artifact references"),n.createElement("p",{className:"a-caption"},"Captured ",new Date(m.capturedAt).toLocaleString(),". Copy and download use this exact preview, even if the conversation continues."),m.summary.omissions.map(F=>n.createElement("p",{className:"a-caption",key:F},F)),n.createElement("textarea",{"aria-label":"Reviewed Markdown",readOnly:!0,value:m.text,rows:10,style:{width:"100%",maxWidth:"100%",boxSizing:"border-box"}}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft","data-action":"session.exportDeliver",disabled:N,onClick:()=>C("clipboard")},n.createElement(rr,null),"Copy Markdown"),n.createElement("button",{type:"button",className:"a-soft","data-action":"session.exportDeliver",disabled:N,onClick:()=>C("download")},n.createElement(wa,null),"Download Markdown"))),E&&n.createElement("p",{role:"alert"},E),w&&n.createElement("p",{role:w.status==="error"?"alert":"status"},w.status==="pending"?"Delivering reviewed export…":w.message))}function RF({session:e,act:t}){var ue,ye;const[a,r]=v.useState([]),[o,i]=v.useState(null),[s,l]=v.useState(!1),[c,u]=v.useState(null),[d,p]=v.useState(!1),[m,h]=v.useState(""),[f,g]=v.useState("file"),[E,y]=v.useState(""),[b,S]=v.useState(""),[w,N]=v.useState(""),[x,A]=v.useState(""),[C,O]=v.useState("document"),[k,T]=v.useState(null),[I,F]=v.useState("unstaged"),[z,q]=v.useState(""),[W,X]=v.useState(""),[U,_]=v.useState(""),[P,G]=v.useState(""),[Z,D]=v.useState("right"),[ne,H]=v.useState(""),j=v.useRef(!1),ie=e==null?void 0:e.id;async function Ee(M,Y,se){if(!j.current){j.current=!0,p(!0),h("");try{const Fe=await t(M,{sessionId:ie,...Y});if(!(Fe!=null&&Fe.accepted))throw Error("The request was not accepted.");return se==null||se(Fe.result),Fe.result}catch(Fe){h(Fe.message)}finally{j.current=!1,p(!1)}}}const me=(M=0,Y=s)=>Ee("outputs.list",{includeUnlinked:Y,offset:M},se=>{r(Fe=>M?[...Fe,...se.items]:se.items),i(se.nextOffset)}),_e=M=>Ee("outputs.read",{id:M},u),Je=async(M,Y)=>{const se=await Ee(M,Y,u);return se&&await me(),se},De=async()=>{let M=await Ee("outputs.read",{id:c.id});if(!M)return;let Y=M.text||"";for(;M.nextOffset!==null&&M.nextOffset!==void 0;){if(M=await Ee("outputs.read",{id:c.id,offset:M.nextOffset}),!M)return;Y+=M.text||""}A(Y),O(c.variant||"document"),y(c.title),T(c.id)};return ie?n.createElement("section",{"aria-label":"Output relationships"},n.createElement("h3",null,"Outputs & review"),n.createElement("p",null,"Keep exact saved versions, their origin and review notes with this conversation."),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:s,disabled:d,onChange:M=>{l(M.target.checked),me(0,M.target.checked)}}),"Include unlinked outputs"),n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":"outputs.list",onClick:()=>me()},"Inspect outputs"),a.map(M=>n.createElement("div",{className:"a-selection-card",key:M.id},n.createElement("strong",null,M.title),n.createElement("p",null,M.kind," · version ",M.version," · ",M.linked?"linked":"unlinked"),n.createElement("small",null,M.versionEvidence==="snapshot"?"Saved exact content":M.externalVersion?"Version reference: "+M.externalVersion:"External reference; version unknown"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":"outputs.read",onClick:()=>_e(M.id)},"Read saved output"),n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":M.linked?"outputs.unlink":"outputs.relink",onClick:async()=>{await Ee(M.linked?"outputs.unlink":"outputs.relink",{id:M.id,expectedRevision:M.revision})&&((c==null?void 0:c.id)===M.id&&u(null),await me())}},M.linked?"Unlink":"Restore link")))),o!==null&&n.createElement("button",{type:"button",disabled:d,className:"a-soft",onClick:()=>me(o)},"More outputs"),c&&n.createElement("div",{className:"a-selection-card","aria-label":"Saved output detail"},n.createElement("h4",null,c.title),n.createElement("p",null,c.versionEvidence==="snapshot"?"Immutable saved content":"External reference only; remote contents were not fetched."),c.text!==void 0&&n.createElement("pre",{className:"a-state-view",style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}},c.text),c.nextOffset!==null&&c.nextOffset!==void 0&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,onClick:()=>Ee("outputs.read",{id:c.id,offset:c.nextOffset},M=>u(Y=>({...M,text:Y.text+M.text})))},"Read more"),c.downloadUrl&&n.createElement("a",{href:c.downloadUrl,download:!0},"Download exact version"),c.binary&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,"data-action":"outputs.image",onClick:()=>Ee("outputs.image",{id:c.id,sha256:c.sha256},M=>u(Y=>({...Y,image:M})))},"View saved PNG"),c.image&&n.createElement("figure",null,n.createElement("img",{src:c.image.imageUrl,alt:"Saved output: "+c.title,style:{maxWidth:"100%",height:"auto"}}),n.createElement("figcaption",null,"Exact saved image · ",c.image.width," × ",c.image.height,". Viewing does not send a message.")),c.url&&n.createElement("a",{href:c.url,target:"_blank",rel:"noopener noreferrer"},"Open external reference"),n.createElement("p",null,"Origin: ",c.origin.source,c.origin.messageId?" · message "+c.origin.messageId:" · no originating message supplied"),c.sha256&&n.createElement("small",{style:{overflowWrap:"anywhere"}},"Content hash: ",c.sha256),c.parentId&&n.createElement("button",{type:"button",className:"a-link",disabled:d,onClick:()=>_e(c.parentId)},"Read prior version"),(ue=c.evidenceIds)==null?void 0:ue.map(M=>n.createElement("button",{type:"button",className:"a-link",key:M,disabled:d,onClick:()=>_e(M)},"Read evidence ",M)),c.kind==="writing"&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,onClick:De},"Edit as a new version"),n.createElement("h4",null,"Local review notes"),c.nextCommentOffset!==null&&c.nextCommentOffset!==void 0&&n.createElement("button",{type:"button",className:"a-soft",disabled:d,onClick:()=>Ee("outputs.read",{id:c.id,commentOffset:c.nextCommentOffset},M=>u(Y=>({...Y,comments:[...Y.comments||[],...M.comments],nextCommentOffset:M.nextCommentOffset})))},"More review notes"),(ye=c.comments)==null?void 0:ye.map(M=>n.createElement("p",{key:M.id},M.path&&`${M.path}:${M.line} (${M.side}) · `,M.body)),n.createElement("form",{onSubmit:async M=>{M.preventDefault(),await Ee("outputs.comment",{id:c.id,body:U,...P?{path:ne,side:Z,line:Number(P)}:{}})&&(_(""),await _e(c.id))}},n.createElement("label",{htmlFor:"output-comment"},"Review note"),n.createElement("textarea",{id:"output-comment",disabled:d,value:U,onChange:M=>_(M.target.value),maxLength:8e3}),c.kind==="git_review"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"output-comment-path"},"Diff file (optional)"),n.createElement("input",{id:"output-comment-path",value:ne,disabled:d,onChange:M=>H(M.target.value)}),n.createElement("label",{htmlFor:"output-comment-line"},"Displayed line (optional)"),n.createElement("input",{id:"output-comment-line",type:"number",min:"1",value:P,disabled:d,onChange:M=>G(M.target.value)}),n.createElement("label",{htmlFor:"output-comment-side"},"Diff side"),n.createElement("select",{id:"output-comment-side",disabled:d,value:Z,onChange:M=>D(M.target.value)},n.createElement("option",{value:"right"},"Updated"),n.createElement("option",{value:"left"},"Original"))),n.createElement("button",{className:"a-primary",disabled:d||!U.trim(),"data-action":"outputs.comment"},"Save local review note")),n.createElement("p",null,"Review notes stay here. They are not posted to a remote service.")),n.createElement("h4",null,"Attach an output"),n.createElement("form",{onSubmit:M=>{M.preventDefault(),Je("outputs.attach",{kind:f,title:E,...f==="canvas"?{canvasId:b}:["file","dataset"].includes(f)?{path:b}:{url:b,...w?{version:w}:{}}})}},n.createElement("label",{htmlFor:"output-kind"},"Output type"),n.createElement("select",{id:"output-kind",value:f,disabled:d,onChange:M=>g(M.target.value)},["file","dataset","canvas","pull_request","external_document"].map(M=>n.createElement("option",{key:M,value:M},M.replaceAll("_"," ")))),n.createElement("label",{htmlFor:"output-title"},"Output title"),n.createElement("input",{id:"output-title",value:E,disabled:d,maxLength:200,onChange:M=>y(M.target.value)}),n.createElement("label",{htmlFor:"output-location"},f==="canvas"?"Saved canvas ID":["file","dataset"].includes(f)?"File in this workspace":"External URL"),n.createElement("input",{id:"output-location",disabled:d,value:b,onChange:M=>S(M.target.value)}),["pull_request","external_document"].includes(f)&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"output-version"},"Version reference (optional)"),n.createElement("input",{id:"output-version",disabled:d,value:w,onChange:M=>N(M.target.value)})),n.createElement("button",{className:"a-primary",disabled:d||!E.trim()||!b.trim(),"data-action":"outputs.attach"},"Attach output")),n.createElement("h4",null,"Reusable writing"),n.createElement("form",{onSubmit:async M=>{M.preventDefault(),await Je("outputs.write",{title:E||"Writing",content:x,variant:C,...k?{parentId:k}:{}})&&T(null)}},n.createElement("label",{htmlFor:"writing-variant"},"Writing type"),n.createElement("select",{id:"writing-variant",value:C,disabled:d,onChange:M=>O(M.target.value)},["document","email","chat_message","social_post","standard"].map(M=>n.createElement("option",{key:M,value:M},M.replaceAll("_"," ")))),n.createElement("label",{htmlFor:"writing-content"},"Writing content"),n.createElement("textarea",{id:"writing-content",rows:6,value:x,disabled:d,maxLength:1e5,onChange:M=>A(M.target.value)}),n.createElement("p",null,k?"Saving creates a new version; the prior version remains.":"Saving keeps a copy here; it does not send or publish."),n.createElement("button",{className:"a-primary",disabled:d||!x.trim(),"data-action":"outputs.write"},"Save writing version"),k&&n.createElement("button",{type:"button",className:"a-soft",onClick:()=>T(null)},"Start separate output")),n.createElement("h4",null,"Git review"),n.createElement("form",{onSubmit:M=>{M.preventDefault(),Je("outputs.review",{mode:I,...I==="branch"?{base:z}:{},...W?{path:W}:{}})}},n.createElement("label",{htmlFor:"review-mode"},"Changes to inspect"),n.createElement("select",{id:"review-mode",value:I,disabled:d,onChange:M=>F(M.target.value)},n.createElement("option",{value:"unstaged"},"Unstaged tracked changes"),n.createElement("option",{value:"staged"},"Staged changes"),n.createElement("option",{value:"branch"},"Base revision to HEAD")),I==="branch"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"review-base"},"Existing base revision"),n.createElement("input",{id:"review-base",value:z,disabled:d,onChange:M=>q(M.target.value)})),n.createElement("label",{htmlFor:"review-path"},"Relative file path (optional)"),n.createElement("input",{id:"review-path",value:W,disabled:d,onChange:M=>X(M.target.value)}),n.createElement("button",{className:"a-primary",disabled:d||I==="branch"&&!z.trim(),"data-action":"outputs.review"},"Save review snapshot")),n.createElement("p",null,"Untracked files and binary contents are excluded. This only reads changes."),m&&n.createElement("p",{role:"alert"},m)):n.createElement("p",null,"Choose a conversation to inspect its outputs.")}const Mc=new Map;function TF(e){return Mc.has(e)||Mc.set(e,{pending:null,busy:!1,listeners:new Set}),Mc.get(e)}function ii(e){e.listeners.forEach(t=>t())}const to=e=>typeof e=="string"?e:(e==null?void 0:e.message)||JSON.stringify(e||"The action failed."),Jf=(e,t)=>Object.assign(Error(e!=null&&e.error?to(e.error):t),{code:e==null?void 0:e.code,state:e==null?void 0:e.state,receipt:e==null?void 0:e.receipt,status:e==null?void 0:e.status}),IF=e=>{var t;return(e==null?void 0:e.code)==="unknown_outcome"||["unknown","running"].includes(e==null?void 0:e.state)||["unknown","running"].includes((t=e==null?void 0:e.receipt)==null?void 0:t.state)},gs=e=>{try{const t=new URL(e);return["http:","https:"].includes(t.protocol)?t.href:null}catch{return null}},vs={targetId:"",label:"",hostname:"",username:"",python:"",socketPath:"",expectedBind:"127.0.0.1"};function AF({session:e,act:t}){var Ze,it,zt,ct,qt,le,fe,xe,ze,Ye,ht,bt,ft,Ce,gt,Et,vt,at,ee,Re;const a=e==null?void 0:e.id,r=TF(a),[,o]=v.useReducer(ae=>ae+1,0),i=((Ze=r.pending)==null?void 0:Ze.args.targetId)||"loopback",s=v.useRef(i),[l,c]=v.useState(i),[u,d]=v.useState(null),[p,m]=v.useState({...vs}),[h,f]=v.useState(0),[g,E]=v.useState(null),[y,b]=v.useState(((it=r.pending)==null?void 0:it.args.siteId)||""),[S,w]=v.useState(""),[N,x]=v.useState(((zt=r.pending)==null?void 0:zt.args.releaseId)||""),[A,C]=v.useState(""),[O,k]=v.useState(!1),[T,I]=v.useState(""),[F,z]=v.useState(""),[q,W]=v.useState(null),X=v.useRef(!0),U=v.useRef(!1);v.useEffect(()=>(X.current=!0,r.listeners.add(o),()=>{X.current=!1,r.listeners.delete(o)}),[r]);const _=ae=>{X.current&&ae()},P=(g==null?void 0:g.sites)||[],G=(g==null?void 0:g.releases)||[],Z=P.find(ae=>ae.id===y),D=G.find(ae=>ae.id===N&&ae.siteId===y),ne=(u==null?void 0:u.targets)||[],H=ne.find(ae=>ae.id===l),j=r.busy||O,ie=j||!!r.pending,Ee=G.filter(ae=>ae.siteId===y),me=(u==null?void 0:u.selectedTargetId)===l&&((H==null?void 0:H.kind)==="loopback"||((ct=H==null?void 0:H.inspection)==null?void 0:ct.revision)===(H==null?void 0:H.revision)&&u.selectedTargetRevision===H.revision&&u.selectedServiceId===((qt=H.inspection)==null?void 0:qt.serviceId)),_e=ie||!me,Je=((le=g==null?void 0:g.target)==null?void 0:le.accessPolicy)||((xe=(fe=H==null?void 0:H.inspection)==null?void 0:fe.capabilities)==null?void 0:xe.accessPolicy);function De(ae){s.current!==ae&&(s.current=ae,_(()=>{c(ae),E(null),b(""),x(""),C(""),W(null)}))}async function ue(ae,Le={},Oe=s.current){const et=await t(ae,{sessionId:a,...ae.startsWith("publishing.target.")?{}:{targetId:Oe},...Le});if(!(et!=null&&et.accepted))throw Jf(et,"The server did not confirm this request.");return et.result}async function ye({reconcile:ae=!1,followSelection:Le=!1,target:Oe=s.current}={}){var It,xt,Ut;const et=await ue("publishing.target.list");if(_(()=>d(et)),Le&&(Oe=((It=r.pending)==null?void 0:It.args.targetId)||et.selectedTargetId||"loopback"),De(Oe),(xt=r.pending)!=null&&xt.action.startsWith("publishing.target."))return et;const st=await ue("publishing.list",{},Oe);if(_(()=>E(st)),ae&&r.pending&&r.pending.args.targetId===Oe){const rt=(Ut=st.receipts)==null?void 0:Ut.find(Xe=>Xe.requestId===r.pending.args.requestId);["unknown","running"].includes(rt==null?void 0:rt.state)?(r.pending={...r.pending,receipt:rt},ii(r),_(()=>z(rt.state==="unknown"?"The saved receipt records an unknown outcome. Nothing was replayed.":"The saved receipt is still running. Nothing was replayed."))):rt&&["succeeded","failed"].includes(rt.state)&&(r.pending=null,ii(r),_(()=>rt.state==="failed"?I(to(rt.error)):z("The saved receipt confirms this request succeeded.")))}return st}async function M(ae="publishing.list",Le=!0){if(!(r.busy||U.current)){U.current=!0,k(!0),I("");try{ae==="publishing.list"?await ye({reconcile:Le,followSelection:!0}):(W({action:ae,value:await ue(ae,{siteId:y})}),ae==="publishing.status"&&await ye())}catch(Oe){I(Oe.message)}finally{U.current=!1,k(!1)}}}v.useEffect(()=>{a&&M("publishing.list",!1)},[a]);async function Y(ae,Le,Oe=!1){var xt,Ut;if(r.busy||U.current||!Oe&&r.pending)return;const et=ae==null?void 0:ae.startsWith("publishing.target.");if(!Oe&&!et&&!me){I("Inspect and select this exact target before starting another publishing action.");return}const st=Oe?r.pending:{action:ae,args:{sessionId:a,...et?{}:{targetId:s.current,...(H==null?void 0:H.kind)==="ssh"?{targetRevision:H.revision,serviceId:H.inspection.serviceId}:{},requestId:crypto.randomUUID()},...Le}};if(!st)return;const It=st.action.startsWith("publishing.target.");r.pending=st,r.busy=!0,ii(r),I(""),z("");try{const rt=await t(st.action,st.args);if(!(rt!=null&&rt.accepted))throw Jf(rt,"The connection ended before the outcome was confirmed.");const Xe=rt.result;if(It){if(!Array.isArray(Xe==null?void 0:Xe.targets))throw Error("The server returned no complete target state.");r.pending=null,_(()=>{d(Xe),z(st.action==="publishing.target.save"?"Target saved. No connection was made.":st.action==="publishing.target.inspect"?"Target identity and capabilities inspected.":st.action==="publishing.target.remove"?"Target configuration removed. Existing remote sites were not stopped.":"Publishing target selected.")}),st.action==="publishing.target.save"&&_(()=>{var $e;f((($e=Xe.targets.find(Nt=>Nt.id===st.args.targetId))==null?void 0:$e.revision)??0),st.args.targetId===s.current&&E(null)}),st.action==="publishing.target.select"&&(De(Xe.selectedTargetId),await ye({target:Xe.selectedTargetId}))}else{if(!Xe||(st.action==="publishing.build"?!Xe.id:!["succeeded","failed","unknown","running"].includes(Xe.state)))throw Error("The server returned no complete publishing receipt.");(Xe==null?void 0:Xe.state)==="unknown"||(Xe==null?void 0:Xe.state)==="running"?(r.pending={...st,receipt:Xe},_(()=>I(to(Xe.error||"The outcome is not confirmed. Inspect receipts before continuing.")))):(Xe==null?void 0:Xe.state)==="failed"?(r.pending=null,_(()=>I(to(Xe.error)))):(r.pending=null,_(()=>{z(st.action.slice(11)+" completed."),st.action==="publishing.build"&&(b(Xe.siteId),x(Xe.id),C(""))}));try{await ye({target:st.args.targetId})}catch($e){_(()=>I("The action returned, but the list could not refresh. "+$e.message))}}}catch(rt){const Xe=["succeeded","failed"].includes((xt=rt.receipt)==null?void 0:xt.state);if(IF(rt)||Oe&&st.args.requestId&&!Xe)["unknown","running"].includes((Ut=rt.receipt)==null?void 0:Ut.state)&&(r.pending={...st,receipt:rt.receipt}),_(()=>I(rt.message+" Keep this request unchanged until its outcome is known."));else if(Xe||rt.status>=400&&rt.status<500&&rt.status!==408){r.pending=null,_(()=>{var $e;return(($e=rt.receipt)==null?void 0:$e.state)==="succeeded"?z("The saved receipt confirms this request succeeded."):I(rt.message)});try{if(It){const $e=await ue("publishing.target.list");_(()=>d($e))}else await ye({target:st.args.targetId})}catch{}}else _(()=>I(rt.message+" Keep this request unchanged until its outcome is known."))}finally{r.busy=!1,ii(r)}}function se(){var ae,Le;r.busy||((Le=(ae=r.pending)==null?void 0:ae.receipt)==null?void 0:Le.state)!=="unknown"||(r.pending=null,ii(r),I(""),z("Unknown outcome acknowledged. Inspect the current site status. Any site marked unknown requires an explicit stop or remove action."))}function Fe(ae){b(ae),x(""),C(""),W(null)}function je(ae){f(ae.revision),m(Object.fromEntries(Object.keys(vs).map(Le=>[Le,Le==="targetId"?ae.id:ae[Le]||vs[Le]])))}function oe(ae){ae.preventDefault(),Y("publishing.target.save",{...p,...p.username?{}:{username:void 0},expectedRevision:h})}return a?n.createElement("section",{className:"a-publishing","aria-label":"Managed publishing"},n.createElement("h3",null,"Publishing"),n.createElement("p",null,"Save a built site as an immutable release, preview it, record your review, and explicitly deploy that version."),n.createElement("div",{className:"a-selection-card","aria-label":"Publishing target"},n.createElement("strong",null,(H==null?void 0:H.label)||((Ye=(ze=g==null?void 0:g.target)==null?void 0:ze.host)==null?void 0:Ye.label)||"Local server"),n.createElement("p",null,"Target: ",n.createElement("code",null,l),(u==null?void 0:u.selectedTargetId)!==l&&u&&" · task selection: "+u.selectedTargetId),n.createElement("p",null,"Access: ",Je||(l==="loopback"?"loopback-only":"Not inspected")),u&&!me&&n.createElement("p",null,"Inspect and select this exact target before starting another publishing action."),n.createElement("p",null,((ht=g==null?void 0:g.target)==null?void 0:ht.detail)||"URLs belong to the publishing service host."),n.createElement("p",{className:"a-caption"},"A loopback URL opens only on the service host. No tunnel, service installation, credentials, or public route is created here.")),n.createElement("details",{className:"a-publishing-targets"},n.createElement("summary",null,"Publishing targets for this task"),n.createElement("div",{"aria-label":"Publishing targets"},ne.map(ae=>{var et;const Le=((et=ae.inspection)==null?void 0:et.revision)===ae.revision?ae.inspection:null,Oe=Le==null?void 0:Le.capabilities;return n.createElement("div",{className:"a-selection-card",key:ae.id,"aria-label":"Target "+ae.id},n.createElement("h4",null,ae.label),n.createElement("p",null,n.createElement("code",null,ae.id)," · revision ",ae.revision,u.selectedTargetId===ae.id?u.selectedTargetRevision===ae.revision?" · selected":" · configuration changed; inspect and select again":""),ae.kind==="ssh"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Configured SSH destination: ",ae.username?ae.username+"@":"",ae.hostname),n.createElement("p",null,"Expected bind: ",n.createElement("code",null,ae.expectedBind),". Access policy is verified by inspection of the service."),Le?n.createElement("dl",null,n.createElement("dt",null,"Inspected service"),n.createElement("dd",null,Le.serviceId),n.createElement("dt",null,"Actual bind"),n.createElement("dd",null,Oe==null?void 0:Oe.bind),n.createElement("dt",null,"Access policy"),n.createElement("dd",null,Oe==null?void 0:Oe.accessPolicy),n.createElement("dt",null,"Authentication"),n.createElement("dd",null,Oe==null?void 0:Oe.authentication)):n.createElement("p",null,"Not inspected. Service identity and access policy are unverified.")),n.createElement("div",{className:"a-dialog-actions"},ae.kind==="ssh"&&n.createElement("button",{type:"button",className:"a-soft",disabled:ie,"data-action":"publishing.target.inspect",onClick:()=>Y("publishing.target.inspect",{targetId:ae.id,expectedRevision:ae.revision})},"Inspect target"),n.createElement("button",{type:"button",className:"a-soft",disabled:ie||ae.kind==="loopback"&&u.selectedTargetId===ae.id||ae.kind==="ssh"&&!Le,"data-action":"publishing.target.select",onClick:()=>Y("publishing.target.select",{targetId:ae.id,expectedRevision:ae.revision,...Le?{serviceId:Le.serviceId}:{}})},"Select target"),ae.kind==="ssh"&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-soft",disabled:ie,onClick:()=>je(ae)},"Edit target"),n.createElement("button",{type:"button",className:"a-soft a-danger",disabled:ie||u.selectedTargetId===ae.id,"data-action":"publishing.target.remove",onClick:()=>Y("publishing.target.remove",{targetId:ae.id,expectedRevision:ae.revision})},"Remove target configuration"))))}),n.createElement("h4",null,"Save a target configuration"),n.createElement("p",null,"Use an existing SSH account and running publishing service. Saving these paths does not connect or install anything. Only unused configurations can be removed; configurations with publishing records remain available for control and audit. Removing a configuration does not stop sites on that service."),n.createElement("form",{onSubmit:oe},[["targetId","Target ID"],["label","Target label"],["hostname","SSH hostname"],["username","SSH username (optional)"],["python","Remote Python path"],["socketPath","Remote service socket"],["expectedBind","Expected bind address"]].map(([ae,Le])=>n.createElement(n.Fragment,{key:ae},n.createElement("label",{htmlFor:"publishing-target-"+ae},Le),n.createElement("input",{id:"publishing-target-"+ae,value:p[ae],required:ae!=="username",disabled:ie,onChange:Oe=>{ae==="targetId"&&f(0),m(et=>({...et,[ae]:Oe.target.value}))}}))),n.createElement("button",{className:"a-primary",disabled:ie,"data-action":"publishing.target.save"},"Save target configuration"),n.createElement("button",{type:"button",className:"a-soft",disabled:ie,onClick:()=>{m({...vs}),f(0)}},"Clear target form")))),n.createElement("button",{type:"button",className:"a-soft","data-action":"publishing.list",disabled:j,onClick:()=>M()},"Inspect publishing"),T&&n.createElement("p",{role:"alert"},T),F&&n.createElement("p",{role:"status"},F),r.pending&&n.createElement("div",{className:"a-selection-card","aria-label":"Unconfirmed publishing request"},n.createElement("strong",null,r.busy?"Request in progress":((bt=r.pending.receipt)==null?void 0:bt.state)==="unknown"?"Recorded unknown outcome":"Request outcome unconfirmed"),n.createElement("p",null,r.pending.action," · target ",n.createElement("code",null,r.pending.args.targetId)," · ",r.pending.args.siteId||r.pending.args.releaseId),r.pending.args.requestId&&n.createElement("code",null,r.pending.args.requestId),n.createElement("p",null,"The exact submitted arguments are retained while this browser page stays open. Inspect publishing to check the saved receipt, or retry this same request. Nothing is retried automatically."),((ft=r.pending.receipt)==null?void 0:ft.state)==="unknown"?n.createElement(n.Fragment,null,n.createElement("p",null,to(r.pending.receipt.error)),n.createElement("button",{type:"button",className:"a-soft",disabled:j,onClick:se},"Acknowledge unknown outcome"),n.createElement("p",null,"Acknowledgement dismisses this pending request only. It does not repeat or resolve the operation; any site marked unknown requires an explicit stop or remove action.")):n.createElement("button",{type:"button",className:"a-soft",disabled:j,"data-action":r.pending.action,onClick:()=>Y(null,null,!0)},"Retry exact request")),n.createElement("h4",null,"Sites"),g&&!P.length&&n.createElement("p",null,"No sites yet. Capture a release below to get started."),n.createElement("div",{className:"a-publishing-sites"},P.map(ae=>n.createElement("button",{type:"button",className:"a-selection-card",key:ae.id,disabled:_e,"aria-pressed":y===ae.id,onClick:()=>Fe(ae.id)},n.createElement("strong",null,ae.id),n.createElement("span",null,ae.status," · revision ",ae.revision)))),n.createElement("h4",null,"Capture built output"),n.createElement("p",null,"Build with your existing project tools first, then enter its output folder relative to this task’s execution folder. Capturing preserves the current files as a new release."),n.createElement("form",{onSubmit:ae=>{ae.preventDefault(),Y("publishing.build",{siteId:y.trim(),sourcePath:S.trim()})}},n.createElement("label",{htmlFor:"publishing-site"},"Site ID"),n.createElement("input",{id:"publishing-site",value:y,disabled:_e,maxLength:63,pattern:"[a-z0-9][a-z0-9-]{0,62}",onChange:ae=>Fe(ae.target.value),placeholder:"my-site"}),n.createElement("label",{htmlFor:"publishing-source"},"Built output folder"),n.createElement("input",{id:"publishing-source",value:S,disabled:_e,onChange:ae=>w(ae.target.value),placeholder:"dist"}),n.createElement("button",{className:"a-primary","data-action":"publishing.build",disabled:_e||!y.trim()||!S.trim()},"Capture release")),y&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Saved releases for ",y),n.createElement("label",{htmlFor:"publishing-release"},"Release to preview, review, or deploy"),n.createElement("select",{id:"publishing-release",value:(D==null?void 0:D.id)||"",disabled:_e,onChange:ae=>{x(ae.target.value),C("")}},n.createElement("option",{value:""},"Choose a saved release"),Ee.map(ae=>n.createElement("option",{key:ae.id,value:ae.id},ae.createdAt," · ",ae.id)))),D&&n.createElement("div",{className:"a-selection-card","aria-label":"Selected release"},n.createElement("h4",null,"Exact release"),n.createElement("dl",null,n.createElement("dt",null,"Release ID"),n.createElement("dd",null,D.id),n.createElement("dt",null,"Manifest digest"),n.createElement("dd",null,D.manifestDigest),n.createElement("dt",null,"Files"),n.createElement("dd",null,((Ce=D.files)==null?void 0:Ce.length)||0," · ",D.totalBytes||0," bytes"),n.createElement("dt",null,"Preview"),n.createElement("dd",null,D.previewStatus||"none"),n.createElement("dt",null,"Review"),n.createElement("dd",null,D.review?`Reviewed: ${D.review.note}`:"Not reviewed")),n.createElement("details",null,n.createElement("summary",null,"Release files"),n.createElement("ul",null,(gt=D.files)==null?void 0:gt.map(ae=>n.createElement("li",{key:ae.path},n.createElement("strong",null,ae.path)," · ",ae.size," bytes",n.createElement("br",null),n.createElement("code",null,ae.sha256))))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:_e,"data-action":"publishing.preview",onClick:()=>Y("publishing.preview",{releaseId:D.id})},"Start preview"),D.previewStatus==="running"&&gs(D.previewUrl)&&n.createElement("a",{href:gs(D.previewUrl),target:"_blank",rel:"noopener noreferrer"},"Open exact release preview")),n.createElement("form",{onSubmit:ae=>{ae.preventDefault(),Y("publishing.review",{releaseId:D.id,note:A.trim()})}},n.createElement("label",{htmlFor:"publishing-note"},"Review note for this exact release"),n.createElement("textarea",{id:"publishing-note",value:A,disabled:_e,maxLength:4e3,onChange:ae=>C(ae.target.value)}),n.createElement("button",{className:"a-soft","data-action":"publishing.review",disabled:_e||!A.trim()},"Record review")),n.createElement("p",null,"Deploy release ",n.createElement("code",null,D.id)," to ",n.createElement("strong",null,y)," on target ",n.createElement("strong",null,l)," with ",n.createElement("strong",null,((Et=g==null?void 0:g.target)==null?void 0:Et.accessPolicy)||((at=(vt=H==null?void 0:H.inspection)==null?void 0:vt.capabilities)==null?void 0:at.accessPolicy)||"unverified")," access."),n.createElement("button",{type:"button",className:"a-primary",disabled:_e||!D.review||(Z==null?void 0:Z.status)==="unknown"||!Je,"data-action":"publishing.deploy",onClick:()=>Y("publishing.deploy",{siteId:y,releaseId:D.id,expectedRevision:(Z==null?void 0:Z.revision)??0})},"Deploy reviewed release")),Z&&n.createElement("div",{className:"a-selection-card","aria-label":"Site status"},n.createElement("h4",null,Z.id),n.createElement("dl",null,n.createElement("dt",null,"Status"),n.createElement("dd",null,Z.status),n.createElement("dt",null,"Revision"),n.createElement("dd",null,Z.revision),n.createElement("dt",null,"Access policy"),n.createElement("dd",null,Z.accessPolicy),n.createElement("dt",null,"Deployed release"),n.createElement("dd",null,Z.releaseId||"None"),n.createElement("dt",null,"Previous release"),n.createElement("dd",null,Z.previousReleaseId||"None")),gs(Z.url)&&n.createElement("p",null,n.createElement("a",{href:gs(Z.url),target:"_blank",rel:"noopener noreferrer"},"Open deployed site"),n.createElement("br",null),n.createElement("code",null,Z.url)),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:j,"data-action":"publishing.status",onClick:()=>M("publishing.status")},"Check site status"),n.createElement("button",{type:"button",className:"a-soft",disabled:j,"data-action":"publishing.logs",onClick:()=>M("publishing.logs")},"Read site logs")),Z.previousReleaseId&&n.createElement(n.Fragment,null,n.createElement("p",null,"Rollback restores release ",n.createElement("code",null,Z.previousReleaseId),"."),n.createElement("button",{type:"button",className:"a-soft",disabled:_e,"data-action":"publishing.rollback",onClick:()=>Y("publishing.rollback",{siteId:y,releaseId:Z.previousReleaseId,expectedRevision:Z.revision})},"Roll back to previous release")),n.createElement("p",null,"Stopping or removing this site preserves its saved releases and receipts."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft",disabled:_e||["stopped","removed"].includes(Z.status),"data-action":"publishing.stop",onClick:()=>Y("publishing.stop",{siteId:y,expectedRevision:Z.revision})},"Stop site"),n.createElement("button",{type:"button",className:"a-soft a-danger",disabled:_e||Z.status==="removed","data-action":"publishing.remove",onClick:()=>Y("publishing.remove",{siteId:y,expectedRevision:Z.revision})},"Remove site"))),q&&n.createElement("div",{"aria-label":"Publishing inspection"},n.createElement("h4",null,q.action==="publishing.logs"?"Site logs":"Current site status"),n.createElement("pre",{className:"a-state-view"},JSON.stringify(q.value,null,2))),n.createElement("details",null,n.createElement("summary",null,"Durable publishing receipts (",((ee=g==null?void 0:g.receipts)==null?void 0:ee.length)||0,")"),n.createElement("div",{"aria-label":"Publishing receipts"},(Re=g==null?void 0:g.receipts)==null?void 0:Re.map(ae=>n.createElement("div",{className:"a-selection-card",key:ae.id},n.createElement("strong",null,ae.action," · ",ae.state),n.createElement("p",null,ae.siteId," · ",ae.createdAt),n.createElement("p",null,"Request: ",n.createElement("code",null,ae.requestId)),ae.releaseId&&n.createElement("p",null,"Release: ",n.createElement("code",null,ae.releaseId)),ae.error&&n.createElement("p",null,to(ae.error))))))):n.createElement("p",null,"Choose a conversation to manage its published sites.")}const _F=[{id:"gpt-live-1",name:"GPT Live 1",description:"A natural conversation: listen and speak at the same time.",source:"https://developers.openai.com/api/docs/guides/live-conversations",voices:[{id:"marin",name:"Marin",description:"The default GPT Live voice."},{id:"cedar",name:"Cedar",description:"Built-in OpenAI voice."},{id:"alloy",name:"Alloy",description:"Built-in OpenAI voice."},{id:"ash",name:"Ash",description:"Built-in OpenAI voice."},{id:"ballad",name:"Ballad",description:"Built-in OpenAI voice."},{id:"coral",name:"Coral",description:"Built-in OpenAI voice."},{id:"echo",name:"Echo",description:"Built-in OpenAI voice."},{id:"sage",name:"Sage",description:"Built-in OpenAI voice."},{id:"shimmer",name:"Shimmer",description:"Built-in OpenAI voice."},{id:"verse",name:"Verse",description:"Built-in OpenAI voice."},{id:"quartz",name:"Quartz",description:"English · Australian influence · feminine"},{id:"ripple",name:"Ripple",description:"English · Australian influence · masculine"},{id:"vesper",name:"Vesper",description:"English · British influence · masculine"},{id:"willow",name:"Willow",description:"English · Irish influence · feminine"},{id:"stone",name:"Stone",description:"English · Irish influence · masculine"},{id:"gleam",name:"Gleam",description:"English · North American influence · feminine"},{id:"meridian",name:"Meridian",description:"English · North American influence · masculine"},{id:"bossa",name:"Bossa",description:"Portuguese · Brazilian influence · feminine"},{id:"tempo",name:"Tempo",description:"Portuguese · Brazilian influence · masculine"},{id:"beacon",name:"Beacon",description:"English · Filipino influence · masculine"},{id:"delta",name:"Delta",description:"English · Southern U.S. influence · feminine"},{id:"cinder",name:"Cinder",description:"English · Southern U.S. influence · masculine"}],reference:"https://developers.openai.com/api/reference/resources/live/primary-websocket"},{id:"gpt-realtime-2.1",name:"GPT Realtime 2.1",description:"A responsive voice conversation with turn detection.",source:"https://developers.openai.com/api/docs/guides/realtime-conversations",voices:[{id:"marin",name:"Marin",description:"Recommended for best quality."},{id:"cedar",name:"Cedar",description:"Recommended for best quality."},{id:"alloy",name:"Alloy",description:"OpenAI Realtime voice."},{id:"ash",name:"Ash",description:"OpenAI Realtime voice."},{id:"ballad",name:"Ballad",description:"OpenAI Realtime voice."},{id:"coral",name:"Coral",description:"OpenAI Realtime voice."},{id:"echo",name:"Echo",description:"OpenAI Realtime voice."},{id:"sage",name:"Sage",description:"OpenAI Realtime voice."},{id:"shimmer",name:"Shimmer",description:"OpenAI Realtime voice."},{id:"verse",name:"Verse",description:"OpenAI Realtime voice."}]}],bs={models:_F};function PF({state:e,act:t}){const a=e.settings||{},r=bs.models.find(_=>_.id===a.preferredVoice)||bs.models[0],o=r.voices.find(_=>_.id===a.voiceName)||r.voices[0],i=e.voiceConfiguration,[s,l]=n.useState(""),[c,u]=n.useState(""),[d,p]=n.useState(""),[m,h]=n.useState(!1),[f,g]=n.useState(""),[E,y]=n.useState(!1),[b,S]=n.useState(null),[w,N]=n.useState(""),x=n.useRef(null);n.useLayoutEffect(()=>{var _,P;E&&((_=x.current)==null||_.focus(),(P=x.current)==null||P.scrollIntoView({block:"start"}))},[E]);const A=n.useRef(null),C=n.useRef(null),O=n.useRef(!0),k=n.useRef(0);n.useEffect(()=>(O.current=!0,t("voice.configuration").catch(_=>l(_.message)),()=>{var _;O.current=!1,k.current++,(_=C.current)==null||_.pause(),A.current&&URL.revokeObjectURL(A.current)}),[]);const T=()=>{var _;(_=C.current)==null||_.pause(),S(null),A.current&&(URL.revokeObjectURL(A.current),A.current=null)},I=d||((i==null?void 0:i.source)==="private"?"private":i!=null&&i.environmentAvailable?"environment":"private"),F=async _=>{l("");try{const P=await t("settings.update",{patch:_});if((P==null?void 0:P.accepted)===!1)throw Error(P.error||"Could not save voice settings.")}catch(P){l(P.message)}};async function z(){h(!0),l("");try{const _=await t("voice.configure",{source:I,...I==="private"?{apiKey:c}:{}});if((_==null?void 0:_.accepted)===!1)throw Error(_.error||"Could not save voice key.");u("")}catch(_){l(_.message)}finally{h(!1)}}async function q(_){var G;if(w)return;const P=++k.current;N(_.id),l(""),T();try{const Z=await t("voice.preview",{model:r.id,voice:_.id});if((Z==null?void 0:Z.accepted)===!1||!((G=Z==null?void 0:Z.result)!=null&&G.audio))throw Error((Z==null?void 0:Z.error)||"The sample was unavailable. Try again.");if(O.current&&P===k.current){const D=Uint8Array.from(atob(Z.result.audio),ne=>ne.charCodeAt(0));A.current=URL.createObjectURL(new Blob([D],{type:Z.result.mimeType})),S({...Z.result,audio:void 0,url:A.current,name:_.name})}}catch(Z){O.current&&P===k.current&&l(Z.message)}finally{O.current&&P===k.current&&N("")}}const W=_=>{T(),F({voiceName:_.id}),y(!1)},X=r.voices.filter(_=>(_.name+" "+_.description).toLowerCase().includes(f.toLowerCase())),U=n.createElement("div",{className:"a-voice-key-form"},n.createElement("p",null,"Voice uses an OpenAI API key, separate from a ChatGPT subscription."),(i==null?void 0:i.environmentAvailable)&&n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"radio",name:"voice-key-source",checked:I==="environment",onChange:()=>p("environment")}),"Use the key on this host (OPENAI_API_KEY)"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"radio",name:"voice-key-source",checked:I==="private"||!(i!=null&&i.environmentAvailable),onChange:()=>p("private")}),"Use a separate key"),(I==="private"||!(i!=null&&i.environmentAvailable))&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"voice-api-key"},"OpenAI API key"),n.createElement("input",{id:"voice-api-key",type:"password",autoComplete:"off",value:c,onChange:_=>{p("private"),u(_.target.value)},placeholder:i!=null&&i.privateKeyAvailable?"Saved key · enter a new key to replace it":""})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"voice.configure",disabled:m||(I==="private"||!(i!=null&&i.environmentAvailable))&&!c.trim()&&!(i!=null&&i.privateKeyAvailable),onClick:z},m?"Saving…":"Save voice connection")));return n.createElement("div",{className:"a-voice-settings"},n.createElement("section",{className:"a-voice-connection","aria-label":"Voice connection"},n.createElement("strong",null,i!=null&&i.available?"Voice key configured":i?"Connect voice":"Checking voice connection…"),i!=null&&i.available?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},i.source==="private"?"Using your separate voice API key.":"Using the OpenAI API key on this host."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Change voice connection"),U)):U),n.createElement("label",{htmlFor:"preferred-voice"},"Voice model"),n.createElement("select",{id:"preferred-voice","data-action":"settings.update",disabled:!!w,value:r.id,onChange:_=>{const P=bs.models.find(G=>G.id===_.target.value);T(),g(""),F({preferredVoice:P.id,voiceName:P.voices.some(G=>G.id===o.id)?o.id:"marin"})}},bs.models.map(_=>n.createElement("option",{key:_.id,value:_.id},_.name))),n.createElement("p",{className:"a-caption"},r.description),n.createElement("h4",{className:"a-voice-label"},"Speaking voice"),n.createElement("div",{className:"a-voice-current"},n.createElement("div",null,n.createElement("strong",null,o.name),n.createElement("p",null,o.description)),n.createElement("button",{className:"a-soft",disabled:!!w,"aria-expanded":E,onClick:()=>y(!E)},E?"Close voice list":"Choose a voice"),n.createElement("button",{className:"a-soft","data-action":"voice.preview",disabled:!(i!=null&&i.available)||!!w||e.voicePreviewBusy,onClick:()=>q(o)},w===o.id?"Preparing sample…":"Preview voice")),E&&n.createElement("section",{className:"a-voice-picker","aria-label":"Choose a speaking voice"},n.createElement("h4",{ref:x,tabIndex:-1},"Voices for ",r.name),n.createElement("label",{htmlFor:"voice-search"},"Find a voice"),n.createElement("input",{id:"voice-search",type:"search",placeholder:"Search names or descriptions",value:f,onChange:_=>g(_.target.value)}),n.createElement("div",{role:"radiogroup","aria-label":"Speaking voice"},X.map(_=>n.createElement("div",{key:_.id,className:"a-voice-option","data-selected":_.id===o.id},n.createElement("label",null,n.createElement("input",{type:"radio",name:"speaking-voice",checked:_.id===o.id,disabled:!!w,"data-action":"settings.update",onChange:()=>W(_)}),n.createElement("span",null,n.createElement("strong",null,_.name),n.createElement("small",null,_.description))),n.createElement("button",{className:"a-soft","aria-label":"Preview "+_.name,disabled:!(i!=null&&i.available)||!!w||e.voicePreviewBusy,"data-action":"voice.preview",onClick:()=>q(_)},w===_.id?"Preparing…":"Preview"),(b==null?void 0:b.voice)===_.id&&n.createElement("audio",{ref:C,controls:!0,autoPlay:!0,"aria-label":b.name+" sample",src:b.url,onError:()=>l("This browser could not play the sample. Try the preview again.")})))),!X.length&&n.createElement("p",null,"No voices match your search.")),b&&!E&&n.createElement("div",{className:"a-voice-sample"},n.createElement("p",null,b.name," · ",r.name),n.createElement("audio",{ref:C,controls:!0,autoPlay:!0,src:b.url,onError:()=>l("This browser could not play the sample. Try the preview again.")},"Your browser does not support audio playback.")),n.createElement("p",{className:"a-caption"},"Previews use a short AI-generated sample and your OpenAI API usage. Your microphone and conversations are not used."),r.id==="gpt-realtime-2.1"&&n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:a.voiceInterruptions!==!1,"data-action":"settings.update",onChange:_=>F({voiceInterruptions:_.target.checked})}),"Let me interrupt by speaking"),n.createElement("p",{className:"a-caption"},"Changes apply to your next call. Your browser manages microphone access."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"About these voices"),n.createElement("div",null,n.createElement("p",null,"Available voices depend on the model. Regional descriptions come from OpenAI; voices can speak other languages too. OpenAI does not describe the tone of every voice. Preview those voices to compare how they sound."),n.createElement("a",{href:r.source,target:"_blank",rel:"noreferrer"},"Voice guide from OpenAI"))),s&&n.createElement("p",{role:"alert",className:"a-danger"},s))}function OF(){return n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("a",{href:"/setup/terminal",target:"_blank",rel:"noopener noreferrer"},"Install the Terminal app on this computer")," to connect to this Unified service. The setup page handles the client and its saved connection."),n.createElement("p",null,"In Edge or Chrome, choose the install icon in the address bar or Install this site as an app in the browser menu. In Safari on Mac, use File → Add to Dock. On iPhone or iPad, use Share → Add to Home Screen."),n.createElement("p",null,"Keep the Python service running on the host computer. Installation gives this interface its own window; the service still runs your conversations and tools."),n.createElement("p",{className:"a-caption"},"Use localhost on this computer, or a trusted HTTPS address on other devices. Your saved chats and canvas artifacts stay on the host."))}const MF={panel:"settings",settingsSection:"index",settingsExpanded:[]};function Ou(e,t){const a={...Ww(e,t)};return["ai-connections","overview"].includes(e)&&(a.aiConnectionEditor={step:"list"}),e==="diagnostics"&&(a.diagnosticsDraft={destinationId:null}),e==="providers"&&(a.providerEditor={detailOpen:!1,orderOpen:!1}),e==="routing"&&(a.routingEditor={detailOpen:!1,candidateOpen:!1,orderOpen:!1}),e==="app-bundles"&&(a.bundleManager={detailOpen:!1,orderOpen:!1}),e==="loaded-modules"&&(a.moduleEditor={detailOpen:!1}),["smart-tools","tool-connections"].includes(e)&&(a.smartToolsEditor={page:"home",catalogDetail:!1}),a}function zF(e,t){const a={...t};for(const r of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])r in a&&(a[r]={...e[r],...a[r]});return a}function LF(e={},t={},a){var u,d,p,m,h,f,g,E,y,b;const{page:r,section:o}=Vw(e,a),i=[{key:"index",title:"Settings",navigation:MF}];if(e.settingsSection==="index"&&e.panel!=="appearance")return i;const s=Ou(r,a),l=Is(r,a);l&&i.push({key:l,title:o.title,navigation:Ou(l,a)}),i.push({key:r,title:bp(r,a),navigation:s});const c=(S,w,N,x)=>i.push({key:S,title:w,navigation:{...s,[N]:{...s[N],...x}}});if(["ai-connections","overview"].includes(r)){const S=e.aiConnectionEditor||{},w=S.step||"list";w!=="list"&&c("ai/"+w,w==="services"?"Connect AI":w==="model"?"Choose model":"AI connection","aiConnectionEditor",{step:w})}else if(r==="diagnostics"){const S=e.diagnosticsDraft||{},w=S.config||((u=t.diagnostics)==null?void 0:u.config),N=(d=w==null?void 0:w.destinations)==null?void 0:d.find(x=>x.id===S.destinationId);N&&c("diagnostics/destination",N.name||"Destination","diagnosticsDraft",{destinationId:N.id})}else if(r==="providers"){const S=e.providerEditor||{};S.order&&S.orderOpen!==!1?c("providers/order","Preference order","providerEditor",{orderOpen:!0}):S.detailOpen&&c("providers/detail",S.id||"Add connection","providerEditor",{detailOpen:!0})}else if(r==="routing"){const S=e.routingEditor||{},w=S.role||"general";(S.detailOpen||S.order&&S.orderOpen!==!1)&&(c("routing/role/"+w,w,"routingEditor",{role:w,detailOpen:!0}),S.order&&S.orderOpen!==!1?c("routing/order/"+w,"Preference order","routingEditor",{role:w,detailOpen:!0,orderOpen:!0}):S.candidateOpen&&c("routing/choice/"+w,"Choice "+((S.candidate||0)+1),"routingEditor",{role:w,detailOpen:!0,candidateOpen:!0}))}else if(r==="app-bundles"){const S=e.bundleManager||{},w=Array.isArray(t.bundles)?t.bundles:((p=t.bundles)==null?void 0:p.entries)||[];S.order&&S.orderOpen!==!1?c("bundles/order","Composition order","bundleManager",{orderOpen:!0}):S.detailOpen&&c("bundles/detail",((m=w.find(N=>N.id===S.entryId))==null?void 0:m.name)||"Bundle","bundleManager",{detailOpen:!0})}else if(r==="loaded-modules"){const S=e.moduleEditor||{};S.detailOpen&&c("modules/detail",(()=>{var w;try{return(w=Sp(JSON.parse(S.text)).find(N=>N.key===S.selectedKey))==null?void 0:w.id}catch{return null}})()||"Module","moduleEditor",{detailOpen:!0})}else if(["smart-tools","tool-connections"].includes(r)){const S=e.smartToolsEditor||{},w=S.page||"home";w==="catalog"?(c("tools/catalog","Catalog","smartToolsEditor",{page:"catalog"}),S.catalogDetail&&c("tools/catalog/detail",((g=(f=(h=t.smartTools)==null?void 0:h.catalog)==null?void 0:f.find(N=>N.id===S.catalogId))==null?void 0:g.name)||"Tool details","smartToolsEditor",{page:"catalog",catalogDetail:!0})):w!=="home"&&(w==="source"&&S.returnPage==="catalog"&&c("tools/catalog","Catalog","smartToolsEditor",{page:"catalog"}),w==="tool"&&c("tools/server",((b=(y=(E=t.smartTools)==null?void 0:E.servers)==null?void 0:y.find(N=>N.id===S.serverId))==null?void 0:b.name)||"Connection","smartToolsEditor",{page:"server"}),c("tools/"+w,{source:"Install from source",connection:"Connection settings",server:"Connection",tool:S.toolName||"Tool"}[w]||"Smart Tools","smartToolsEditor",{page:w}))}return i}const DF={ai:$c,privacy:wi,workspaces:qr,overview:tl,appearance:Bc,voice:zu,notifications:lg,models:$c,bundles:qr,"smart-tools":ox,updates:wa,diagnostics:mo,history:wi,advanced:Hc};function FF({state:e,session:t,act:a,dispatch:r,open:o,close:i=()=>a("view.update",{patch:{panel:null}}),navigationRef:s,appearance:l}){var q,W,X,U;const c=Qu(),u=(((q=c==null?void 0:c.data)==null?void 0:q.resolvedInstances)||[]).filter(_=>_.slot==="settings.section"),d=Zi.map(_=>_.id==="advanced"?{..._,pages:[..._.pages,...u.map(P=>{var G,Z;return["shell:"+P.id,((Z=(G=c.data.packages[P.package])==null?void 0:G.manifest)==null?void 0:Z.label)||P.id]})]}:_),{page:p,section:m}=Vw(e.view,d),h=v.useRef(null),f=v.useRef(null),g=v.useRef(null),[E,y]=v.useState(null),b=KL(g),S=LF(e.view,e,d),w=S.at(-1),N=b&&w.key==="index",x=b&&S.length>(Is(p,d)?3:2);YL(g,b);const A=cD(),C=GL({compact:b,trail:S,view:e.view||{},act:a,close:i,body:f,navigationRef:s,confirmClose:A.confirmClose,hasUnsaved:A.hasUnsaved}),O=(_,P=!1)=>{C.rememberScroll(),a("view.update",{patch:{...zF(e.view||{},Ou(_,d)),...P?{settingsRootVisit:crypto.randomUUID()}:{}}})};v.useLayoutEffect(()=>{var _,P;if((_=e.view)!=null&&_.settingsRootVisit){f.current&&(f.current.scrollTop=0);for(const G of((P=g.current)==null?void 0:P.querySelectorAll(".a-settings-page-content:not([hidden]) details[open]"))||[])G.open=!1}},[(W=e.view)==null?void 0:W.settingsRootVisit]),v.useEffect(()=>{var _;(_=h.current)==null||_.focus({preventScroll:!0}),!b&&f.current&&(f.current.scrollTop=0)},[p,w.key,b]);const k={state:e,session:t,act:a,navigate:O},T=v.useRef(new Map),F=(_=>["ai-connections","overview"].includes(_)?"ai-connections":["appearance","custom-appearance"].includes(_)?"appearance":["smart-tools","tool-connections"].includes(_)?"smart-tools":["app-bundles","add-bundles","loaded-modules","share-bundle","registries"].includes(_)?"bundles":["notifications","diagnostics","history","permissions","automation","repair","reset"].includes(_)?"maintenance":_)(p);N||T.current.set(F,p);function z(_){var G,Z;let P;return["overview","ai-connections"].includes(_)?P=n.createElement(fD,{...k,act:r||a,navigate:O}):_==="privacy"?P=n.createElement(sD,{state:e,navigate:O}):_==="advanced"?P=n.createElement(lD,{...k,sections:d,navigate:O}):_==="appearance"?P=n.createElement(Ur,{name:"settings.appearance"},n.isValidElement(l)?n.cloneElement(l,{simple:!0,onAdvanced:()=>O("custom-appearance")}):l):_==="custom-appearance"?P=n.isValidElement(l)?n.cloneElement(l,{advancedOnly:!0}):l:_.startsWith("shell:")?P=n.createElement(Ur,{name:"settings.section",instanceId:_.slice(6)}):_==="workspaces"?P=n.createElement(zx,{...k}):_==="voice"?P=n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Choose how your conversations sound."),n.createElement(PF,{...k})):_==="providers"?P=n.createElement(bD,{...k}):_==="routing"?P=n.createElement(gD,{...k}):_==="defaults"?P=n.createElement(RD,{...k}):["app-bundles","add-bundles","loaded-modules","share-bundle","registries"].includes(_)?P=n.createElement(xD,{...k}):["smart-tools","tool-connections"].includes(_)?P=n.createElement(DD,{...k,simple:_==="smart-tools",navigateSettings:O}):_==="updates"?P=n.createElement(QD,{...k}):_==="ready-conversations"?P=(G=e.runtime)!=null&&G.retention?n.createElement(XD,{...k}):n.createElement("p",null,"This host does not expose conversation readiness settings."):_==="install-app"?P=n.createElement(OF,null):_==="runtime"?P=n.createElement(lk,{...k}):_==="desktop"?P=n.createElement(wF,{...k}):_==="recall"?P=n.createElement(CF,{key:(t==null?void 0:t.id)||"none",...k}):_==="outputs"?P=n.createElement(RF,{key:t==null?void 0:t.id,...k}):_==="publishing"?P=n.createElement(AF,{key:t==null?void 0:t.id,...k,act:r||a}):_==="conversation"?P=n.createElement(n.Fragment,null,t?n.createElement(n.Fragment,null,n.createElement(uk,{key:t.id,session:t,act:a}),n.createElement(dk,{...k}),((Z=t.location)==null?void 0:Z.kind)==="managed"&&ho(t)&&n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-soft a-danger","data-action":"view.update",onClick:()=>o("delete-session")},"Delete chat")),n.createElement("h3",null,"Conversation bundle")):n.createElement("p",null,"Choose a bundle to start a conversation."),n.createElement(tk,{...k,working:["working","starting","running","stopping","busy"].includes(t==null?void 0:t.status)})):P=n.createElement($D,{...k}),_==="conversation"&&t&&(P=n.createElement(n.Fragment,null,P,n.createElement(Dx,{key:"library-"+t.id,...k}),n.createElement(Fx,{key:"sharing-"+t.id,...k}))),P}return n.createElement(uD,{value:A.context},n.createElement("div",{ref:g,className:"a-settings-experience a-settings-everyday","data-part":"settings-experience","data-settings-page":p,"data-compact":b,"data-settings-index":N,"data-settings-detail":x,"data-settings-route":w.key},n.createElement("header",{className:"a-settings-mobile-head"},N?n.createElement("span",null):n.createElement("button",{type:"button",className:"a-link","data-action":"view.update","aria-label":"Back to "+(((X=S.at(-2))==null?void 0:X.title)||"Settings"),onClick:C.back},n.createElement(Sa,null),n.createElement("span",null,S.length>2?"Back":"Settings")),n.createElement("h3",{ref:b?h:void 0,tabIndex:-1},w.title),n.createElement("button",{type:"button",className:"a-icon","data-action":"view.update","aria-label":"Close settings",onClick:C.dismiss},n.createElement(nn,null))),n.createElement("nav",{className:"a-settings-sidebar","aria-label":"Settings sections"},d.map((_,P)=>{var Z;const G=DF[_.id]||qr;return n.createElement(n.Fragment,{key:_.id},_.group&&_.group!==((Z=d[P-1])==null?void 0:Z.group)&&n.createElement("div",{className:"a-settings-category"},_.group),n.createElement("button",{type:"button","data-action":"view.update","data-settings-section":_.id,"aria-current":_.id===m.id?"page":void 0,onClick:()=>O(_.pages[0][0],!0)},n.createElement(G,{"aria-hidden":"true"}),n.createElement("span",null,_.title),n.createElement(Da,{count:rD(e,_)})))})),n.createElement("div",{ref:f,onScroll:C.rememberScroll,className:"a-settings-content",role:"region","aria-label":"Settings content"},n.createElement("header",{className:"a-settings-page-heading"},n.createElement("div",null,n.createElement("h3",{ref:b?void 0:h,tabIndex:-1},bp(p,d))),t&&["loaded-modules","conversation","runtime"].includes(p)&&n.createElement("span",{className:"a-settings-conversation"},n.createElement(Qk,{"aria-hidden":"true"}),t.title)),Is(p,d)&&n.createElement("button",{type:"button",className:"a-link a-settings-breadcrumb","data-action":"view.update",onClick:()=>O(Is(p,d))},n.createElement(Sa,null),"Back to ",m.title),p!=="updates"&&n.createElement(zs,{state:e,act:a,page:p}),A.count>0&&n.createElement("p",{className:"a-alert",role:"status"},"You have unsaved connection changes. They are kept while Settings stays open."),((U=e.management)==null?void 0:U.error)&&p!=="add-bundles"&&n.createElement("div",{className:"a-alert",role:"alert"},e.management.error),n.createElement(n.Fragment,null,[...T.current].map(([_,P])=>n.createElement(Ju.Provider,{key:_,value:P},n.createElement(Kr.Provider,{value:{compact:b,active:_===F&&!N,footer:E}},n.createElement("div",{className:"a-settings-page-content",hidden:_!==F},z(P))))))),n.createElement("div",{ref:y,className:"a-settings-mobile-actions"}),A.dialog))}const pk="amplifier.messageOutbox.v1";function qF(e){try{return JSON.parse((e==null?void 0:e.getItem(pk))||"[]").filter(t=>t&&typeof t.id=="string"&&typeof t.commandId=="string"&&(t.sessionId===null||typeof t.sessionId=="string")&&typeof t.text=="string"&&Array.isArray(t.attachmentIds)&&t.attachmentIds.every(a=>typeof a=="string")&&["sending","failed","unknown"].includes(t.status)).map(t=>({...t,status:t.status==="sending"?"unknown":t.status}))}catch{return[]}}function UF(e,t,a){const r=t.filter(i=>i.sessionId===(a??null));return[...e.map(i=>{var l,c;const s=r.find(u=>u.commandId===i.inputId);return s&&((l=i.delivery)==null?void 0:l.status)!=="accepted"?{...i,localDelivery:{...s,...((c=i.delivery)==null?void 0:c.status)==="failed"?{status:"failed"}:{}}}:i}),...r.filter(i=>!e.some(s=>s.inputId===i.commandId)).map(i=>({id:i.id,inputId:i.commandId,role:"user",text:i.text,via:i.via,createdAt:i.createdAt,attachments:i.attachments,replyTo:i.replyTo,localDelivery:i}))]}function jF(){const[e,t]=v.useState(()=>{try{return qF(sessionStorage)}catch{return[]}}),a=v.useRef(e),[r,o]=v.useState(!1),i=v.useCallback((s,l)=>{const c=a.current,u=c.some(p=>p.id===s);if(!u&&l!==null&&!l.commandId)return;const d=l===null?c.filter(p=>p.id!==s):u?c.map(p=>p.id===s?{...p,...l}:p):[...c,{id:s,...l}];a.current=d,t(d);try{sessionStorage.setItem(pk,JSON.stringify(d)),o(!1)}catch{o(!0)}return d.find(p=>p.id===s)},[]);return{entries:e,current:a,update:i,storageError:r}}async function Ll(e,t=St,a){let r=0,o="";do{const i=await t("/api/conversation/detail?"+new URLSearchParams({...e,offset:r}),{signal:a});o+=i.value,r=i.nextOffset}while(r!==null);return o}function Oi({text:e,reference:t,markdown:a=!1,automatic:r=!1,writingContext:o,fileContext:i}){const[s,l]=v.useState(null),[c,u]=v.useState(!1),[d,p]=v.useState(""),[m,h]=v.useState(!1),f=v.useRef(null),g=v.useRef(null),E=t?JSON.stringify(t):null,y=v.useRef(E);y.current=E;const b=(s==null?void 0:s.key)===E?s.value:null;v.useEffect(()=>(l(null),p(""),u(!1),()=>{var w;return(w=g.current)==null?void 0:w.abort()}),[E]),v.useEffect(()=>{if(!r||!t)return;if(!globalThis.IntersectionObserver){h(!0);return}const w=new IntersectionObserver(N=>{N.some(x=>x.isIntersecting)&&(h(!0),w.disconnect())},{rootMargin:"400px"});return f.current&&w.observe(f.current),()=>w.disconnect()},[r,E]);async function S(){var x;const w=E,N=new AbortController;(x=g.current)==null||x.abort(),g.current=N,u(!0),p("");try{const A=await Ll(t,St,N.signal);!N.signal.aborted&&y.current===w&&l({key:w,value:A})}catch(A){!N.signal.aborted&&y.current===w&&p(A.message)}finally{!N.signal.aborted&&y.current===w&&u(!1)}}return v.useEffect(()=>{r&&m&&t&&S()},[r,m,E]),n.createElement("div",{className:"a-detail-text",ref:f},a?n.createElement(ml,{text:b??e,writingContext:o,fileContext:i}):n.createElement("p",null,b??e),t&&b===null&&(r&&!d?n.createElement("span",{className:"a-caption",role:"status"},c?"Loading complete response…":"Complete response loads when visible."):n.createElement("button",{type:"button",className:"a-link",disabled:c,onClick:S},c?"Loading full text…":d?"Retry loading full text":"Show full text")),d&&n.createElement("p",{role:"alert"},d))}const Rr=e=>[...new Map(e.map(t=>[t.id,t])).values()];function $F(e,t){var g,E,y,b,S,w,N;const[a,r]=v.useState(null),[o,i]=v.useState(""),[s,l]=v.useState(""),c=v.useRef(e==null?void 0:e.id);c.current=e==null?void 0:e.id;const u=v.useRef((g=e==null?void 0:e.messageWindow)==null?void 0:g.total);v.useEffect(()=>{r(null),l(""),i("")},[e==null?void 0:e.id,e==null?void 0:e.sharedHistoryOffset]),v.useEffect(()=>{var x,A;((x=e==null?void 0:e.messageWindow)==null?void 0:x.total){var A;return{...x,...(A=e.messageAnnotations)==null?void 0:A[x.id]}})},m=e&&d?{...e,messages:Rr([...d.messages,...e.messages]).map(x=>{var A;return{...x,...(A=e.messageAnnotations)==null?void 0:A[x.id]}}),sharedHistoryUserTurnOffset:d.userOffset??e.sharedHistoryUserTurnOffset,messageWindow:{...e.messageWindow,...d.messages.length?{offset:d.messageOffset,before:d.messages[0].id}:{}},execution:{...e.execution,nodes:Rr([...d.nodes,...((y=e.execution)==null?void 0:y.nodes)||[]]),turns:Rr([...d.turns,...((b=e.execution)==null?void 0:b.turns)||[]]),segments:Rr([...d.segments||[],...((S=e.execution)==null?void 0:S.segments)||[]])},executionWindow:{...e.executionWindow,...d.nodes.length?{offset:d.nodeOffset,before:d.nodes[0].id}:{}}}:p;async function h(x){if(o||!m)return;const A=m.id,C=x==="messages"?m.messageWindow:m.executionWindow;i(x),l("");try{const O=await St("/api/conversation/detail?"+new URLSearchParams({sessionId:A,part:x,before:C.before}));if(c.current!==A)return;t==null||t(),r(k=>{const T=(k==null?void 0:k.id)===A?k:{id:A,messages:[],nodes:[],turns:[]};return{...T,[x]:Rr([...O.items,...T[x]]),...x==="messages"?{messageOffset:O.offset,userOffset:O.userOffset}:{nodeOffset:O.offset,turns:Rr([...O.turns,...T.turns]),segments:Rr([...O.segments||[],...T.segments||[]])}}})}catch(O){c.current===A&&l(O.message)}finally{c.current===A&&i("")}}const f=n.createElement(n.Fragment,null,((w=m==null?void 0:m.messageWindow)==null?void 0:w.offset)>0&&n.createElement("button",{className:"a-soft",type:"button",disabled:!!o,onClick:()=>h("messages")},"Load earlier messages"),((N=m==null?void 0:m.executionWindow)==null?void 0:N.offset)>0&&n.createElement("button",{className:"a-soft",type:"button",disabled:!!o,onClick:()=>h("nodes")},"Load earlier activity"),o&&n.createElement("span",{role:"status"},"Loading earlier ",o==="nodes"?"activity":"messages","…"),s&&n.createElement("p",{role:"alert"},s));return{session:m,controls:f,earlier:h,busy:o}}const Kf=[["👍","Thumbs up"],["❤️","Heart"],["😂","Laugh"],["🎉","Celebrate"],["😮","Surprised"],["😢","Sad"],["👎","Thumbs down"],["✅","Check"]],mk=e=>e.role==="user"?"You":"Amplifier";function BF({quote:e,sessionId:t,dispatch:a}){const[r,o]=v.useState("");if(!e)return null;const i=(e.navigationSessionId||e.sessionId)===t;return n.createElement("blockquote",{className:"a-reply-quote"},n.createElement("button",{type:"button",className:"a-quoted-source","data-action":"message.reveal",title:i?"Go to original message":"Open the original message in its conversation",onClick:async()=>{o("");try{const s=e.navigationSessionId||e.sessionId;await a("message.reveal",{sessionId:s,messageId:e.messageId})}catch(s){o(s.message)}}},n.createElement("strong",null,mk(e)),n.createElement("span",null,e.excerpt,e.truncated?"…":"")),!i&&n.createElement("small",null,"Quoted from the original conversation"),r&&n.createElement("small",{role:"status"},r))}function HF({quote:e,sessionId:t,dispatch:a}){const[r,o]=v.useState("");return!e||e.sessionId!==t?null:n.createElement("div",{className:"a-reply-preview","aria-label":"Quoted reply"},n.createElement("div",null,n.createElement("strong",null,"Replying to ",mk(e)),n.createElement("p",null,e.excerpt,e.truncated?"…":"")),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Remove quoted reply","data-action":"message.replyClear",onClick:async()=>{o("");try{await a("message.replyClear",{sessionId:t,expectedReplyId:e.id})}catch(i){o(i.message)}}},n.createElement(nn,null)),r&&n.createElement("small",{role:"alert"},r))}function VF({message:e,sessionId:t,dispatch:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(""),p=e.reactions||[];async function m(h,f){var g;if(!l){c(!0),d("");try{await a(h,{sessionId:t,messageId:e.id,...f}),h==="message.reply"&&((g=document.querySelector('[aria-label="Message Amplifier"]'))==null||g.focus())}catch(E){d(E.message)}finally{c(!1)}}}return n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-icon","aria-label":"Reply to message",title:"Reply to message","data-action":"message.reply",disabled:l,onClick:()=>m("message.reply",{})},n.createElement(ix,null)),n.createElement("div",{className:"a-reaction-control",onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||o(!1)},onKeyDown:h=>{var f;h.key==="Escape"&&(o(!1),(f=h.currentTarget.querySelector("button"))==null||f.focus())}},n.createElement("button",{type:"button",className:"a-icon","aria-label":"React to message",title:"React to message","aria-expanded":r,onClick:h=>{var g;const f=(g=h.currentTarget.closest(".a-messages"))==null?void 0:g.getBoundingClientRect();s(h.currentTarget.getBoundingClientRect().top-((f==null?void 0:f.top)||0)<110),o(!r)}},n.createElement(mx,null)),r&&n.createElement("div",{className:"a-reaction-picker","data-below":i,role:"group","aria-label":"Choose reaction"},Kf.map(([h,f])=>n.createElement("button",{key:h,type:"button","aria-label":f,"aria-pressed":p.includes(h),disabled:l,"data-action":"message.reaction",onClick:async()=>{await m("message.reaction",{emoji:h,present:!p.includes(h)}),o(!1)}},h)))),p.map(h=>{var f;return n.createElement("button",{key:h,type:"button",className:"a-reaction-chip","aria-label":`Remove ${((f=Kf.find(g=>g[0]===h))==null?void 0:f[1])||h} reaction`,"aria-pressed":"true",disabled:l,"data-action":"message.reaction",onClick:()=>m("message.reaction",{emoji:h,present:!1})},h)}),u&&n.createElement("span",{className:"a-message-interaction-error",role:"alert"},u))}function WF({session:e,focus:t,detail:a}){var i,s;const r=v.useRef(""),o=v.useRef("");return v.useEffect(()=>{var d,p;if(!t||t.sessionId!==(e==null?void 0:e.id)||a.busy)return;const l=`${t.sessionId}:${t.revision}`;if(o.current===l)return;const c=`${l}:${((d=e.messageWindow)==null?void 0:d.offset)??0}`;if(r.current===c)return;r.current=c;const u=[...document.querySelectorAll("[data-message-id]")].find(m=>m.dataset.messageId===t.messageId);if(u){o.current=l,u.tabIndex=-1,u.scrollIntoView({block:"center"}),u.focus({preventScroll:!0});return}((p=e.messageWindow)==null?void 0:p.offset)>0&&a.earlier("messages")},[e==null?void 0:e.id,(i=e==null?void 0:e.messages)==null?void 0:i.length,(s=e==null?void 0:e.messageWindow)==null?void 0:s.offset,t==null?void 0:t.revision,t==null?void 0:t.sessionId,a.busy]),null}function ZF({message:e,session:t,delivery:a,localDelivery:r,dispatch:o,retry:i,discard:s}){var N,x;const[l,c]=v.useState(!1),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=e.inputId||(r==null?void 0:r.commandId),E=t.configurationBusy||((N=t.ownership)==null?void 0:N.status)==="blocked"||t.workspaceAvailable===!1||!!t.historyReadOnlyReason,y=["working","starting","running","stopping"].includes(t.status),b=async()=>{if(!l){c(!0),f(""),m(!1);try{if(!t.id){d({delivery:"not_saved",message:"This message has no confirmed conversation yet. Choose Send again to retry the original submission."});return}const A=await o("conversation.delivery",{sessionId:t.id,inputId:g},{feedback:!1});d(A.result)}catch(A){f(A.message)}finally{c(!1)}}},S=async()=>{var A;if(!l){c(!0),f("");try{if((A=t.messages)==null?void 0:A.some(O=>O.role==="user"&&O.inputId===g)){const O=await o("conversation.retry",{sessionId:t.id,inputId:g,confirmUncertain:!0},{feedback:!1});d(O.result)}else await i(e);m(!1)}catch(C){f(C.message)}finally{c(!1)}}};if(!a)return null;const w=a.status==="sending";return n.createElement(n.Fragment,null,n.createElement("span",{className:"a-message-delivery",role:"status"},w?n.createElement(n.Fragment,null,n.createElement(Ro,{className:"a-progress-spinner"}),"Sending…"):n.createElement(n.Fragment,null,n.createElement(zn,null),a.status==="failed"?"Not sent":"Delivery not confirmed",a.status==="failed"?n.createElement("button",{type:"button",className:"a-link","data-action":"conversation.send",disabled:l||E,onClick:()=>{var A;return(A=t.messages)!=null&&A.some(C=>C.inputId===g)?S():i(e)}},n.createElement(pm,null),"Retry"):n.createElement("button",{type:"button",className:"a-link","data-action":"conversation.delivery",disabled:l||!g,onClick:b},n.createElement(pm,null),l?"Checking…":"Check delivery"))),!w&&a.error&&n.createElement("p",{role:"alert",className:"a-delivery-detail"},a.error),r&&a.status==="failed"&&!((x=t.messages)!=null&&x.some(A=>A.inputId===g))&&n.createElement("button",{type:"button",className:"a-link",disabled:l,onClick:()=>s==null?void 0:s(e)},"Discard unsent message"),(u==null?void 0:u.message)&&n.createElement("p",{role:"status",className:"a-delivery-detail"},u.message),h&&n.createElement("p",{role:"alert",className:"a-delivery-detail"},h),!w&&u&&!["accepted","sending"].includes(u.delivery)&&!p&&n.createElement("button",{type:"button",className:"a-link","data-action":"conversation.retry",disabled:l||E||y,onClick:()=>m(!0)},"Send again"),p&&n.createElement("div",{className:"a-delivery-confirm",role:"alert"},n.createElement("p",null,"The earlier attempt may have run even though delivery was not confirmed. Sending again could repeat that work. Your saved message and history will be kept."),n.createElement("button",{type:"button",className:"a-soft",disabled:l,onClick:()=>m(!1)},"Cancel"),n.createElement("button",{type:"button",className:"a-primary","data-action":"conversation.retry",disabled:l||E||y,onClick:S},l?"Sending…":"Send this message again")))}function hk(e){if(!e)return"Worker routing has not been reported.";const t={inherited_conversation:"This worker inherited the conversation selection.",delegation_preferences:"This worker uses delegation provider preferences.",agent_provider:"This worker uses its agent provider configuration.",agent_model_role:"This worker uses its agent model role.",session_defaults:"This worker uses its session defaults."},a=e.modelInheritance==="conversation_when_unspecified"?"Workers inherit the conversation model unless their configuration overrides it.":"Workers use bundle and agent model settings.",r=e.matrixSource==="user"?" from user settings":e.matrixSource==="bundle"?" from the bundle":"",o=e.resolverActive?` Routing is active${e.resolverName?` (${e.resolverName})`:""}${r}.`:"";return`${t[e.selectionSource]||a}${o} Other connected providers may be used.`}const zc={};function fk({items:e=[],remove:t}){return e.length?n.createElement("div",{className:"a-attachments"},e.map(a=>{var r;return n.createElement("div",{className:"a-attachment",key:a.id},(r=a.mime)!=null&&r.startsWith("image/")?n.createElement("a",{href:a.url,target:"_blank",rel:"noopener noreferrer"},n.createElement("img",{src:a.url,alt:a.name})):n.createElement(Fu,null),n.createElement("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",title:a.name},a.name,n.createElement("small",null,Math.ceil(a.size/1024)," KB")),t&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Remove "+a.name,"data-action":"attachment.remove",onClick:()=>t(a.id)},n.createElement(nn,null)))})):null}function Lc(e,t){var r,o,i;const a=yp(e,{model:t,default_model:t}).find(s=>s.id==="reasoning_effort");return(e==null?void 0:e.effort)||((r=e==null?void 0:e.config)==null?void 0:r.reasoning_effort)||((i=(o=e==null?void 0:e.info)==null?void 0:o.defaults)==null?void 0:i.reasoning_effort)||(a==null?void 0:a.default)||""}function JF({state:e,session:t,act:a,working:r}){var Ye,ht,bt,ft,Ce,gt,Et,vt,at,ee,Re,ae,Le,Oe,et,st,It,xt,Ut,rt,Xe,$e,Nt,Zt,rn,In,yn,Fn,Gn,An,Jt,dn,ut;const o=Ja(e),i=!t,s=(t==null?void 0:t.id)||null,l=Ag(e),c=e.configurationRevision||0,u=JSON.stringify([((Ye=o.location)==null?void 0:Ye.kind)||"workspace",o.workspace,c]),d=v.useRef(null);i&&l.phase==="ready"&&(d.current={context:u,value:l});const p=l.phase==="ready"||l.phase==="error"?l:((ht=d.current)==null?void 0:ht.context)===u?d.current.value:l,m=i&&l.phase!=="ready"&&l.phase!=="error",h=(t==null?void 0:t.workspaceAvailable)===!1||!!(t!=null&&t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1,f=((bt=e.view)==null?void 0:bt.composerModel)||zc,[g,E]=v.useState(f),[y,b]=v.useState("");v.useEffect(()=>E(f),[f]);const S=ve=>{const ge={...g,...ve};E(ge),a("view.update",{patch:{composerModel:ge}})},w=((ft=o.location)==null?void 0:ft.kind)==="managed",N=w?{location:{kind:"managed"}}:{},x=((Ce=e.setup)==null?void 0:Ce.providersRequestedWorkspace)===o.workspace&&((Et=(gt=e.setup)==null?void 0:gt.providersLocation)==null?void 0:Et.kind)==="managed"===w?e.setup:zc,A=(x.providers||[]).filter(ve=>ve.enabled!==!1).map(ve=>{var At,Ot,Kt,Q,Yt,En,qn,pn;const ge=((Ot=(At=x.providerCatalogs)==null?void 0:At[ve.id])==null?void 0:Ot.metadata)||((Kt=x.metadata)==null?void 0:Kt[ve.module])||{};return{...ve,...ge,info:{...ge.info,defaults:{...(Q=ge.info)==null?void 0:Q.defaults,model:((Yt=ve.config)==null?void 0:Yt.default_model)||((En=ve.config)==null?void 0:En.model)||((pn=(qn=ge.info)==null?void 0:qn.defaults)==null?void 0:pn.model)}}}}),C=((vt=e.runtimeControl)==null?void 0:vt[s])||{},O=C["configuration.providers"],k=i?p.providers||A:(O==null?void 0:O.providers)||((ee=(at=t==null?void 0:t.runtimeReport)==null?void 0:at.provider_choices)==null?void 0:ee.map(ve=>({id:ve.id,info:{id:ve.provider,display_name:ve.display_name,defaults:{model:ve.model,reasoning_effort:ve.effort}}})))||[],T=i?!!((Re=o.selection)!=null&&Re.model):(O==null?void 0:O.pinned)??!!((ae=t==null?void 0:t.runtimeReport)!=null&&ae.selection||t!=null&&t.selection),I=!O&&!(t!=null&&t.runtimeReport)?t==null?void 0:t.initialModel:void 0,F=i?T?o.selection:p.effective||{}:(O==null?void 0:O.effective)||((Le=t==null?void 0:t.runtimeReport)==null?void 0:Le.effective_selection)||(t==null?void 0:t.selection)||I||{},z=[...((Oe=t==null?void 0:t.execution)==null?void 0:Oe.nodes)||[]].reverse().find(ve=>ve.kind==="llm"&&(ve.sessionId===s||!ve.sessionId&&!ve.parentId)),q=(i?l.phase==="ready":Array.isArray(O==null?void 0:O.providers))&&!k.length,W=F.model||(i?"":z==null?void 0:z.model)||(q?"Set up a model":l.phase==="error"?"Model unavailable":i?"Loading model…":"Choose a model"),X=F.instance||F.id||(i?"":z==null?void 0:z.provider)||"",U=k.find(ve=>ve.id===X),_=F.effort||Lc(U,W),P=(((et=e.setup)==null?void 0:et.providers)||[]).find(ve=>ve.id===X),G={...(xt=(It=(st=e.setup)==null?void 0:st.metadata)==null?void 0:It[P==null?void 0:P.module])==null?void 0:xt.info,...($e=(Xe=(rt=(Ut=e.setup)==null?void 0:Ut.providerCatalogs)==null?void 0:rt[X])==null?void 0:Xe.metadata)==null?void 0:$e.info,...U==null?void 0:U.info},Z=Qw(k),D=((Nt=Z.find(ve=>ve.id===X))==null?void 0:Nt.label)||(G==null?void 0:G.display_name)||(G==null?void 0:G.id)||((I==null?void 0:I.instance)===X?I.providerLabel:"")||X,ne=_?`${W} (${_})`:W,H=((rn=(Zt=U==null?void 0:U.info)==null?void 0:Zt.defaults)==null?void 0:rn.auth_mode)==="chatgpt_plan"||i&&((In=U==null?void 0:U.config)==null?void 0:In.auth_mode)==="chatgpt_plan",j=D?`${D} · ${ne}`:ne,ie=g.open&&(g.sessionId??null)===s,Ee=v.useRef(null),me=ek(ie,Ee);il(ie,Ee,()=>S({open:!1}));const _e=k.find(ve=>ve.id===g.instance),Je=C["configuration.providerModels"],De=i?(yn=x.providerCatalogs)==null?void 0:yn[g.instance]:((Fn=C.modelCatalogs)==null?void 0:Fn[g.instance])||(Je&&Je.provider===g.instance?{phase:"ready",models:Je.models}:null),ue=v.useRef(new Map);let ye=zl((De==null?void 0:De.models)||[]);ye.length?ue.current.set((i?ws(o):s)+"|"+g.instance,ye):ye=ue.current.get((i?ws(o):s)+"|"+g.instance)||[];const M=new Map(ye.map(ve=>[ve.id,ve])),Y=(An=(Gn=_e==null?void 0:_e.info)==null?void 0:Gn.defaults)==null?void 0:An.model;Y&&!M.has(Y)&&M.set(Y,{id:Y,name:Y}),ye=[...M.values()];const se=(De==null?void 0:De.metadata)||_e||{},Fe=((Jt=yp(se,{model:g.model,default_model:g.model}).find(ve=>ve.id==="reasoning_effort"))==null?void 0:Jt.choices)||[],je=g.effort||Lc(_e,g.model)||Lc(se,g.model),oe=v.useRef(!1),Ze=v.useRef(""),it=v.useRef(!1);v.useEffect(()=>{if(!i||!o.workspace&&!w)return;const ve=JSON.stringify([ws(o),c]);if(Ze.current===ve)return;const ge=setTimeout(()=>{Ze.current=ve,a("configuration.defaults",{workspace:o.workspace,bundle:o.bundle||"",...N}),x===zc&&a("providers.list",{workspace:o.workspace,...N})},250);return()=>clearTimeout(ge)},[i,o.workspace,o.bundle,w,c]),v.useEffect(()=>{var ve,ge;if(ie&&!it.current){const At=F.instance||F.id||g.instance||"",Ot=k.find(Kt=>Kt.id===At);S({instance:At,model:F.model||g.model||((ge=(ve=Ot==null?void 0:Ot.info)==null?void 0:ve.defaults)==null?void 0:ge.model)||"",effort:_||g.effort||""})}},[ie,s,k.map(ve=>ve.id).join("|"),F.instance,F.id,F.model,_]);function zt(){if(it.current=!1,b(""),ie){S({open:!1});return}S({open:!0,sessionId:s,instance:X,model:F.model||"",effort:_||""}),t&&a("runtime.control",{sessionId:s,operation:"configuration.providers",args:{}})}async function ct(ve){it.current=!0;const ge={...g,...ve};if(S(ve),b(""),!k.some(Ot=>Ot.id===ge.instance)||!ge.model)return;const At={instance:ge.instance,model:ge.model,...ge.effort?{effort:ge.effort}:{}};try{i?await a("view.update",{patch:{newSessionDraft:{...o,selection:At}}}):await a("runtime.control",{sessionId:s,operation:"provider.select",args:At})}catch(Ot){b(Ot.message)}}function qt(ve){var At,Ot,Kt,Q,Yt,En;if(!ve)return;const ge=k.find(qn=>qn.id===ve);ge&&(ct({instance:ve,model:O!=null&&O.selectionIssue?g.model||((At=O.selection)==null?void 0:At.model)||"":((Kt=(Ot=ge.info)==null?void 0:Ot.defaults)==null?void 0:Kt.model)||"",effort:O!=null&&O.selectionIssue&&(g.effort||((Q=O.selection)==null?void 0:Q.effort))||""}),i&&!((Yt=x.providerCatalogs)!=null&&Yt[ve])?a("providers.models",{id:ve,workspace:o.workspace,...N}):!i&&!((En=C.modelCatalogs)!=null&&En[ve])&&a("runtime.control",{sessionId:s,operation:"configuration.providerModels",args:{instance:ve}}))}function le(ve){it.current=!0,oe.current=!0,E({...g,effort:Fe[Number(ve.currentTarget.value)]})}function fe(ve){if(!oe.current)return;oe.current=!1;const ge=Fe[Number(ve.currentTarget.value)];ge&&ct({effort:ge})}const xe=(dn=e.actionStatus)==null?void 0:dn[i?"configuration.defaults":"runtime.control"],ze=y||((xe==null?void 0:xe.phase)==="error"?xe.error:"")||l.error;return n.createElement("div",{className:"a-model-control",ref:Ee},n.createElement("button",{type:"button",className:"a-model-trigger","aria-label":"Model and reasoning settings",disabled:h,"aria-expanded":!!ie,"aria-busy":m||void 0,title:m?`${j} · Checking bundle settings…`:j,"data-action":"view.update",onClick:zt},n.createElement("span",null,j),n.createElement(el,null)),ie&&n.createElement("section",{className:"a-model-popover a-compact-popover",style:me,"aria-label":"Conversation model"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation model"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close model settings","data-action":"view.update",onClick:()=>S({open:!1})},n.createElement(nn,null))),H&&n.createElement("p",{className:"a-caption"},"Using ChatGPT plan · ",n.createElement("a",{href:"https://chatgpt.com/settings/usage",target:"_blank",rel:"noopener noreferrer"},"Manage usage")),(O==null?void 0:O.selectionIssue)&&n.createElement("p",{role:"status"},O.selectionIssue),n.createElement("label",{htmlFor:"chat-provider"},"Provider"),n.createElement("select",{id:"chat-provider",value:g.instance||"","data-action":i?"view.update":"runtime.control",disabled:r,onChange:ve=>qt(ve.target.value)},!g.instance&&n.createElement("option",{value:"",disabled:!0},k.length?"Choose a provider":q?"No providers configured":"Loading providers…"),g.instance&&!_e&&n.createElement("option",{value:g.instance,disabled:!0},g.instance," (unavailable)"),Z.map(ve=>n.createElement("option",{key:ve.id,value:ve.id},ve.label))),n.createElement("label",{htmlFor:"chat-model"},"Model"),n.createElement("select",{id:"chat-model","aria-label":"Conversation model",value:g.model||"",disabled:r||!_e,"data-action":i?"view.update":"runtime.control",onChange:ve=>ct({model:ve.target.value,effort:""})},!g.model&&n.createElement("option",{value:""},(De==null?void 0:De.phase)==="working"?"Loading models…":"Choose a model"),g.model&&!ye.some(ve=>ve.id===g.model)&&n.createElement("option",{value:g.model},g.model),ye.map(ve=>n.createElement("option",{key:ve.id,value:ve.id},ve.name))),Fe.length>0?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"chat-effort"},"Reasoning effort ",n.createElement("strong",null,je||"Choose effort")),n.createElement("input",{id:"chat-effort",type:"range",min:"0",max:Fe.length-1,step:"1",value:Math.max(0,Fe.indexOf(je)),"aria-valuetext":je||"Choose effort",disabled:r||!g.model,"data-action":i?"view.update":"runtime.control",onChange:le,onPointerUp:fe,onKeyUp:fe,onBlur:fe}),n.createElement("div",{className:"a-effort-labels"},n.createElement("span",null,Fe[0]),n.createElement("span",null,Fe.at(-1)))):n.createElement("small",null,"Reasoning effort is not configurable for this model."),!i&&n.createElement("p",{className:"a-muted","data-part":"delegation-routing"},hk((O==null?void 0:O.delegationRouting)||((ut=t==null?void 0:t.runtimeReport)==null?void 0:ut.delegationRouting))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>{var ve;return a("view.update",{patch:{composerModel:{...g,open:!1},panel:"settings",settingsSection:"setup",settingsExpanded:["ai-connections"],aiConnectionEditor:{...((ve=e.view)==null?void 0:ve.aiConnectionEditor)||{},step:"services"}}})}},"Add connection"),n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>{var ve;return a("view.update",{patch:{composerModel:{...g,open:!1},panel:"settings",settingsSection:"setup",settingsExpanded:["ai-connections"],aiConnectionEditor:{...((ve=e.view)==null?void 0:ve.aiConnectionEditor)||{},step:"list"}}})}},"Manage connections")),n.createElement("small",null,"Model changes here apply to this conversation."),ze&&n.createElement("small",{className:"a-danger",role:"status"},ze),!ze&&(De==null?void 0:De.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},"The model list is unavailable. Your current selection is preserved.")))}function KF(e){return new Promise((t,a)=>{if(e.size>32*1024*1024||!e.size){a(new Error("Choose a nonempty file up to 32 MB."));return}const r=new FileReader;r.onload=()=>t(String(r.result).split(",")[1]),r.onerror=()=>a(new Error("Could not read "+e.name)),r.readAsDataURL(e)})}function YF(e,t){var u,d,p;const a=((u=e.observation)==null?void 0:u.recovery)||{},r=a.call_id||((d=e.observation)==null?void 0:d.call_id),o=r?(((p=t==null?void 0:t.execution)==null?void 0:p.nodes)||[]).find(m=>m.kind==="tool"&&m.toolCallId===r):null,i=r?((t==null?void 0:t.workers)||[]).find(m=>m.callId===r||m.toolCallId===r):null,s={returned:"Result returned",cancelled:"Work cancelled",interrupted:"Work interrupted",failed:"Work failed",pending:"Outcome unknown"}[a.status]||"Saved work notice",c=a.outcome==="unconfirmed"||["cancelled","interrupted","pending"].includes(a.status)?"The final outcome is unconfirmed. Inspect the saved work before deciding whether to continue.":a.reason==="restored_evidence"?"A saved call or result was restored to this chat.":a.reason==="changed_evidence"?"A saved result replaced an earlier pending record.":"Saved work was found when this chat resumed.";return{facts:a,node:o,worker:i,status:s,explanation:c}}function Yf({message:e,session:t,state:a,act:r}){const{facts:o,node:i,worker:s,status:l,explanation:c}=YF(e,t),u=s&&(a.sessions||[]).find(m=>m.id===s.id||m.runtimeSessionId===s.sessionId),d=i==null?void 0:i.output,p=i==null?void 0:i.outputDetail;return n.createElement("div",{className:"a-recovery-notice"},n.createElement("p",null,n.createElement("strong",null,(s==null?void 0:s.name)||(s==null?void 0:s.agent)||(i==null?void 0:i.label)||"Background work"," · ",l)),n.createElement("p",null,c," This notice does not mean the work ran again."),u&&n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",onClick:()=>r("session.select",{id:u.id})},"Open worker chat"),(typeof d=="string"||p)&&n.createElement("details",null,n.createElement("summary",null,"View saved result"),n.createElement(Oi,{text:d||"",reference:p})),n.createElement("details",null,n.createElement("summary",null,"Technical details"),o.job_id&&n.createElement("p",null,"Job: ",n.createElement("code",null,o.job_id),n.createElement("br",null),"Call: ",n.createElement("code",null,o.call_id)),o.status==="returned"&&n.createElement("p",null,"A returned report does not independently verify that its claimed effects succeeded."),n.createElement(Oi,{text:e.text,reference:e.textDetail}),n.createElement("button",{type:"button",className:"a-link","data-action":"message.copy",onClick:()=>r("message.copy",{sessionId:t.id,messageId:e.id})},"Copy observation")))}function GF(e){var o,i;const t=(e==null?void 0:e.messages)||[],a=new Map;let r=Number(e==null?void 0:e.sharedHistoryUserTurnOffset)||0;for(let s=0;sp.role==="assistant");if(!c)continue;const u=(i=(o=e.execution)==null?void 0:o.turns)==null?void 0:i.find(p=>p.inputId===t[s].inputId&&t[s].inputId);(u?["completed","complete","done"].includes(u.phase||u.status):l{r.length&&a.push(r.length>1?r:r[0]),r=[]};for(const s of e)((i=s.observation)==null?void 0:i.source)==="local-job-recovery"&&!(t.get(s.id)||[]).length?r.push(s):(o(),a.push(s));return o(),a}function XF({messages:e,renderArtifacts:t,...a}){return n.createElement("details",{className:"a-recovery-group"},n.createElement("summary",null,"Saved work notices (",e.length,")"),n.createElement("p",null,"Recorded when this chat resumed. These notices are part of its history."),e.map(r=>n.createElement(n.Fragment,{key:r.id},n.createElement(gk,{message:r,...a,expandedObservation:!0}),t==null?void 0:t(r))))}function gk({message:e,session:t,state:a,act:r,stamp:o,working:i,forkTurn:s,retry:l,discard:c,dispatch:u=r,expandedObservation:d=!1}){var q,W,X;const[p,m]=v.useState(!1),[h,f]=v.useState(!1),[g,E]=v.useState(!1),[y,b]=v.useState(""),S=(q=a.view)==null?void 0:q.messageEdit,w=(S==null?void 0:S.sessionId)===t.id&&(S==null?void 0:S.messageId)===e.id,[N,x]=v.useState(w?S.text:""),A=v.useRef(null);v.useEffect(()=>{if(!w){A.current=null;return}(A.current===null||S.text===A.current)&&(x(S.text||""),A.current=null)},[w,S==null?void 0:S.text]);const C=(W=a.view)==null?void 0:W.messageCopy,O=(C==null?void 0:C.sessionId)===t.id&&(C==null?void 0:C.messageId)===e.id?C:null,k=i||t.configurationBusy||t.workspaceAvailable===!1||!!t.historyReadOnlyReason,T=U=>r("view.update",{patch:{messageEdit:U}}),I=e.localDelivery,F=I||((X=e.delivery)!=null&&X.status&&e.delivery.status!=="accepted"?e.delivery:null),z=async U=>{if(U.preventDefault(),!(p||k||!N.trim())){m(!0);try{I?await l(e,N):await u("message.edit",{sessionId:t.id,messageId:e.id,text:N,mode:S!=null&&S.fork?"fork":"current"})}catch(_){b(_.message)}finally{m(!1)}}};if(e.observation){if(e.observation.source==="local-job-recovery")return n.createElement("article",{className:"a-message a-assistant","data-message-id":e.id},d?n.createElement(Yf,{message:e,session:t,state:a,act:r}):n.createElement("details",null,n.createElement("summary",null,"Saved work notice"),n.createElement(Yf,{message:e,session:t,state:a,act:r})));const U=n.createElement(n.Fragment,null,n.createElement(Oi,{text:e.text,reference:e.textDetail,markdown:!0}),n.createElement("button",{type:"button",className:"a-link","data-action":"message.copy",onClick:()=>r("message.copy",{sessionId:t.id,messageId:e.id})},"Copy observation"));return n.createElement("article",{className:"a-message a-assistant","data-message-id":e.id},d?U:n.createElement("details",null,n.createElement("summary",null,e.observation.source==="local-job-recovery"?"Recovered work update":["amplifier-delegate","amplifier-child","amplifier-child-lifecycle"].includes(e.observation.source)?"Delegated work update":"Service observation"," · Details"),U))}return n.createElement("article",{className:`a-message a-${e.role==="user"?"user":"assistant"}`,"data-message-id":e.id},n.createElement("div",{className:"a-msg-meta"},n.createElement("strong",null,e.role==="user"?"You":e.role==="assistant"?"Amplifier":e.role),n.createElement("span",null,e.via&&(e.via==="observation"?"Background follow-up · ":`via ${e.via} · `),e.timestampKnown===!1?"Time unavailable":o(e.createdAt))),n.createElement(BF,{quote:e.replyTo,sessionId:t.id,dispatch:u}),n.createElement(fk,{items:e.attachments}),y&&n.createElement("p",{role:"alert"},y),w?n.createElement("form",{className:"a-message-editor",onSubmit:z},n.createElement("textarea",{autoFocus:!0,"aria-label":"Edit your message",value:N,"data-action":"view.update",onChange:U=>{x(U.target.value),A.current=U.target.value,T({...S,text:U.target.value})},onKeyDown:U=>{U.key==="Escape"&&(U.preventDefault(),T(null)),U.key==="Enter"&&(U.metaKey||U.ctrlKey)&&(U.preventDefault(),U.currentTarget.form.requestSubmit())}}),n.createElement("p",{className:"a-caption"},I?"Update this unsent message and try again.":"Continue from this point. Later messages leave the active conversation; saved event history and earlier tool effects remain."),!I&&n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:!!(S!=null&&S.fork),"data-action":"view.update",onChange:U=>T({...S,text:N,fork:U.target.checked})}),"Start a new conversation instead"),n.createElement("div",{className:"a-message-edit-actions"},n.createElement("button",{className:"a-soft",type:"button",disabled:p,"data-action":"view.update",onClick:()=>T(null)},"Cancel"),n.createElement("button",{className:"a-primary",type:"submit",disabled:p||k||!N.trim(),"data-action":"message.edit","data-operation-pending":p||void 0,"aria-busy":p||void 0},n.createElement(Li,null),p?"Starting…":"Save & regenerate"))):n.createElement(Oi,{text:e.text||(i?"…":""),reference:e.textDetail,markdown:e.role!=="user",automatic:e.role==="assistant",writingContext:e.role==="assistant"?{sessionId:t.id,messageId:e.id,act:r}:void 0,fileContext:e.role==="assistant"?{sessionId:t.id,workspace:t.workspace,act:r}:void 0}),!w&&n.createElement("div",{className:"a-message-actions"},n.createElement("button",{type:"button",className:"a-icon",title:"Copy as Markdown","aria-label":"Copy message as Markdown","data-action":"message.copy",disabled:g,"data-operation-pending":g||void 0,"aria-busy":g||void 0,onClick:async()=>{if(!I){await r("message.copy",{sessionId:t.id,messageId:e.id});return}E(!0);try{await navigator.clipboard.writeText(e.text),f(!0)}catch(U){b(U.message)}finally{E(!1)}}},(O==null?void 0:O.status)==="ready"||h?n.createElement(Pt,null):n.createElement(rr,null)),!I&&["user","assistant"].includes(e.role)&&n.createElement(VF,{message:e,sessionId:t.id,dispatch:u}),e.role==="user"&&n.createElement("button",{type:"button",className:"a-icon",title:t.historyReadOnlyReason||(t.workspaceAvailable===!1?"Workspace folder unavailable":k?"Wait for the current work to finish":"Edit message"),"aria-label":"Edit message",disabled:k||p||!!I&&F.status!=="failed","data-operation-pending":p||void 0,"aria-busy":p||void 0,"data-action":"view.update",onClick:async()=>{m(!0);try{T({sessionId:t.id,messageId:e.id,text:e.textDetail?await Ll(e.textDetail):e.text,fork:!1})}catch(U){b(U.message)}finally{m(!1)}}},n.createElement(qi,null)),n.createElement(ZF,{message:e,session:t,delivery:F,localDelivery:I,dispatch:u,retry:l,discard:c}),s&&n.createElement(eq,{session:t,turn:s,act:r,working:i}),(O==null?void 0:O.status)==="ready"&&n.createElement("span",{role:"status",className:"a-copy-result success"},"Copied Markdown"),(O==null?void 0:O.status)==="error"&&n.createElement("span",{role:"alert",className:"a-copy-result error"},n.createElement(zn,null),O.message||"Could not copy")))}function eq({session:e,turn:t,act:a,working:r}){return n.createElement("button",{type:"button",className:"a-icon",title:e.historyReadOnlyReason||(e.workspaceAvailable===!1?"Workspace folder unavailable":r?"Wait for the current work to finish":"Fork a new chat from here"),"aria-label":`Fork conversation after turn ${t}`,disabled:r||e.configurationBusy||e.workspaceAvailable===!1||!!e.historyReadOnlyReason,"data-action":"session.fork",onClick:()=>a("session.fork",{id:e.id,turn:t})},n.createElement(Wa,null))}const Ia=e=>JSON.stringify([e.sessionId,e.workerId||null]),tq={idle:"Ready for follow-up",working:"Working",running:"Working",starting:"Starting",queued:"Queued",stopping:"Interruption requested",completed:"Completed",interrupted:"Outcome unknown",error:"Needs attention",cancelled:"Cancelled",stopped:"Stopped"},Gf={selected:[],cursors:{},results:{},drafts:{}};function nq({dispatch:e}){const t="amplifier-coordination-v1",[a,r]=v.useState(()=>{try{return{...Gf,...JSON.parse(sessionStorage.getItem(t)||"null")}}catch{return Gf}}),o=v.useRef(new Set),i=v.useRef(a),[s,l]=v.useState([]),[c,u]=v.useState(""),[d,p]=v.useState(""),[m,h]=v.useState(""),[f,g]=v.useState(null),[E,y]=v.useState(!1),b=x=>{const A=x(i.current);i.current=A,r(A);try{sessionStorage.setItem(t,JSON.stringify(A))}catch{h("This browser could not save delivery cursors. Reports may appear again after reload.")}},S=async()=>{try{const x=await e("coordination.list",{},{feedback:!1});l(x.result.items),x.result.truncated&&h("Showing the first 100 targets. Agents can address any known conversation directly.")}catch(x){u(x.message)}};v.useEffect(()=>{S()},[]),v.useEffect(()=>{if(!a.selected.length)return;let x=!0,A=0;const C=new AbortController;return(async()=>{for(;x;){const O=a.selected.map(k=>({...k,...i.current.cursors[Ia(k)]?{afterCursor:i.current.cursors[Ia(k)]}:{}}));try{y(!0);const k=await e("coordination.wait",{targets:O,waitMs:3e4,maxBytes:32768},{feedback:!1,signal:C.signal});if(!x)return;A=0,p("");const T=k.result;if(T.errors.length){p(T.errors.map(I=>I.error).join(" "));return}b(I=>{const F={...I.cursors},z={...I.results};for(const W of T.targets){const X=Ia(W.target),U=z[X]||[],_=new Set(U.map(P=>P.id));z[X]=[...U,...W.results.filter(P=>!_.has(P.id)).map(P=>({...P,text:P.text.slice(0,4096),textTruncated:P.textTruncated||P.text.length>4096}))].slice(-8),F[X]=W.nextCursor}const q=new Set([...Object.keys(z).slice(-16),...I.selected.map(Ia)]);return{...I,cursors:Object.fromEntries(Object.entries(F).filter(([W])=>q.has(W))),results:Object.fromEntries(Object.entries(z).filter(([W])=>q.has(W)))}}),l(I=>I.map(F=>T.targets.find(z=>Ia(z.target)===Ia(F.target))||F)),T.targets.some(I=>I.cursorGap)&&h("Some older reports are no longer retained here. Open the saved conversation for its available history.")}catch(k){if(!x||k.name==="AbortError")return;p("Waiting to reconnect: "+k.message),await new Promise(T=>{const I=()=>{clearTimeout(F),C.signal.removeEventListener("abort",I),T()},F=setTimeout(I,Math.min(15e3,1e3*2**A++));C.signal.addEventListener("abort",I,{once:!0})})}finally{x&&y(!1)}}})(),()=>{x=!1,C.abort()}},[JSON.stringify(a.selected)]);const w=x=>b(A=>{const C=Ia(x),O=A.selected.some(k=>Ia(k)===C);return{...A,selected:O?A.selected.filter(k=>Ia(k)!==C):[...A.selected,x].slice(0,8)}}),N=async(x,A)=>{const C=Ia(x.target);if(o.current.has(C))return;o.current.add(C);const O=i.current.drafts[C]||"";g(C),u("");try{if((await e(A,{...x.target,...A==="coordination.followup"?{text:O}:{}})).delivery==="unknown"){u("Delivery is unknown. Work was not replayed. Inspect the target before sending another instruction.");return}A==="coordination.followup"&&b(T=>({...T,drafts:{...T.drafts,[C]:""}})),h(A==="coordination.interrupt"?"Interruption requested. Effects may already have happened.":"Follow-up accepted."),await S()}catch(k){u(k.message)}finally{o.current.delete(C),g(null)}};return n.createElement("div",{className:"a-coordination"},n.createElement("p",null,"Follow up on a conversation or its workers without switching away from your current draft. Watch up to eight targets for reports or requests for attention."),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"coordination.list",onClick:S},"Refresh targets"),n.createElement("button",{className:"a-link",disabled:!a.selected.length,onClick:()=>b(x=>({...x,selected:[]}))},"Stop watching"),n.createElement("span",{role:"status"},E?"Waiting for updates…":a.selected.length?`${a.selected.length} targets watched`:"Choose targets to watch")),c&&n.createElement("p",{role:"alert",className:"a-alert"},c),d&&n.createElement("p",{role:"alert",className:"a-alert"},d),m&&n.createElement("p",{role:"status"},m),s.map(x=>{var k;const A=Ia(x.target),C=a.selected.some(T=>Ia(T)===A),O=a.results[A]||[];return n.createElement("section",{key:A,className:"a-coordination-target","aria-label":`${x.kind==="worker"?"Worker":"Conversation"}: ${x.title}`},n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:C,disabled:!C&&a.selected.length>=8,onChange:()=>w(x.target)}),n.createElement("strong",null,x.title)," · ",x.kind==="worker"?"Worker":"Conversation"),n.createElement("p",{className:"a-caption"},tq[x.status]||x.status,x.attention?" · Needs attention":""),O.map(T=>n.createElement("article",{key:T.id,"data-report-id":T.id},n.createElement("p",{style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}},T.text),T.textTruncated&&n.createElement("small",null,"Report excerpt. Open the saved conversation for more."))),n.createElement("details",null,n.createElement("summary",null,"Follow up"),n.createElement("form",{onSubmit:T=>{T.preventDefault(),N(x,"coordination.followup")}},n.createElement("label",null,"Follow-up for ",x.title,n.createElement("textarea",{value:a.drafts[A]||"",disabled:!x.canFollowup||f===A,onChange:T=>b(I=>({...I,drafts:{...I.drafts,[A]:T.target.value}}))})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"coordination.followup",disabled:!x.canFollowup||!((k=a.drafts[A])!=null&&k.trim())||f===A},"Send follow-up")))),n.createElement("button",{type:"button",className:"a-link a-danger","data-action":"coordination.interrupt",disabled:!x.canInterrupt||f===A,onClick:()=>N(x,"coordination.interrupt")},"Interrupt"))}))}function aq(){const e=new Map;return{add(t,a){const r=Symbol();return e.set(r,{patch:{...t},sessionId:a}),r},addCanvas(t,a){var o,i;const r=Symbol();return e.set(r,{canvas:{open:a,sessionId:t.selectedSessionId,canvasId:(o=t.canvas)==null?void 0:o.id,host:(i=t.client)==null?void 0:i.hostInstanceId}}),r},settle(t){e.delete(t)},bindDraft(t,a){const r=e.get(t);r&&Object.hasOwn(r.patch,"draft")&&(r.sessionId=a)},apply(t){var o,i;if(!t||!e.size)return t;let a={...t.view},r=t.canvas;for(const{patch:s,sessionId:l,canvas:c}of e.values()){if(c){c.sessionId===t.selectedSessionId&&c.canvasId===((o=t.canvas)==null?void 0:o.id)&&c.host===((i=t.client)==null?void 0:i.hostInstanceId)&&(r={...r,open:c.open,visibilityPending:!0},c.open||(a.canvasFocused=!1));continue}const u={...s};l!==void 0&&l!==t.selectedSessionId&&delete u.draft,a={...a,...u}}return{...t,view:a,canvas:r}}}}const rq=new Set(["aiConnectionEditor","providerEditor","composerModel","composerBundle","bundleDefaultsDraft"]),oq=(e,t={})=>t.expectedRevision===void 0&&["providers.list","providers.models","providers.schema"].includes(e);function iq(e,t,a={}){var s;if(e!=="view.update"||a.id||a.expectedRevision!==void 0||a.signal||a.pendingViewToken||Object.keys(t).some(l=>!["patch","sessionId"].includes(l)))return null;const r=Object.keys(t.patch||{}),o=r[0],i=(s=t.patch)==null?void 0:s[o];return r.length!==1||!rq.has(o)||!i||typeof i!="object"||Array.isArray(i)?null:JSON.stringify([o,t.sessionId??null,i.sessionId??null])}function sq(){let e=null;return(t,a,r=null,o=null)=>{if(r&&(e==null?void 0:e.queue)===t&&e.key===r&&!e.started)return e.execute=a,e.promise;const i={queue:t,key:r,execute:a,started:!1},s=()=>{i.started=!0,e===i&&(e=null);const l=i.execute;return i.execute=null,l()};return i.promise=(o?Promise.all([t.current,o]):t.current).then(s,s),t.current=i.promise.catch(()=>{}),e=i,i.promise}}function lq(e,t){if(!e||e.revision!==t.baseRevision)throw Error("State stream needs a fresh snapshot.");const a=(o,i,s)=>{if(!i.length)return s.value;const[l,...c]=i,u=Array.isArray(o)?[...o]:{...o};return!c.length&&s.remove?delete u[l]:Object.defineProperty(u,l,{value:a(Object.hasOwn(o||{},l)?o[l]:void 0,c,s),enumerable:!0,configurable:!0,writable:!0}),u};let r=e;for(const o of t.changes)r=a(r,o.path,o);if(r.revision!==t.revision)throw Error("State stream revision mismatch.");return r}function cq(e,t=()=>{}){let a=null,r=null,o=null,i=0;function s(){return r||(a===o?(a=null,Promise.resolve()):(r=(async()=>{for(;a!==null;){const c=a,u=i;if(a=null,c!==o)try{await e(JSON.parse(c)),u===i&&(o=c)}catch(d){t(d)}}})().finally(()=>{r=null,a!==null&&s()}),r))}const l=c=>(a=JSON.stringify(c),s());return l.invalidate=()=>{i++,o=null},l}function uq(e=32){const t=new Map,a=new Map;let r;const o=c=>{var u;return(u=c==null?void 0:c.sessions)==null?void 0:u.find(d=>d.id===c.selectedSessionId)};function i(c){var p;const u=(p=c==null?void 0:c.client)==null?void 0:p.hostInstanceId;r!==void 0&&u!==r&&(t.clear(),a.clear()),r=u;const d=o(c);if(d)for(t.delete(d.id),t.set(d.id,{session:d,canvas:c.canvas,canvasWorkspace:c.canvasWorkspace,canvasArtifacts:c.canvasArtifacts});t.size>e;)t.delete(t.keys().next().value)}function s(c,u){var h,f,g,E;if((f=(h=c==null?void 0:c.canvasWorkspace)==null?void 0:h.views)!=null&&f.some(y=>y.dirty))return null;const d=((g=c==null?void 0:c.sessions)==null?void 0:g.find(y=>y.id===u))||((E=t.get(u))==null?void 0:E.session);if(!d)return null;const p=o(c);p&&i({...c,sessions:c.sessions.map(y=>{var b;return y.id===p.id?{...y,draft:((b=c.view)==null?void 0:b.draft)||""}:y})});const m=Symbol();return a.set(m,{id:u,row:d}),m}function l(c){var S,w,N;if(!c||!a.size)return c;const{id:u,row:d}=Array.from(a.values()).at(-1);if(c.selectedSessionId===u)return{...c,navigationPending:!0};const p=t.get(u),m=((S=c.sessions)==null?void 0:S.find(x=>x.id===u))||d,{messages:h,workers:f,approvals:g,...E}=m,b=m.messageWindow||m.executionWindow||((w=m.messages)==null?void 0:w.length)||((N=m.approvals)==null?void 0:N.length)||m.streaming?m:p?{...p.session,...E}:{...m,historyLoading:!0,messages:[],workers:[],approvals:[]};return{...c,selectedSessionId:u,selectedWorkspaceId:b.workspaceId??c.selectedWorkspaceId,navigationPending:!0,sessions:[...(c.sessions||[]).filter(x=>x.id!==u),b],view:{...c.view,draft:b.draft||""},canvas:(p==null?void 0:p.canvas)||{open:!1},canvasWorkspace:(p==null?void 0:p.canvasWorkspace)||{views:[]},canvasArtifacts:(p==null?void 0:p.canvasArtifacts)||[]}}return{remember:i,begin:s,apply:l,settle:c=>a.delete(c)}}async function dq(e,t,a){const r=i=>{var s,l,c;return(c=(l=(s=i==null?void 0:i.sessions)==null?void 0:s.find(u=>u.id===t.sessionId))==null?void 0:l.messages)==null?void 0:c.find(u=>u.id===t.messageId)};let o=r(e);if(!o){const i=await a("/api/state?sessionId="+encodeURIComponent(t.sessionId));o=r(i.state||i)}if(!o)throw Error("Message no longer available");return o.textDetail?Ll(o.textDetail,a):o.text||""}async function pq(e,{request:t,download:a,clipboard:r}){let o="ready",i=e.destination==="clipboard"?"Copied conversation Markdown":"Markdown download started";try{const s=await t(e.url);e.destination==="clipboard"?await r.writeText(s.content):a(s.filename,s.content,s.mimeType)}catch(s){o="error",i="Could not export: "+s.message}await t("/api/actions",{method:"POST",body:{action:"session.exportResult",args:{requestId:e.requestId,status:o,message:i}}})}class mq{constructor({document:t=globalThis.document,navigator:a=globalThis.navigator,onState:r=()=>{}}={}){var o;this.document=t,this.navigator=a,this.onState=r,this.active=!1,this.enabled=!0,this.sentinel=null,this.pending=null,this.epoch=0,this.visible=()=>{var i;((i=this.document)==null?void 0:i.visibilityState)==="visible"&&this.acquire()},(o=this.document)==null||o.addEventListener("visibilitychange",this.visible)}setActive(t){this.active!==t&&(this.active=t,t?this.acquire():this.release())}setEnabled(t){this.enabled=t,t?this.acquire():this.release()}async acquire(){var r,o,i;if(!this.active||!this.enabled||((r=this.document)==null?void 0:r.visibilityState)!=="visible"||this.sentinel||this.pending)return;if(!((i=(o=this.navigator)==null?void 0:o.wakeLock)!=null&&i.request)){this.onState("unsupported");return}const t=this.epoch,a=this.pending=Promise.resolve().then(()=>this.navigator.wakeLock.request("screen"));try{const s=await a;if(t!==this.epoch||!this.active||!this.enabled||this.document.visibilityState!=="visible"){await s.release();return}this.sentinel=s,s.addEventListener("release",()=>{this.sentinel===s&&(this.sentinel=null,this.onState(this.active&&this.enabled?"released":"off"))},{once:!0}),this.onState(s.released?"released":"active"),s.released&&(this.sentinel=null)}catch{t===this.epoch&&this.active&&this.enabled&&this.onState("unavailable")}finally{this.pending===a&&(this.pending=null),t!==this.epoch&&this.active&&this.enabled&&this.acquire()}}release(){++this.epoch;const t=this.sentinel;this.sentinel=null,t&&Promise.resolve(t.release()).catch(()=>{}),this.onState("off")}dispose(){var t;this.active=!1,this.release(),(t=this.document)==null||t.removeEventListener("visibilitychange",this.visible)}}class hq{constructor({navigator:t=globalThis.navigator,document:a=globalThis.document,Metadata:r=globalThis.MediaMetadata,getAudio:o=()=>null,onState:i=()=>{},onAction:s=()=>{},onError:l=()=>{}}={}){Object.assign(this,{navigator:t,document:a,Metadata:r,getAudio:o,onState:i,onAction:s,onError:l}),this.active=!1,this.epoch=0,this.handlers=[],this.trackListeners=[],this.tracks=[],this.onVisibility=()=>{this.active&&(a==null?void 0:a.visibilityState)==="visible"&&this.resumePlayback()},a==null||a.addEventListener("visibilitychange",this.onVisibility)}start(){var t,a,r,o;if(!this.active){if(this.active=!0,++this.epoch,this.onState({audioSessionState:"unavailable",microphoneInterrupted:!1,microphoneEnded:!1,playbackBlocked:!1}),this.audioSession=(t=this.navigator)==null?void 0:t.audioSession,this.audioSession){try{this.previousType=this.audioSession.type,this.audioSession.type="play-and-record"}catch{this.previousType=void 0}this.audioChanged=()=>{this.active&&(this.onState({audioSessionState:this.audioSession.state}),this.syncMicrophone(),this.audioSession.state==="active"&&this.resumePlayback())},(r=(a=this.audioSession).addEventListener)==null||r.call(a,"statechange",this.audioChanged),this.audioChanged()}if(this.mediaSession=(o=this.navigator)==null?void 0:o.mediaSession,!!this.mediaSession){try{this.previousMetadata=this.mediaSession.metadata,this.previousPlaybackState=this.mediaSession.playbackState,this.Metadata&&(this.metadata=new this.Metadata({title:"Amplifier voice call"}),this.mediaSession.metadata=this.metadata),this.mediaSession.playbackState="playing"}catch{}for(const[i,s]of[["togglemicrophone",()=>this.onAction("call.mute",{muted:!this.muted})],["hangup",()=>this.onAction("call.end")]]){const l=this.epoch;try{this.mediaSession.setActionHandler(i,()=>{if(!(!this.active||l!==this.epoch))try{Promise.resolve(s()).catch(c=>this.onError(c))}catch(c){this.onError(c)}}),this.handlers.push(i)}catch{}}}}}attachStream(t){this.removeTrackListeners(),this.tracks=t.getAudioTracks();for(const a of this.tracks)for(const r of["mute","unmute","ended"]){const o=()=>{this.active&&(this.syncMicrophone(),r==="unmute"&&this.resumePlayback())};a.addEventListener(r,o),this.trackListeners.push([a,r,o])}this.syncMicrophone()}setMuted(t){this.muted=t,this.syncMicrophone()}syncMicrophone(){var r,o,i;if(!this.active)return;const t=this.tracks.filter(s=>s.readyState!=="ended"),a=t.some(s=>s.muted);this.onState({microphoneInterrupted:a,microphoneEnded:this.tracks.length>0&&!t.length});try{Promise.resolve((i=(r=this.mediaSession)==null?void 0:r.setMicrophoneActive)==null?void 0:i.call(r,!this.muted&&((o=this.audioSession)==null?void 0:o.state)!=="interrupted"&&t.some(s=>s.enabled&&!s.muted))).catch(()=>{})}catch{}}async resumePlayback(){var o;const t=this.getAudio();if(!this.active||!(t!=null&&t.srcObject)||((o=this.audioSession)==null?void 0:o.state)==="interrupted"||this.playPending)return;const a=this.epoch;let r;try{r=Promise.resolve(t.play())}catch(i){r=Promise.reject(i)}this.playPending=r;try{await r,this.active&&a===this.epoch&&this.onState({playbackBlocked:!1})}catch{this.active&&a===this.epoch&&this.onState({playbackBlocked:!0})}finally{this.playPending===r&&(this.playPending=null)}}removeTrackListeners(){for(const[t,a,r]of this.trackListeners)t.removeEventListener(a,r);this.trackListeners=[],this.tracks=[]}stop(){var t,a,r,o;if(this.active){this.active=!1,++this.epoch,this.playPending=null,this.removeTrackListeners(),(a=(t=this.audioSession)==null?void 0:t.removeEventListener)==null||a.call(t,"statechange",this.audioChanged);try{this.previousType!==void 0&&this.audioSession.type==="play-and-record"&&(this.audioSession.type=this.previousType)}catch{}for(const i of this.handlers)try{this.mediaSession.setActionHandler(i,null)}catch{}this.handlers=[];try{Promise.resolve((o=(r=this.mediaSession)==null?void 0:r.setMicrophoneActive)==null?void 0:o.call(r,!1)).catch(()=>{})}catch{}try{this.mediaSession&&(!this.metadata||this.mediaSession.metadata===this.metadata)&&(this.mediaSession.metadata=this.previousMetadata??null,this.mediaSession.playbackState=this.previousPlaybackState||"none")}catch{}this.audioSession=this.mediaSession=this.metadata=null,this.onState({audioSessionState:"inactive",microphoneInterrupted:!1,microphoneEnded:!1,playbackBlocked:!1})}}dispose(){var t;this.stop(),(t=this.document)==null||t.removeEventListener("visibilitychange",this.onVisibility)}}class fq{constructor({request:t,onState:a=()=>{},onError:r=()=>{},onAction:o}){this.request=t,this.onState=a,this.onError=r,this.state={status:"idle",muted:!1,keepAwake:!0,wakeLock:"off"},this.wakeLock=new mq({onState:i=>this.update({wakeLock:i})}),this.generation=0,this.peer=null,this.stream=null,this.events=null,this.audio=null,this.callAudio=new hq({getAudio:()=>this.audio,onState:i=>this.update(i),onError:r,onAction:o||((i,s)=>i==="call.mute"?this.setMuted(s.muted):this.end())}),this.readySent=!1,this.onPageHide=()=>{++this.generation,this.state.id&&this.request("/api/voice/end",{method:"POST",body:{id:this.state.id},keepalive:!0}).catch(()=>{}),this.release(),this.update({status:"ended",id:null})},window.addEventListener("pagehide",this.onPageHide)}update(t){this.state={...this.state,...t},this.onState({...this.state}),t.status&&this.wakeLock.setActive(["connecting","connected"].includes(t.status))}async start({provider:t="auto",sessionId:a=null}={}){var o;if(["connecting","connected"].includes(this.state.status))return this.state;if(!((o=navigator.mediaDevices)!=null&&o.getUserMedia)||!window.RTCPeerConnection)throw new Error("Voice needs a browser with microphone and WebRTC support, on localhost or HTTPS.");const r=++this.generation;this.update({status:"connecting",error:null,muted:!1});try{const i=await this.request("/api/voice/config");if(!i.available)throw new Error(i.reason||"Voice is not configured on the host.");if(r!==this.generation)return this.state;this.callAudio.start(),this.callAudio.setMuted(!1);const s=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});if(r!==this.generation)return s.getTracks().forEach(p=>p.stop()),this.state;this.stream=s,s.getAudioTracks().forEach(p=>{p.enabled=!this.state.muted}),this.callAudio.attachStream(s);const l=this.peer=new RTCPeerConnection;this.audio=new Audio,this.audio.autoplay=!0,this.audio.setAttribute("playsinline",""),l.addEventListener("track",p=>{r!==this.generation||!this.audio||(this.audio.srcObject=p.streams[0]||new MediaStream([p.track]),this.callAudio.resumePlayback())}),s.getTracks().forEach(p=>l.addTrack(p,s));const c=this.events=l.createDataChannel("oai-events");this.readySent=!1;const u=async()=>{if(!(this.readySent||!this.state.id||l.connectionState!=="connected"||c.readyState!=="open")){this.readySent=!0;try{await this.request("/api/voice/ready",{method:"POST",body:{id:this.state.id}}),r===this.generation&&this.update({status:"connected"})}catch(p){this.onError(p),await this.end()}}};c.addEventListener("open",u),c.addEventListener("message",p=>{try{JSON.parse(p.data).type==="session.closed"&&r===this.generation&&(this.release(),this.update({status:"ended",finalized:!0}))}catch{}}),l.addEventListener("connectionstatechange",()=>{u(),l.connectionState==="failed"&&r===this.generation&&(this.onError(new Error("The voice connection failed. Your background work continues.")),this.end().catch(this.onError))}),await l.setLocalDescription(await l.createOffer());const d=await this.request("/api/voice/connect",{method:"POST",body:{sdp:l.localDescription.sdp,provider:t,sessionId:a}});return r!==this.generation?(await this.request("/api/voice/end",{method:"POST",body:{id:d.id}}),this.state):(this.update({id:d.id,provider:d.provider,model:d.model,fallbackReason:d.fallbackReason||null}),await l.setRemoteDescription({type:"answer",sdp:d.sdp}),await u(),this.connectionTimer=setTimeout(()=>{r===this.generation&&this.state.status==="connecting"&&(this.onError(new Error("Voice media could not connect. Check microphone and network access, then try again.")),this.end().catch(this.onError))},25e3),this.state)}catch(i){if(r!==this.generation)return this.state;if(this.state.id)try{await this.request("/api/voice/end",{method:"POST",body:{id:this.state.id}})}catch{}this.release();const s=i.name==="NotAllowedError"?"Microphone access was declined. Allow microphone access for this site, then call again.":i.message;throw this.update({status:"error",error:s,id:null}),new Error(s)}}setKeepAwake(t){this.update({keepAwake:!!t}),this.wakeLock.setEnabled(!!t)}setMuted(t){var r;const a=!!t;(r=this.stream)==null||r.getAudioTracks().forEach(o=>{o.enabled=!a}),this.update({muted:a}),this.callAudio.setMuted(a)}async end(){var a;++this.generation,this.update({status:"ending"}),(a=this.stream)==null||a.getAudioTracks().forEach(r=>{r.enabled=!1});let t;try{return t=await this.request("/api/voice/end",{method:"POST",body:{id:this.state.id||null}}),t}finally{this.release(),this.update({status:"ended",finalized:(t==null?void 0:t.finalized)||!1,id:null})}}release(){var t,a,r;this.callAudio.stop(),this.wakeLock.setActive(!1),clearTimeout(this.connectionTimer),(t=this.stream)==null||t.getTracks().forEach(o=>o.stop()),(a=this.events)==null||a.close(),(r=this.peer)==null||r.close(),this.audio&&(this.audio.pause(),this.audio.srcObject=null),this.peer=this.stream=this.events=this.audio=null}dispose(){++this.generation,this.onPageHide(),window.removeEventListener("pagehide",this.onPageHide),this.wakeLock.dispose(),this.callAudio.dispose()}}function gq(e,t){return new Promise((a,r)=>{let o=!1,i;const s=(c,u)=>{var d,p;if(o){(d=u==null?void 0:u.close)==null||d.call(u);return}o=!0,clearTimeout(l),i!==void 0&&((p=t.cancelVideoFrameCallback)==null||p.call(t,i)),c?r(c):a(u)},l=setTimeout(()=>s(Error("No fresh screen frame arrived.")),2e3);try{globalThis.ImageCapture?new globalThis.ImageCapture(e).grabFrame().then(c=>s(null,c),c=>s(c)):t.requestVideoFrameCallback?i=t.requestVideoFrameCallback(()=>s(null,t)):s(Error("Fresh frame capture is unsupported by this browser."))}catch(c){s(c)}})}class vk{constructor({request:t,onState:a=()=>{},getVoice:r,scope:o="voice",media:i=(s=>(s=globalThis.navigator)==null?void 0:s.mediaDevices)()}){var l;Object.assign(this,{request:t,onState:a,getVoice:r,media:i,scope:o}),this.generation=0,this.stream=null,this.grant=null,this.video=null,this.onPageHide=()=>this.stop(),(l=globalThis.window)==null||l.addEventListener("pagehide",this.onPageHide)}url(t){return`/api/${this.scope}/visual/${t}`}target(t){return{sessionId:t.sessionId,callId:this.scope==="voice"?t.id:null}}state(t){this.value={...this.value,...t},this.onState(this.value)}active(t){const a=this.getVoice();return(a==null?void 0:a.status)==="connected"&&a.id===t}async choose(){var r;const t=this.getVoice();if((t==null?void 0:t.status)!=="connected"||!t.id)throw Error(this.scope==="voice"?"Connect a voice call before choosing a screen source.":"Open a conversation before choosing a screen source.");if(!((r=this.media)!=null&&r.getDisplayMedia))throw Error("Screen capture is unavailable in this browser. Use a desktop browser on localhost or HTTPS.");this.stop();const a=this.generation;this.state({status:"choosing",error:null});try{const o=await this.media.getDisplayMedia({video:{width:{ideal:1280},height:{ideal:1280}},audio:!1});if(a!==this.generation||!this.active(t.id))throw o.getTracks().forEach(d=>d.stop()),Error("The chat or call changed while choosing a source.");this.stream=o;const i=o.getVideoTracks()[0];if(!i)throw Error("The selected source has no video track.");i.addEventListener("ended",()=>this.stop());const s=document.createElement("video");if(s.muted=!0,s.playsInline=!0,s.srcObject=o,this.video=s,await s.play(),a!==this.generation||!this.active(t.id))throw Error("The chat or call ended while preparing the source.");const l=i.getSettings().displaySurface||"unknown",c={kind:["browser","window","monitor"].includes(l)?l:"unknown",label:(i.label||"User-selected source").slice(0,200)},u=await this.request(this.url("grant"),{method:"POST",body:{...this.target(t),source:c}});if(a!==this.generation||!this.active(t.id))throw await this.request(this.url("revoke"),{method:"POST",body:{grantId:u.id}}).catch(()=>{}),Error("The chat or call changed; source permission was discarded.");this.grant=u,this.expiry=setTimeout(()=>this.stop(),Math.max(0,u.expiresAt*1e3-Date.now())),this.state({status:"ready",source:c,grantId:u.id})}catch(o){throw a===this.generation&&(this.stop(),this.state({status:"error",error:o.name==="NotAllowedError"?"Screen permission was not granted.":o.message})),o}}async checkNative(){const t=this.getVoice(),a=await this.request(this.url("native/status"),{method:"POST",body:this.target(t)});if(!this.active(t.id))throw Error("The chat or call ended while checking the desktop host.");return this.state({native:a}),a}async chooseNative(){var i;const t=this.getVoice(),a=(i=this.value)==null?void 0:i.native;if(!(a!=null&&a.available)||!this.active(t.id))throw Error("Check the desktop host before granting access.");this.stop();const r=this.generation,o=await this.request(this.url("grant"),{method:"POST",body:{...this.target(t),source:{kind:"native-foreground",hostId:a.host.id,hostInstanceId:a.hostInstanceId}}});if(r!==this.generation||!this.active(t.id))throw await this.request(this.url("revoke"),{method:"POST",body:{grantId:o.id}}).catch(()=>{}),Error("The chat or call changed; source permission was discarded.");this.grant=o,this.expiry=setTimeout(()=>this.stop(),Math.max(0,o.expiresAt*1e3-Date.now())),this.state({status:"ready",source:o.source,grantId:o.id})}sync(t,a,r){var i,s,l,c,u;const o=(i=this.getVoice())==null?void 0:i.id;this.scope==="computer"&&this.lastIdentity!==void 0&&this.lastIdentity!==o&&(this.stop(),this.state({native:null,capturedAt:null})),this.lastIdentity=o,this.grant&&(!a||!this.active(((s=this.grant)==null?void 0:s.callId)||((l=this.grant)==null?void 0:l.sessionId)||(t==null?void 0:t.id))||this.grant&&((r==null?void 0:r.available)===!1||r!=null&&r.id&&r.id!==this.grant.id))&&this.stop(),this.grant&&((c=r==null?void 0:r.lastCapture)==null?void 0:c.grantId)===this.grant.id&&r.lastCapture.capturedAt!==((u=this.value)==null?void 0:u.capturedAt)&&this.state({capturedAt:r.lastCapture.capturedAt})}async capture(t){var i,s;const a=this.grant,r=this.generation,o={requestId:t.id,grantId:t.grantId,sessionId:t.sessionId,callId:t.callId};try{if(!a||t.grantId!==a.id||t.callId!==a.callId||t.sessionId!==a.sessionId||!this.active(a.callId||a.sessionId))throw Error("This screen source is no longer authorized.");const l=(i=this.stream)==null?void 0:i.getVideoTracks()[0];if(!l||l.readyState!=="live"||l.muted)throw Error("The selected source is unavailable or paused.");const c=this.video,u=await gq(l,c);let d;try{if(r!==this.generation||!this.active(a.callId||a.sessionId)||l.readyState!=="live"||l.muted)throw Error("Screen sharing ended before capture.");const m=u===c?c.videoWidth:u.width,h=u===c?c.videoHeight:u.height;if(!m||!h)throw Error("The source did not provide visible pixels.");const f=document.createElement("canvas"),g=Math.min(1,1280/Math.max(m,h));if(f.width=Math.max(1,Math.round(m*g)),f.height=Math.max(1,Math.round(h*g)),f.getContext("2d").drawImage(u,0,0,f.width,f.height),d=f.toDataURL("image/png").split(",")[1],d.length>666668)throw Error("This image is too large. Select a smaller window.")}finally{u!==c&&u.close()}const p=Date.now()/1e3;await this.request(this.url("complete"),{method:"POST",body:{...o,image:d,capturedAt:p}}),r===this.generation&&((s=this.grant)==null?void 0:s.id)===a.id&&this.state({status:"ready",capturedAt:p,error:null})}catch(l){this.state({error:l.message}),await this.request(this.url("complete"),{method:"POST",body:{...o,error:l.message}}).catch(()=>{})}}stop(){var a;++this.generation,clearTimeout(this.expiry);const t=this.grant;this.grant=null,(a=this.stream)==null||a.getTracks().forEach(r=>r.stop()),this.stream=null,this.video&&(this.video.pause(),this.video.srcObject=null,this.video=null),this.state({status:"idle",source:null,grantId:null,capturedAt:null}),t&&this.request(this.url("revoke"),{method:"POST",body:{grantId:t.id},keepalive:!0}).catch(()=>{})}dispose(){var t;this.stop(),(t=globalThis.window)==null||t.removeEventListener("pagehide",this.onPageHide)}}class vq extends vk{constructor({getSession:t,...a}){super({...a,scope:"computer",getVoice:()=>{const r=t();return{sessionId:r,id:r,status:r?"connected":"idle"}}})}}function bq({sessionId:e,visual:t,client:a,dispatch:r,onError:o}){const i=u=>Promise.resolve().then(u).catch(o),s="this chat in this browser",l="computer.visual",c={sessionId:e};return e?n.createElement("section",{className:"a-card","aria-label":"Computer use"},n.createElement("h3",null,"Screen context for ",s),n.createElement("p",{className:"a-caption"},"Choose a window, tab, display, or the named desktop host. Only explicit captures are sent. Amplifier may capture that source when you ask about it. Access expires after 15 minutes or when you stop sharing, switch chats or disconnect. Sharing works with both text and voice, and stays active when a call starts or ends. Saved snapshots stay in the conversation."),n.createElement("div",{"data-runtime-section":"desktop-host",tabIndex:-1},n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",onClick:()=>i(()=>a.current.checkNative())},"Check desktop host")),t.native&&n.createElement("div",{role:"status"},n.createElement("p",null,"Desktop host: ",t.native.host.label,". This is the server's desktop, which may differ from this browser's device."),t.native.available?n.createElement("button",{className:"a-soft",onClick:()=>i(()=>a.current.chooseNative())},"Allow foreground snapshots from ",t.native.host.label," for ",s):n.createElement(n.Fragment,null,n.createElement("p",null,"Native observation is unavailable (",t.native.code||t.native.status,"). ",t.native.code==="backend_not_installed"?"The optional native-desktop library is missing from the serving app environment; a worker installation does not supply it.":t.native.code==="unsupported"?"The native source requires a local macOS host. Choose a browser screen source instead.":"Check the named host and its Screen Recording permission. Checking does not request permission or capture the screen."),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i(()=>r("view.update",{patch:{panel:"settings",settingsSection:"setup",settingsExpanded:["desktop"]}}))},"Open desktop setup")))),n.createElement("div",{"data-runtime-section":"screen-source",tabIndex:-1},t.source&&n.createElement("p",null,"Selected ",t.source.kind,": ",t.source.label),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:t.status==="choosing",onClick:()=>{a.current.choose().catch(o)}},"Choose screen source"))),n.createElement("div",{"data-runtime-section":"capture",tabIndex:-1,className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":l+".capture",disabled:t.status!=="ready",onClick:()=>i(()=>r(l+".capture",c))},"Capture screen"),n.createElement("button",{className:"a-soft","data-action":l+".revoke",disabled:t.status!=="ready",onClick:()=>i(async()=>{a.current.stop(),await r(l+".revoke",c)})},"Stop screen sharing")),t.capturedAt&&n.createElement("p",{className:"a-caption"},"Last captured ",new Date(t.capturedAt*1e3).toLocaleTimeString(),". Available for the next text or spoken request for 30 seconds."),t.error&&n.createElement("p",{role:"status"},t.error),n.createElement("p",{className:"a-caption"},"Native foreground snapshots identify the visible window on the explicitly selected host. Desktop control is not granted.")):null}function yq({sessionId:e,visual:t,client:a,dispatch:r,onError:o}){return t.status!=="ready"||!t.source?null:n.createElement("div",{className:"a-sharing-strip",role:"status","aria-label":"Screen sharing active","data-part":"screen-sharing"},n.createElement("span",null,n.createElement("strong",null,"Sharing active"),n.createElement("small",null,t.source.label||t.source.kind)),n.createElement("button",{type:"button",className:"a-soft","data-action":"computer.visual.revoke",onClick:()=>{a.current.stop(),r("computer.visual.revoke",{sessionId:e}).catch(o)}},"Stop sharing"))}function Eq({state:e,act:t}){var m,h;const[a,r]=v.useState(""),[o,i]=v.useState(!1),[s,l]=v.useState(null),c=v.useRef(!1),u=(((m=e.feedback)==null?void 0:m.requests)||[]).filter(f=>f.status==="unknown"),d=(((h=e.feedback)==null?void 0:h.followups)||[]).find(f=>f.requestId===s);async function p(f){if(c.current)return;c.current=!0,i(!0),r("");const g=crypto.randomUUID();l(g);try{await t("feedback.reconcile",{requestId:g,feedbackId:f})}catch(E){r(E.message)}finally{c.current=!1,i(!1)}}return n.createElement("section",{"aria-label":"Unconfirmed feedback delivery"},!!u.length&&n.createElement(n.Fragment,null,n.createElement("h3",null,"Unconfirmed delivery"),n.createElement("p",null,"Check for the original report using its saved identity. Checking never sends it again."),u.map(f=>n.createElement("div",{key:f.requestId},n.createElement("strong",null,f.title),n.createElement("button",{type:"button",className:"a-soft","data-action":"feedback.reconcile",disabled:o||["queued","sending"].includes(d==null?void 0:d.status),onClick:()=>p(f.requestId)},"Check delivery")))),d&&n.createElement("p",{role:"status"},d.message),a&&n.createElement("p",{role:"alert"},a))}function wq({state:e,report:t,act:a}){var x,A;const r=(x=e.view)==null?void 0:x.feedbackCorrectionDraft,[o,i]=v.useState(r||null),[s,l]=v.useState(!1),[c,u]=v.useState(""),d=v.useRef(o),p=v.useRef(Promise.resolve()),m=v.useRef(!1),h=v.useRef(null),f=v.useRef(!1);v.useEffect(()=>()=>{clearTimeout(h.current),f.current&&b(d.current).catch(()=>{})},[]),v.useEffect(()=>{!f.current&&!m.current&&(d.current=r||null,i(r||null))},[r]);const g=(((A=e.feedback)==null?void 0:A.followups)||[]).find(C=>{var O;return C.requestId===((O=o==null?void 0:o.pending)==null?void 0:O.requestId)}),E=(o==null?void 0:o.feedbackId)===t.feedbackId,y=["submitted","unknown","failed"].includes(g==null?void 0:g.status);function b(C){clearTimeout(h.current),f.current=!0,d.current=C,i(C);const O=p.current.catch(()=>{}).then(()=>a("view.update",{patch:{feedbackCorrectionDraft:C}})).then(k=>{if((k==null?void 0:k.accepted)===!1)throw Error("The correction draft could not be saved.");d.current===C&&(f.current=!1)});return p.current=O,O.catch(k=>u(k.message)),O}function S(C){f.current=!0,d.current={...d.current,...C},i(d.current),clearTimeout(h.current),h.current=setTimeout(()=>void b(d.current).catch(()=>{}),250)}function w(){u(""),b({feedbackId:t.feedbackId,title:t.editableTitle,body:t.editableBody,expectedRevision:t.revision})}async function N(C){if(C.preventDefault(),!(m.current||y)){m.current=!0,l(!0),u("");try{const O=d.current,k=O.pending||{requestId:crypto.randomUUID(),feedbackId:O.feedbackId,title:O.title,body:O.body,expectedRevision:O.expectedRevision};await b({...O,pending:k}),await a("feedback.update",k)}catch(O){u(O.message||"Delivery was not acknowledged. Retry only this same request.")}finally{m.current=!1,l(!1)}}}return E?n.createElement("form",{onSubmit:N,"aria-label":"Feedback correction"},n.createElement("h4",null,"Correction version"),n.createElement("p",null,"The correction is added as a comment. The original report and maintainer edits stay intact."),n.createElement("label",{htmlFor:"feedback-corrected-title"},"Corrected title"),n.createElement("input",{id:"feedback-corrected-title",maxLength:200,required:!0,disabled:!!o.pending||s,value:o.title,onChange:C=>S({title:C.target.value}),onBlur:()=>void b(d.current).catch(()=>{})}),n.createElement("label",{htmlFor:"feedback-corrected-body"},"Corrected description"),n.createElement("textarea",{id:"feedback-corrected-body",maxLength:16e3,required:!0,disabled:!!o.pending||s,value:o.body,onChange:C=>S({body:C.target.value}),onBlur:()=>void b(d.current).catch(()=>{})}),o.expectedRevision!==t.revision&&!o.pending&&n.createElement(n.Fragment,null,n.createElement("p",null,"The report changed. Review the refreshed report before using it as the correction's starting revision."),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>b({...d.current,expectedRevision:t.revision})},"Use reviewed revision")),!y&&n.createElement("button",{className:"a-primary","data-action":"feedback.update",disabled:s||["queued","sending"].includes(g==null?void 0:g.status)||o.expectedRevision!==t.revision||!o.title.trim()||!o.body.trim()},o.pending?"Check correction status":"Publish correction comment"),g&&n.createElement("p",{role:"status"},g.message),(g==null?void 0:g.commentUrl)&&n.createElement("a",{href:g.commentUrl,target:"_blank",rel:"noopener noreferrer"},"View correction"),(y||!o.pending)&&n.createElement("button",{type:"button",className:"a-soft",disabled:s,onClick:()=>b(null)},"Close correction draft"),c&&n.createElement("p",{role:"alert"},c)):n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-soft",onClick:w,disabled:!!(o!=null&&o.body)},"Draft a correction"),(o==null?void 0:o.body)&&n.createElement("p",null,"A correction for another report is saved. Return to that report before starting another."))}function kq({state:e,report:t,act:a}){var f,g;const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1),c=(f=e.view)==null?void 0:f.feedbackLifecycleDraft,u=(c==null?void 0:c.feedbackId)===t.feedbackId?c:null,d=(((g=e.feedback)==null?void 0:g.followups)||[]).find(E=>E.requestId===(u==null?void 0:u.requestId)),p=u&&!["submitted","failed","unknown"].includes(d==null?void 0:d.status);async function m(){if(l.current)return;l.current=!0,o(!0),s("");const E=t.state==="closed"?"feedback.reopen":"feedback.close",y=p?u:{action:E,requestId:crypto.randomUUID(),feedbackId:t.feedbackId,expectedRevision:t.revision};try{const b=await a("view.update",{patch:{feedbackLifecycleDraft:{...y,readRequestId:t.requestId}}});if((b==null?void 0:b.accepted)===!1)throw Error("Could not save the change request.");const{action:S,readRequestId:w,...N}=y;await a(S,N)}catch(b){s(b.message||"The state change was not acknowledged. Check this same request.")}finally{l.current=!1,o(!1)}}const h=d&&["submitted","unknown"].includes(d.status)&&t.requestId===(u==null?void 0:u.readRequestId);return n.createElement("section",{"aria-label":"Feedback report state"},n.createElement("button",{type:"button",className:"a-soft","data-action":t.state==="closed"?"feedback.reopen":"feedback.close",disabled:r||["queued","sending"].includes(d==null?void 0:d.status)||h,onClick:m},p?"Check state change":t.state==="closed"?"Reopen my report":"Close my report"),d&&n.createElement("p",{role:"status"},d.message," Refresh the report to review its current state."),i&&n.createElement("p",{role:"alert"},i))}function xq({state:e,act:t}){var I,F,z,q,W,X,U;const a=(((I=e.feedback)==null?void 0:I.requests)||[]).filter(_=>_.status==="submitted"),r=(F=e.view)==null?void 0:F.feedbackFollowupDraft,[o,i]=v.useState(r||{feedbackId:"",body:""}),[s,l]=v.useState(""),[c,u]=v.useState(!1),d=v.useRef(o),p=v.useRef(!1),m=v.useRef(!1),h=v.useRef(null),f=v.useRef(null);v.useEffect(()=>()=>{clearTimeout(h.current),p.current&&A().catch(()=>{})},[]),v.useEffect(()=>{r&&!p.current&&!m.current&&(d.current=r,i(r))},[r]);const g=o.pending,E=g&&(((z=e.feedback)==null?void 0:z.followups)||[]).find(_=>_.requestId===g.requestId),y=E||(((q=e.feedback)==null?void 0:q.followups)||[]).find(_=>_.requestId===o.submittedRequestId&&_.feedbackId===o.feedbackId&&_.status==="submitted");v.useEffect(()=>{var _;(E==null?void 0:E.status)!=="submitted"||((_=d.current.pending)==null?void 0:_.requestId)!==E.requestId||(l(""),C({feedbackId:d.current.feedbackId,body:"",submittedRequestId:E.requestId}).catch(()=>l("The comment was sent, but the cleared draft could not be saved. Reconnect and try again.")))},[E==null?void 0:E.status,E==null?void 0:E.requestId]);const b=(((W=e.feedback)==null?void 0:W.followups)||[]).find(_=>{var P;return _.feedbackId===o.feedbackId&&_.requestId===((P=e.feedback)==null?void 0:P.readRequestId)}),S=((U=(X=e.feedback)==null?void 0:X.report)==null?void 0:U.feedbackId)===o.feedbackId?e.feedback.report:null,w=c||["queued","sending"].includes(E==null?void 0:E.status),N=["submitted","unknown","failed"].includes(E==null?void 0:E.status);function x(_){p.current=!0,d.current={...d.current,..._},i(d.current),clearTimeout(h.current),h.current=setTimeout(()=>A().catch(()=>l("The draft could not be saved.")),250)}async function A(){if(clearTimeout(h.current),f.current)return await f.current,A();if(!p.current)return;const _=d.current,P=t("view.update",{patch:{feedbackFollowupDraft:_}});f.current=P;try{const G=await P;if(!G||G.accepted===!1)throw Error("The draft could not be saved.");d.current===_&&(p.current=!1)}finally{f.current=null}if(p.current)return A()}async function C(_){d.current=_,p.current=!0,i(_),await A()}async function O(_=1){l("");try{await C(d.current),await t("feedback.get",{requestId:crypto.randomUUID(),feedbackId:d.current.feedbackId,page:_})}catch{l("Could not load the report. Check the connection and try again.")}}async function k(_){if(_.preventDefault(),m.current||w||N)return;m.current=!0,u(!0),l("");const P=d.current.pending||{requestId:crypto.randomUUID(),feedbackId:d.current.feedbackId,body:d.current.body},G={...d.current,pending:P};d.current=G,i(G);try{await C(G),await t("feedback.comment",P)}catch{l("The comment was not acknowledged. Check the same request below; it will not post twice.")}finally{m.current=!1,u(!1)}}async function T(){const _={feedbackId:o.feedbackId,body:""};try{await C(_),d.current=_,i(_),l("")}catch{l("Could not start a new comment.")}}return a.length?n.createElement("section",{className:"a-feedback-followup","aria-label":"Feedback follow-up"},n.createElement("h3",null,"Follow up on feedback"),n.createElement("label",{htmlFor:"feedback-report"},"Submitted report"),n.createElement("select",{id:"feedback-report","data-action":"view.update",disabled:!!g||c,value:o.feedbackId,onChange:_=>x({feedbackId:_.target.value})},n.createElement("option",{value:""},"Choose a report"),a.map(_=>n.createElement("option",{key:_.requestId,value:_.requestId},_.title))),n.createElement("button",{type:"button",className:"a-soft","data-action":"feedback.get",disabled:!o.feedbackId||c||["queued","sending"].includes(b==null?void 0:b.status),onClick:()=>O()},"Refresh report"),b&&n.createElement(nt,{phase:b.status==="failed"?"error":b.status==="completed"?"success":"working",message:b.message}),S&&n.createElement("div",{className:"a-feedback-report"},n.createElement("h4",null,S.title," · ",S.state),n.createElement("a",{href:S.url,target:"_blank",rel:"noopener noreferrer"},"Open issue on GitHub"),n.createElement("pre",null,S.body),S.comments.map(_=>n.createElement("div",{key:_.id},n.createElement("strong",null,_.author.login),n.createElement("small",null," ",_.createdAt),n.createElement("pre",null,_.body))),n.createElement("div",null,S.page>1&&n.createElement("button",{type:"button",className:"a-link","data-action":"feedback.get",onClick:()=>O(S.page-1)},"Previous comments"),S.hasMore&&n.createElement("button",{type:"button",className:"a-link","data-action":"feedback.get",onClick:()=>O(S.page+1)},"More comments"))),S&&n.createElement(wq,{key:S.feedbackId,state:e,report:S,act:t}),S&&n.createElement(kq,{state:e,report:S,act:t}),n.createElement("form",{onSubmit:k,"data-action":"feedback.comment"},n.createElement("label",{htmlFor:"feedback-comment"},"Add a comment"),n.createElement("textarea",{id:"feedback-comment","data-action":"view.update",maxLength:16e3,required:!0,disabled:!!g||c,value:(g==null?void 0:g.body)??o.body,onChange:_=>x({body:_.target.value}),onBlur:()=>C(d.current).catch(()=>l("The draft could not be saved."))}),n.createElement("p",{className:"a-caption"},"Only this text is added to the selected report, using the host’s GitHub sign-in. The report must belong to that account."),y&&n.createElement(nt,{phase:y.status==="submitted"?"success":["unknown","failed"].includes(y.status)?"error":"working",message:y.message}),s&&n.createElement(nt,{phase:"error",message:s}),(y==null?void 0:y.commentUrl)&&n.createElement("a",{href:y.commentUrl,target:"_blank",rel:"noopener noreferrer"},"View comment"),(E==null?void 0:E.status)==="unknown"&&n.createElement("a",{href:E.url,target:"_blank",rel:"noopener noreferrer"},"Check the issue before starting another comment"),!N&&n.createElement("button",{type:"submit",className:"a-primary","data-action":"feedback.comment",disabled:w||!o.feedbackId||!o.body.trim()},w?"Sending…":g?"Check comment status":"Send comment"),N&&n.createElement("button",{type:"button",className:"a-soft",onClick:T},"New comment"))):null}function Sq({state:e,act:t,frozen:a,onStage:r}){var i;const o=(i=e.sessions)==null?void 0:i.find(s=>s.id===e.selectedSessionId);return o?n.createElement(Cq,{key:o.id,session:o,act:t,frozen:a,onStage:r}):null}function Cq({session:e,act:t,frozen:a,onStage:r}){var X,U;const o=(e.messages||[]).filter(_=>_.id&&["user","assistant"].includes(_.role)&&!_.streaming),[i,s]=v.useState(!1),[l,c]=v.useState(((X=o.at(-1))==null?void 0:X.id)||""),[u,d]=v.useState(((U=o.at(-1))==null?void 0:U.id)||""),[p,m]=v.useState(null),[h,f]=v.useState(""),[g,E]=v.useState(!1),[y,b]=v.useState(""),[S,w]=v.useState(!1),[N,x]=v.useState(!1),[A,C]=v.useState(!1),O=v.useRef(0),k=v.useRef(null);v.useEffect(()=>()=>{O.current++},[]);function T(){O.current++,m(null),w(!1),x(!1),b(""),C(!1),k.current=null}async function I(_=!1){var G,Z;const P=++O.current;E(!0),b(""),w(!1),x(!1),k.current=null;try{const D=_?p.snapshotId:(Z=(G=await t("session.export",{id:e.id,format:"markdown",destination:"none",scope:"range",minimal:!0,fromMessageId:l,throughMessageId:u}))==null?void 0:G.result)==null?void 0:Z.snapshotId;if(!D)throw Error("The selected excerpt could not be prepared.");const ne=await t("feedback.excerpt.review",{id:e.id,snapshotId:D,..._?{text:h}:{}});if(!(ne!=null&&ne.result))throw Error("The excerpt or destination could not be checked. Nothing was sent.");P===O.current&&(m(ne.result),f(ne.result.text),C(!1))}catch(D){P===O.current&&b(D.message)}finally{P===O.current&&E(!1)}}async function F(){const _=++O.current;E(!0),b(""),k.current||(k.current={id:e.id,reviewId:p.reviewId,requestId:crypto.randomUUID(),acknowledgeDisclosure:!0,acknowledgeWarnings:N});try{await r(k.current),_===O.current&&(C(!0),k.current=null)}catch(P){_===O.current&&b(P.message||"The attachment was not acknowledged. Check again using the same review.")}finally{_===O.current&&E(!1)}}const z=p&&h!==p.text,q=a||g,W=o.map((_,P)=>n.createElement("option",{key:_.id+P,value:_.id},P+1,". ",_.role==="user"?"You":"Amplifier",": ",String(_.text||"").replace(/\s+/g," ").slice(0,80)));return n.createElement("section",{"aria-label":"Optional conversation excerpt"},n.createElement("button",{type:"button",className:"a-soft",disabled:q,onClick:()=>s(!i)},i?"Hide excerpt review":"Attach transcript excerpt"),i&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Optional. Starts with one message; choose only the context needed. Hidden instructions, tool payloads and file contents are excluded. Nothing uploads until you send feedback."),n.createElement("label",null,"Excerpt start",n.createElement("select",{"aria-label":"Excerpt start",value:l,disabled:q,onChange:_=>{T(),c(_.target.value)}},W)),n.createElement("label",null,"Excerpt end",n.createElement("select",{"aria-label":"Excerpt end",value:u,disabled:q,onChange:_=>{T(),d(_.target.value)}},W)),n.createElement("button",{type:"button",className:"a-soft",disabled:q||!l||!u,onClick:()=>I()},"Preview selected excerpt"),p&&n.createElement("div",{"aria-label":"Reviewed feedback excerpt"},n.createElement("p",null,n.createElement("strong",null,p.visibility==="public"?"Publicly visible on GitHub":"Private GitHub repository"),": ",p.repository,". Submitted content may remain in repository history and cannot be retracted through this app."),n.createElement("p",null,p.summary.messageCount," source messages · ",p.bytes.toLocaleString()," bytes · ",p.filename),n.createElement("p",{className:"a-caption"},p.redactions.length?p.redactions.map(_=>`${_.count} ${_.kind.toLowerCase()} redaction(s)`).join(" · "):"No additional redactions in this review."),p.warnings.map(_=>n.createElement("p",{className:"a-caption",key:_},_)),n.createElement("textarea",{"aria-label":"Edit feedback excerpt",rows:8,maxLength:64e3,value:h,disabled:q||A,onChange:_=>{O.current++,k.current=null,f(_.target.value),w(!1),x(!1)}}),z&&n.createElement("button",{type:"button",className:"a-soft",disabled:q,onClick:()=>I(!0)},"Review edited excerpt"),n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox",checked:S,disabled:q||z||A,onChange:_=>w(_.target.checked)}),"I reviewed this exact text and agree to share it with ",p.visibility==="public"?"the public":"people with access to this repository",", where it may be retained."),p.requiresExtraReview&&n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox",checked:N,disabled:q||z||A,onChange:_=>x(_.target.checked)}),"I reviewed the scope, sensitive-content warnings and automatic redactions."),n.createElement("button",{type:"button",className:"a-soft",disabled:q||z||!S||p.requiresExtraReview&&!N||A,onClick:F},A?"Excerpt attached locally":"Attach reviewed excerpt")),g&&n.createElement("p",{role:"status"},"Preparing the local excerpt and checking its destination…"),y&&n.createElement("p",{role:"alert"},y)))}const Dc=()=>({title:"",body:"",category:"bug",includeDiagnostics:!0,attachments:[],confirmExcerpts:!1,confirmedExcerpts:[]}),Nq=e=>e<1024?`${e} B`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,Rq=e=>new Promise((t,a)=>{const r=new FileReader;r.onerror=()=>a(new Error("Could not read this file.")),r.onload=()=>t(String(r.result).split(",")[1]),r.readAsDataURL(e)});function Tq({state:e,act:t}){var _e,Je,De,ue,ye;const a=(_e=e.view)==null?void 0:_e.feedbackDraft,r=v.useRef(e.selectedSessionId);r.current=e.selectedSessionId;const o=v.useRef(!0);v.useEffect(()=>(o.current=!0,()=>{o.current=!1}),[]);const[i,s]=v.useState(()=>a||Dc()),[l,c]=v.useState(!1),[u,d]=v.useState(""),[p,m]=v.useState(!1),[h,f]=v.useState(!1),[g,E]=v.useState(null),y=v.useRef(i),b=v.useRef(!1),S=v.useRef(null),w=v.useRef(!1),N=v.useRef(!1),x=v.useRef(null),A=v.useRef(null);v.useEffect(()=>()=>{clearTimeout(x.current),N.current&&U().catch(()=>{})},[]),v.useEffect(()=>{a&&!N.current&&!b.current&&(y.current=a,s(a))},[a]);const C=((Je=e.feedback)==null?void 0:Je.requests)||[],O=i.pending,k=O&&C.find(M=>M.requestId===O.requestId),T=O||i;v.useEffect(()=>{k&&["submitted","failed","unknown"].includes(k.status)&&d("")},[k==null?void 0:k.status]),v.useEffect(()=>{var M;(k==null?void 0:k.status)!=="submitted"||((M=y.current.pending)==null?void 0:M.requestId)!==k.requestId||(E(null),_(Dc()).catch(()=>d("Feedback was sent, but the cleared draft could not be saved. Reconnect and try again.")))},[k==null?void 0:k.status,k==null?void 0:k.requestId]);const I=l||["queued","sending"].includes(k==null?void 0:k.status),F=["submitted","failed","unknown"].includes(k==null?void 0:k.status),z=!!O||p,q=i.previewId,W=(i.attachments||[]).filter(M=>{var Y;return!O||((Y=O.attachmentIds)==null?void 0:Y.includes(M.id))}),X=((De=e.feedback)==null?void 0:De.issuesUrl)||"https://github.com/microsoft/amplifier-unified/issues";async function U(){if(clearTimeout(x.current),A.current)return await A.current,U();if(!N.current)return;const M=y.current,Y=t("view.update",{patch:{feedbackDraft:M}});A.current=Y;try{const se=await Y;if(!se||se.accepted===!1)throw Error("The draft could not be saved.");y.current===M&&(N.current=!1)}finally{A.current=null}if(N.current)return U()}function _(M){return y.current=M,N.current=!0,s(M),U()}function P(M){d(""),y.current={...y.current,...M},N.current=!0,s(y.current),clearTimeout(x.current),x.current=setTimeout(()=>U().catch(()=>d("The draft could not be saved. Reconnect and try again.")),250)}function G(M){P({previewId:M})}async function Z(M){if(w.current||y.current.pending)throw Error("Wait for the current attachment or submission to finish.");w.current=!0,m(!0);try{if(await U(),r.current!==M.id)throw Error("The selected conversation changed. Review its excerpt again.");const Y=await t("feedback.excerpt.stage",M);if(!(Y!=null&&Y.result))throw Error("The excerpt was not attached. Check the same review again.");o.current&&r.current===M.id&&D(Y)}finally{w.current=!1,m(!1)}}function D(M){var se,Fe;const Y=(Fe=(se=M==null?void 0:M.state)==null?void 0:se.view)==null?void 0:Fe.feedbackDraft;if(Y){const je=JSON.stringify(Y.attachments)!==JSON.stringify(y.current.attachments);y.current={...y.current,attachments:Y.attachments,...je?{confirmExcerpts:!1,confirmedExcerpts:[]}:{}},s(y.current),je&&(N.current=!0,U().catch(()=>d("The updated attachment list could not be saved.")))}}async function ne(M,Y){if(!(w.current||y.current.pending)){w.current=!0,m(!0),d(""),f(!1);try{await U(),Y&&(D(await t("feedback.attachment.add",Y)),E(null));for(const se of M){if(!se.size||se.size>8*1024*1024)throw new Error("Choose nonempty files up to 8 MB each.");const Fe={requestId:crypto.randomUUID(),name:se.name||"pasted-image.png",base64:await Rq(se)};try{D(await t("feedback.attachment.add",Fe))}catch(je){throw E(Fe),je}}}catch(se){d((se==null?void 0:se.message)||"The file could not be added. Check the draft and retry; it will not be added twice.")}finally{w.current=!1,m(!1)}}}async function H(M){if(!z){d("");try{await U(),D(await t("feedback.attachment.remove",{id:M})),q===M&&G(null)}catch(Y){d((Y==null?void 0:Y.message)||"The attachment could not be removed.")}}}function j(M){var se;const Y=Array.from(((se=M.clipboardData)==null?void 0:se.files)||[]);Y.length&&(M.preventDefault(),M.stopPropagation(),z||ne(Y))}function ie(M){var Y,se;(se=(Y=M.dataTransfer)==null?void 0:Y.types)!=null&&se.includes("Files")&&(M.preventDefault(),M.stopPropagation(),f(!1),z||ne(Array.from(M.dataTransfer.files||[])))}async function Ee(M){if(M.preventDefault(),b.current||w.current||I||F||g)return;b.current=!0,c(!0),d("");const Y=y.current,se=Y.pending||{requestId:crypto.randomUUID(),title:Y.title,body:Y.body,category:Y.category,includeDiagnostics:Y.includeDiagnostics!==!1,...Y.includeDiagnostics!==!1?{deviceDiagnostics:$w(e)}:{},confirmExcerpts:Y.confirmExcerpts===!0,confirmedExcerpts:Y.confirmedExcerpts||[],attachmentIds:(Y.attachments||[]).map(Fe=>Fe.id)};try{await _({...Y,pending:se}),await t("feedback.submit",se)}catch{d("The submission was not acknowledged. Check its status using the same request below; this will not post it twice.")}finally{b.current=!1,c(!1)}}async function me(){if(!(l||p)){d(""),E(null);try{await _(Dc())}catch{d("Could not start a new draft. Reconnect and try again.")}}}return n.createElement("section",{className:`a-feedback${h?" is-dragging":""}`,"data-part":"feedback",onPaste:j,onDrop:ie,onDragOver:M=>{var Y,se;(se=(Y=M.dataTransfer)==null?void 0:Y.types)!=null&&se.includes("Files")&&(M.preventDefault(),M.stopPropagation(),z||f(!0))},onDragLeave:M=>{M.currentTarget.contains(M.relatedTarget)||f(!1)}},n.createElement("p",null,"Send a bug report, idea, or question to ",n.createElement("a",{href:X,target:"_blank",rel:"noopener noreferrer"},"microsoft/amplifier-unified"),". Uses the host’s GitHub sign-in."),(k||u)&&n.createElement("div",{className:"a-feedback-result"},n.createElement(nt,{phase:(k==null?void 0:k.status)==="submitted"?"success":["failed","unknown"].includes(k==null?void 0:k.status)?"error":"working",message:k==null?void 0:k.message}),u&&n.createElement(nt,{phase:"error",message:u})," ",(k==null?void 0:k.url)&&n.createElement("a",{className:"a-feedback-link",href:k.url,target:"_blank",rel:"noopener noreferrer"},"View issue ",n.createElement(sa,{size:14}))," ",(k==null?void 0:k.status)==="unknown"&&n.createElement(n.Fragment,null,n.createElement("a",{href:X,target:"_blank",rel:"noopener noreferrer"},"Check repository issues ",n.createElement(sa,{size:14})),k.attachmentsUrl&&n.createElement("a",{href:k.attachmentsUrl,target:"_blank",rel:"noopener noreferrer"},"Check attachment branch ",n.createElement(sa,{size:14})))),n.createElement("form",{onSubmit:Ee,"data-action":"feedback.submit"},n.createElement("label",{htmlFor:"feedback-category"},"Type"),n.createElement("select",{id:"feedback-category","data-action":"view.update",value:T.category||"bug",disabled:z,onChange:M=>P({category:M.target.value})},n.createElement("option",{value:"bug"},"Bug report"),n.createElement("option",{value:"idea"},"Feature idea"),n.createElement("option",{value:"question"},"Question"),n.createElement("option",{value:"other"},"Other feedback")),n.createElement("label",{htmlFor:"feedback-title"},"Title"),n.createElement("input",{id:"feedback-title","data-action":"view.update",maxLength:200,required:!0,disabled:z,value:T.title||"",onChange:M=>P({title:M.target.value}),placeholder:"A short description"}),n.createElement("label",{htmlFor:"feedback-body"},"Details"),n.createElement("textarea",{id:"feedback-body","data-action":"view.update",maxLength:16e3,rows:4,required:!0,disabled:z,value:T.body||"",onChange:M=>P({body:M.target.value}),placeholder:"What happened, what you expected, or what you’d like to do…","aria-describedby":T.category==="bug"?"feedback-reproduction-help":void 0}),T.category==="bug"&&n.createElement("p",{id:"feedback-reproduction-help",className:"a-caption"},"What action triggered it? Was this a new chat or an existing one? Describe what you expected, what happened, and whether it repeats. Leave out private conversation text and credentials."),n.createElement("div",{className:"a-feedback-files","aria-label":"Feedback attachments"},n.createElement("input",{ref:S,type:"file",multiple:!0,hidden:!0,disabled:z,"aria-label":"Choose feedback files",onChange:M=>{const Y=Array.from(M.target.files||[]);M.target.value="",ne(Y)}}),!O&&n.createElement("button",{type:"button",className:"a-soft a-feedback-add-files","data-action":"feedback.attachment.add",disabled:p||!!g,onClick:()=>{var M;return(M=S.current)==null?void 0:M.click()}},n.createElement(Fu,{size:16}),p?"Adding files…":"Add files or images"),!O&&n.createElement("p",{className:"a-caption"},"Or drop files here, or paste an image. Up to 8 files, 8 MB each, 24 MB total."),!!W.length&&n.createElement("ul",null,W.map(M=>{var Y;return n.createElement("li",{key:M.id},n.createElement("button",{type:"button",className:"a-feedback-file-preview","data-action":"view.update",disabled:p,"aria-label":`Preview ${M.name}`,onClick:()=>G(q===M.id?null:M.id)},(Y=M.mime)!=null&&Y.startsWith("image/")&&/^[a-f0-9]{32}$/.test(M.id)?n.createElement("img",{src:`/api/attachments/${M.id}`,alt:""}):n.createElement(ql,{size:22}),n.createElement("span",null,n.createElement("strong",null,M.name),n.createElement("small",null,Nq(M.size)," · ",O?"Included":M.excerpt?`Reviewed excerpt · ${M.excerpt.visibility}`:"Ready to include"))),!O&&n.createElement("button",{type:"button",className:"a-icon","data-action":"feedback.attachment.remove","aria-label":`Remove ${M.name}`,disabled:p,onClick:()=>H(M.id)},n.createElement(nn,{size:16})))})),W.filter(M=>M.id===q&&/^[a-f0-9]{32}$/.test(M.id)).map(M=>{var Y,se;return n.createElement("div",{className:"a-feedback-preview",key:M.id},(Y=M.mime)!=null&&Y.startsWith("image/")?n.createElement("img",{src:`/api/attachments/${M.id}`,alt:`Preview of ${M.name}`}):n.createElement(ql,{size:32}),n.createElement("a",{href:`/api/attachments/${M.id}`,download:M.name},(se=M.mime)!=null&&se.startsWith("image/")?n.createElement(Wk,{size:14}):n.createElement(ql,{size:14}),"Open ",M.name))}),g&&n.createElement("div",{className:"a-feedback-upload-retry"},n.createElement("button",{type:"button",className:"a-soft",disabled:p,onClick:()=>ne([],g)},"Check attachment: ",g.name),n.createElement("button",{type:"button",className:"a-soft",disabled:p,onClick:()=>{E(null),d("")}},"Stop retrying"))),!O&&n.createElement(Sq,{state:e,act:t,frozen:z,onStage:Z}),W.some(M=>M.excerpt)&&n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox",checked:T.confirmExcerpts===!0,disabled:z,onChange:M=>P({confirmExcerpts:M.target.checked,confirmedExcerpts:M.target.checked?W.filter(Y=>Y.excerpt).map(Y=>({id:Y.id,sha256:Y.excerpt.sha256})):[]})}),"Include the reviewed conversation excerpts listed above when I send this feedback."),n.createElement("label",{className:"a-feedback-checkbox"},n.createElement("input",{type:"checkbox","data-action":"view.update",checked:T.includeDiagnostics!==!1,disabled:z,onChange:M=>P({includeDiagnostics:M.target.checked})}),"Include reproduction diagnostics"),T.includeDiagnostics!==!1&&n.createElement(Qf,{key:k?`receipt:${k.requestId}`:e.selectedSessionId||"current",state:e,act:t,requestId:k==null?void 0:k.requestId,device:O==null?void 0:O.deviceDiagnostics}),n.createElement("p",{className:"a-caption"},"Your text, selected diagnostics and the files listed above are sent when you submit. Files stay in repository history and are linked from the issue. Reviewed excerpts use the visibility shown during review; other file uploads require a private repository; your GitHub sign-in needs repository Contents write access. Chats, paths, provider settings, and credentials are not attached automatically."),n.createElement("div",{className:"a-dialog-actions"},!F&&n.createElement("button",{type:"submit",className:"a-primary","data-action":"feedback.submit",disabled:I||p||!!g||W.some(M=>M.excerpt)&&!T.confirmExcerpts||!((ue=T.title)!=null&&ue.trim())||!((ye=T.body)!=null&&ye.trim())},n.createElement(cx,null),I?"Sending…":O?"Check submission":"Send feedback"),(F||O&&!l)&&n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:me},n.createElement(Ln,null),"New feedback"))),!!C.filter(M=>M.requestId!==(O==null?void 0:O.requestId)).length&&n.createElement("div",{className:"a-feedback-recent"},n.createElement("h3",null,"Submissions"),C.filter(M=>M.requestId!==(O==null?void 0:O.requestId)).map(M=>{var Y;return n.createElement("div",{key:M.requestId,className:"a-feedback-receipt"},n.createElement("strong",null,M.title),n.createElement(nt,{phase:M.status==="submitted"?"success":["failed","unknown"].includes(M.status)?"error":"working",message:M.message}),M.url&&n.createElement("a",{href:M.url,target:"_blank",rel:"noopener noreferrer"},"View issue ",n.createElement(sa,{size:14})),n.createElement(Qf,{state:e,act:t,requestId:M.requestId}),M.status==="unknown"&&n.createElement("a",{href:X,target:"_blank",rel:"noopener noreferrer"},"Check repository issues"),(((Y=e.attention)==null?void 0:Y.items)||[]).filter(se=>se.requestId===M.requestId&&!se.read).map(se=>n.createElement("button",{key:se.id,className:"a-link",type:"button","data-action":"attention.read",onClick:()=>br(t,[se])},"Mark reviewed")))})),n.createElement(Eq,{state:e,act:t}),n.createElement(xq,{state:e,act:t}))}function Qf({state:e,act:t,requestId:a,device:r}){const[o,i]=v.useState(null),[s,l]=v.useState(!1),[c,u]=v.useState(""),d=v.useRef(!1),p=v.useRef(!1),m=v.useRef(!0);v.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]);async function h(){if(!d.current){d.current=!0,l(!0),u("");try{const f=await t("feedback.diagnostics",a?{requestId:a}:{deviceDiagnostics:r||$w(e)});if(!(f!=null&&f.result))throw Error("Unavailable");m.current&&(i(f.result),p.current=!0)}catch{m.current&&u("Diagnostics could not be loaded. Try Refresh.")}finally{d.current=!1,m.current&&l(!1)}}}return n.createElement("details",{"data-part":"feedback-diagnostics",onToggle:f=>{f.currentTarget.open&&!p.current&&h()}},n.createElement("summary",null,a?"Submitted diagnostics":"Preview reproduction diagnostics"),n.createElement("p",{className:"a-caption"},a?"This is the snapshot saved when this submission was accepted.":"Loads only when opened. This is a current preview; live status may change before you submit."," Host active component generation does not prove which code a running worker loaded. Reported online views counts device reports, not live event-stream connections. No message text, workspace paths, raw logs, or credentials."),s&&n.createElement("p",{role:"status"},"Loading diagnostics…"),c&&n.createElement("p",{role:"alert"},c),o&&(o.diagnostics?n.createElement("pre",{className:"a-state-view"},JSON.stringify(o.diagnostics,null,2)):n.createElement("p",null,"No diagnostics were saved with this submission.")),n.createElement("button",{type:"button",className:"a-soft","data-action":"feedback.diagnostics",disabled:s,onClick:()=>void h()},"Refresh diagnostics"))}function Iq({state:e,act:t}){var s,l,c,u,d,p;if(["feedback","activity"].includes((s=e.view)==null?void 0:s.panel))return null;const a=(((l=e.attention)==null?void 0:l.items)||[]).filter(m=>m.requestId&&!m.read),r=(u=(c=e.feedback)==null?void 0:c.requests)==null?void 0:u.find(m=>["queued","sending"].includes(m.status)),o=a[0],i=r||((p=(d=e.feedback)==null?void 0:d.requests)==null?void 0:p.find(m=>m.requestId===(o==null?void 0:o.requestId)));return i?n.createElement("aside",{className:"a-feedback-notice","aria-label":"Feedback status"},n.createElement("div",{role:"status"},n.createElement(nt,{phase:r?"working":i.status==="submitted"?"success":"error",message:r?"Feedback received — sending in the background.":i.message})),n.createElement("div",{className:"a-feedback-notice-actions"},n.createElement("button",{type:"button",className:"a-link","data-action":"view.update",onClick:()=>t("view.update",{patch:{panel:"feedback"}})},"View ",r?"status":"feedback"),i.url&&n.createElement("a",{href:i.url,target:"_blank",rel:"noopener noreferrer"},"View issue ",n.createElement(sa,{size:14})),!r&&o&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Dismiss feedback notification","data-action":"attention.read",onClick:()=>br(t,[o])},n.createElement(nn,{size:16})))):null}function Aq(e,t={}){var a;return t.preview===!0?((a=e.text)==null?void 0:a.slice(0,180))||"Your response is ready.":"Your Amplifier response is ready."}function _q(e={}){return e.desktop!==!1}function Xf(e){if(Array.isArray(e.notificationMessages))return e.notificationMessages.filter(a=>a.id&&a.sessionId&&a.role==="assistant"&&a.via==="text");const t=new Map;for(const a of e.sessions||[])for(const r of a.messages||[])r.id&&r.role==="assistant"&&r.via==="text"&&t.set(r.id,{...r,sessionId:a.id});return[...t.values()]}const bk=(e,t,a)=>e.has(t)||a==="detailed"&&!e.has("closed:"+t);function Pq(e,t,a){const r=new Set(e),o=bk(r,t,a);return r.delete(t),r.delete("closed:"+t),r.add(o?"closed:"+t:t),r}const fr=e=>typeof e=="string"?e:e==null?"":JSON.stringify(e,null,2);function eg(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}const io=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{};function Oq(e){const t=io(e);return Object.hasOwn(t,"output")?t.output:e}function yk(e){return(typeof e=="string"?e:"").replace(/^Tool completed\. Expand any delegated actions below for their progress and results\.\s*/,"")}const La=(e,t)=>t.map(a=>e[a]).find(a=>typeof a=="string"&&a.length)||"",Tr=e=>fr(e).replace(/\s+/g," ").slice(0,180);function Mq(e,t=e.input,a=e.output){const r=eg(t),o=io(r),i=eg(a),s=Oq(i),l=io(s),c=String(e.tool||e.label||"Tool"),u=c.toLowerCase().replace(/.*[.:/]/,""),d=e.status||e.phase,p=["running","working","starting","pending","queued","retrying"].includes(d),m=["error","failed","cancelled","interrupted"].includes(d)||io(i).success===!1,h=["completed","complete","success","done"].includes(d)&&!m,f=La(o,["file_path","path","filename"]),g=La(o,["command","cmd"]),E=La(o,["patch","diff"])||La(l,["diff","patch"])||(/apply_patch/.test(u)&&typeof r=="string"?r:""),y=La(o,["old_string","old_text"]),b=La(o,["new_string","new_text"]),S=Array.isArray(o.todos)?o.todos:Array.isArray(l.todos)?l.todos:null,w=yk(e.summary||e.detail),N=w.replace(new RegExp(`^(?:Completed|Running|Failed) ${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?: · )?`),""),x=l.returncode??l.exit_code??l.exitCode,A=(O,k,T)=>h?O:p?k:T,C={tool:c,input:r,args:o,result:i,output:s,out:l,phase:d,running:p,failed:m,done:h,path:f,exit:x,preview:Tr(N)};if(g)return{...C,kind:"command",title:A("Ran","Running","Run"),target:g,command:g,preview:typeof l.stdout=="string"?Tr(l.stdout.trim().split(` +`).filter(Boolean).at(-1))+(x!=null?` · exit ${x}`:""):Tr(s)};if(E||/edit_file|apply_patch/.test(u)&&(y||b)){const O=E||["@@",...y.split(` `).map(z=>"-"+z),...b.split(` `).map(z=>"+"+z)].join(` `),k=zq(O),T=k.filter(z=>z.file),I=[...new Set(T.map(z=>z.file))],F=T.length&&T.every(z=>z.operation==="Delete")?A("Deleted","Deleting","Delete"):T.length&&T.every(z=>z.operation==="Add")?A("Created","Creating","Create"):A("Edited","Editing","Edit");return{...C,kind:"patch",title:F,target:f||I.join(", ")||c,diff:O,rows:k,added:k.filter(z=>z.type==="add").length,removed:k.filter(z=>z.type==="remove").length,preview:Tr(s)}}return S?{...C,kind:"tasks",title:A("Updated task list","Updating task list","Task list update"),tasks:S,preview:`${S.filter(O=>(O==null?void 0:O.status)==="completed").length} of ${S.length} complete`}:/read(_file)?$/.test(u)&&f?{...C,kind:"read",title:A("Read","Reading","Read"),target:f,content:typeof s=="string"?s:La(l,["content","text"]),preview:o.offset!=null?`From line ${o.offset}${o.limit!=null?` · up to ${o.limit} lines`:""}`:Tr(N)}:/write(_file)?$/.test(u)&&f?{...C,kind:"write",title:A("Wrote","Writing","Write"),target:f,content:La(o,["content","text"])}:typeof o.action=="string"||typeof o.operation=="string"?{...C,kind:"app",title:"App action",target:typeof o.action=="string"?o.action:o.operation,preview:Tr(s)}:/delegate|task|agent/.test(u)&&La(o,["instruction","instructions","prompt","task"])?{...C,kind:"delegate",title:A("Delegated","Delegating","Delegate"),target:La(o,["agent","name","description"]),task:La(o,["instruction","instructions","prompt","task"])}:{...C,kind:"generic",title:c,preview:Tr(N)}}function zq(e){let t=null,a=null,r=!1,o=null,i=null;const s=()=>{t=a=o=i=null,r=!1};return String(e).split(` `).map(l=>{const c=l.match(/^\*\*\* (Update|Add|Delete) File: (.+)$/);if(c)return s(),{type:"header",text:l,file:c[2],operation:c[1]};if(/^(?:diff --git |\*\*\*)/.test(l))return s(),{type:"header",text:l};if(!r&&/^(?:--- |\+\+\+ )/.test(l))return{type:"header",text:l,...l.startsWith("+++ ")&&l.slice(4)!=="/dev/null"?{file:l.slice(4).replace(/^b\//,"")}:{}};const u=l.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(l.startsWith("@@"))return t=u?Number(u[1]):null,a=u?Number(u[3]):null,o=u?Number(u[2]??1):null,i=u?Number(u[4]??1):null,r=!0,{type:"header",text:l};let d;if(l.startsWith("+"))d={type:"add",old:null,new:a===null?null:a++,text:l.slice(1)},i!==null&&i--;else if(l.startsWith("-"))d={type:"remove",old:t===null?null:t++,new:null,text:l.slice(1)},o!==null&&o--;else if(l.startsWith(" "))d={type:"context",old:t===null?null:t++,new:a===null?null:a++,text:l.slice(1)},o!==null&&o--,i!==null&&i--;else return{type:"header",text:l};return r=!(o===0&&i===0),d})}function ys(e,t,a){const r=e[t+"Detail"],o=JSON.stringify([e.id,t,r||e[t]]),[i,s]=v.useState(null),[l,c]=v.useState(null),[u,d]=v.useState(0),p=(i==null?void 0:i.key)===o?i.value:e[t],m=(l==null?void 0:l.key)===o?l.message:"";return v.useEffect(()=>{if(!a||!r||(i==null?void 0:i.key)===o)return;const h=new AbortController;return c(null),Ll({...r,complete:"true"},St,h.signal).then(f=>{h.signal.aborted||s({key:o,value:f})}).catch(f=>{h.signal.aborted||c({key:o,message:f.message})}),()=>h.abort()},[a,o,u,i==null?void 0:i.key]),{value:p,error:m,incomplete:!!r&&(i==null?void 0:i.key)!==o,loading:!!r&&(i==null?void 0:i.key)!==o&&!m,retry:()=>d(h=>h+1)}}function Lq({text:e,label:t,disabled:a=!1}){const[r,o]=v.useState("");return v.useEffect(()=>o(""),[e]),n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-link",disabled:a,"aria-label":`Copy ${t.toLowerCase()}`,onClick:async()=>{try{await navigator.clipboard.writeText(e),o("Copied")}catch{o("Select the text to copy it manually.")}}},n.createElement(rr,null),r==="Copied"?"Copied":"Copy"),r&&n.createElement("span",{className:"a-caption",role:"status"},r))}function Dq({text:e}){const[t,a]=v.useState(!1),r=fr(e),o=r.split(` `),i=o.length>15||r.length>3e3,s=i?o.slice(0,10).join(` -`).slice(0,2e3):r;return v.useEffect(()=>a(!1),[r]),n.createElement(n.Fragment,null,n.createElement("pre",null,n.createElement("code",null,t?r:s)),i&&n.createElement("button",{type:"button",className:"a-link a-execution-more","aria-expanded":t,onClick:()=>a(!t)},t?"Show less":o.length>15?`Show all ${o.length} lines`:`Show all ${r.length.toLocaleString()} characters`))}function On({label:e,text:t,meta:a,children:r,copy:o=!0,loading:i=!1}){return t==null&&!r?null:n.createElement("section",{className:"a-execution-payload"},n.createElement("header",null,n.createElement("span",null,e),a!=null&&n.createElement("span",null,fr(a)),o&&n.createElement(Lq,{text:fr(t),label:e,disabled:i})),r||n.createElement(Dq,{text:t}))}function Mu({label:e,field:t}){return t.error?n.createElement("p",{role:"alert",className:"a-execution-load-error"},t.error," ",n.createElement("button",{type:"button",className:"a-link",onClick:t.retry},"Retry ",e.toLowerCase())):t.loading?n.createElement("small",{role:"status"},"Loading complete ",e.toLowerCase(),"…"):null}function Fq({action:e}){const[t,a]=v.useState(!1),r=e.rows.filter(o=>o.type!=="header"||!/^\*\*\* (Begin|End) Patch$/.test(o.text));return n.createElement(On,{label:e.path||"Patch",text:e.diff,meta:e.done?"Applied":e.running?"In progress":"Requested changes"},n.createElement("div",{className:"a-execution-diff","aria-label":"File changes"},(t||r.length<=15?r:r.slice(0,10)).map((o,i)=>o.type==="header"?n.createElement("div",{key:i,className:"a-execution-diff-header"},o.file||o.text):n.createElement("div",{key:i,className:`a-execution-diff-row ${o.type}`},n.createElement("span",{className:"a-execution-line-number"},o.old),n.createElement("span",{className:"a-execution-line-number"},o.new),n.createElement("span",null,o.type==="add"?"+":o.type==="remove"?"−":" "),n.createElement("code",null,o.text)))),r.length>15&&n.createElement("button",{type:"button",className:"a-link a-execution-more","aria-expanded":t,onClick:()=>a(!t)},t?"Show less":`Show all ${r.length} patch lines`))}function qq({node:e,action:t,input:a,output:r,error:o}){const i=t,s=fr(i.output),l=typeof i.out.stdout=="string"||typeof i.out.stderr=="string",c=r.value!=null;let u;i.kind==="command"?u=n.createElement(n.Fragment,null,n.createElement(On,{label:"Command",text:i.command,meta:i.args.working_directory||i.args.cwd}),c&&(l?n.createElement(n.Fragment,null,n.createElement(On,{label:"Output",text:i.out.stdout||"No output",meta:i.exit!=null?`Exit ${i.exit}`:null}),i.out.stderr&&n.createElement(On,{label:"Standard error",text:i.out.stderr})):n.createElement(On,{label:"Output",text:s||"No output",loading:r.incomplete}))):i.kind==="patch"?u=n.createElement(n.Fragment,null,n.createElement(Fq,{action:i}),c&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):i.kind==="read"||i.kind==="write"?u=n.createElement(n.Fragment,null,n.createElement(On,{label:i.kind==="read"?"File content":i.done?"Written content":"Requested content",text:i.kind==="read"&&i.failed?null:i.content||null,loading:i.kind==="read"?r.incomplete:a.incomplete}),c&&(!i.content||i.failed||i.kind==="write")&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):i.kind==="tasks"?u=n.createElement(n.Fragment,null,n.createElement("section",{className:"a-execution-payload"},n.createElement("header",null,n.createElement("span",null,i.done?"Task list":"Requested task list"),n.createElement("span",null,i.preview)),n.createElement("ul",{className:"a-execution-checklist"},i.tasks.map((y,E)=>{const b=typeof(y==null?void 0:y.status)=="string"?y.status:"unknown",S=b==="completed"?Pt:b==="in_progress"?Ro:cg;return n.createElement("li",{key:E,"data-status":b},n.createElement(S,{"aria-label":b}),n.createElement("span",null,fr((y==null?void 0:y.content)||(y==null?void 0:y.activeForm)||(y==null?void 0:y.title)||y)),n.createElement("small",null,b.replaceAll("_"," ")))}))),c&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):i.kind==="delegate"?u=n.createElement(n.Fragment,null,n.createElement(On,{label:"Task sent",text:i.task}),c&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):u=n.createElement(n.Fragment,null,n.createElement(On,{label:i.kind==="app"?i.target:"Input",text:a.value,loading:a.incomplete}),n.createElement(On,{label:"Result",text:r.value,loading:r.incomplete}));const d={command:["command","cmd","working_directory","cwd"],patch:["patch","diff","file_path","path","filename","old_string","old_text","new_string","new_text"],read:["file_path","path","filename"],write:["file_path","path","filename","content","text"],tasks:["todos"],delegate:["agent","name","description","instruction","instructions","prompt","task"]}[i.kind],p=d?Object.fromEntries(Object.entries(i.args).filter(([y])=>!d.includes(y))):{},m=i.kind==="command"&&l?["stdout","stderr","returncode","exit_code","exitCode"]:i.kind==="read"&&i.content&&!i.failed?[typeof i.out.content=="string"&&i.out.content?"content":"text"]:null,h=m?Object.fromEntries(Object.entries(i.out).filter(([y])=>!m.includes(y))):{},g={...Object.hasOwn(io(i.result),"output")?Object.fromEntries(Object.entries(i.result).filter(([y])=>!["output","success","error"].includes(y))):{},...h};return n.createElement(n.Fragment,null,u,Object.keys(p).length>0&&n.createElement(On,{label:"Arguments",text:fr(p),loading:a.incomplete}),n.createElement(On,{label:"Result details",text:d&&Object.keys(g).length?fr(g):null}),n.createElement(On,{label:"Error",text:o.value??(i.kind!=="generic"&&i.kind!=="app"&&Object.hasOwn(io(i.result),"output")?i.result.error:null),loading:o.incomplete}),[["Input",a],["Result",r],["Error",o]].map(([y,E])=>n.createElement(Mu,{key:y,label:y,field:E})),gF(r.value).map(y=>n.createElement("a",{key:y,className:"a-execution-result-link",href:y,target:"_blank",rel:"noopener noreferrer"},y)),a.value==null&&r.value==null&&o.value==null&&!a.loading&&!r.loading&&!o.loading&&n.createElement("small",null,i.running?"Waiting for the event log…":"No action content is available in the event log."))}const Uq={message_count:"Messages",tool_count:"Tools",has_instructions:"Instructions",has_system:"System message",reasoning_enabled:"Reasoning enabled",thinking_enabled:"Thinking enabled",thinking_budget:"Thinking budget",background_mode:"Background mode",stream:"Streaming",max_tokens:"Maximum tokens",max_output_tokens:"Maximum output tokens",temperature:"Temperature",top_p:"Top P",parallel_tool_calls:"Parallel tool calls",tool_choice:"Tool choice",purpose:"Purpose",reasoning_effort:"Reasoning effort"};function jq({node:e,request:t,error:a,requestOpen:r,requestInline:o,toggleRequest:i,now:s}){var d,p;const l=m=>Number.isFinite(m)?new Date(m*1e3).toLocaleString():null,c=[["Provider",e.provider],["Model",e.model],["Status",e.status||e.phase],["Started",l(e.startedAt)],["Ended",l(e.endedAt)],["Elapsed",Np(e,s)],...Object.entries(e.requestInfo||{}).map(([m,h])=>[Uq[m]||m,typeof h=="boolean"?h?"Yes":"No":h])].filter(([,m])=>m!=null&&m!==""),u=Rp(e.usage,{pending:Bn(e)});return n.createElement(n.Fragment,null,n.createElement("dl",{className:"a-execution-model-facts"},c.map(([m,h])=>n.createElement(n.Fragment,{key:m},n.createElement("dt",null,m),n.createElement("dd",null,String(h))))),u&&n.createElement("p",{className:"a-execution-model-usage"},u.title),n.createElement(On,{label:"Error",text:a.value,loading:a.incomplete}),n.createElement(Mu,{label:"Error",field:a}),e.requestDetail?n.createElement(n.Fragment,null,n.createElement("small",null,"Recorded by the provider; some adapters supply a summary.",(d=e.requestCapture)!=null&&d.redacted?" Recognizable credentials redacted.":"",(p=e.requestCapture)!=null&&p.truncated?" This record reached the capture limit; part of the request is omitted.":""),!o&&n.createElement("button",{type:"button",className:"a-link a-execution-request-toggle","data-action":"view.update","aria-expanded":r,onClick:i},r?"Hide raw request":"Load raw request",!r&&` · ${e.requestDetail.length.toLocaleString()} characters`),(o||r)&&n.createElement(n.Fragment,null,n.createElement(On,{label:"Raw request",text:t.value,loading:t.incomplete}),n.createElement(Mu,{label:"Request",field:t}))):n.createElement("small",null,Bn(e)?"Waiting for the recorded request…":"No provider request was recorded for this call. Enable recording in Settings → Advanced → Diagnostics for future calls; availability depends on the provider."))}function Ek({value:e,pending:t=!1}){const a=Rp(e,{pending:t});return a?n.createElement("span",{className:"a-execution-usage",title:a.title},a.text):null}function wk({status:e}){return["error","failed","cancelled","interrupted"].includes(e)?n.createElement(zn,{className:"a-execution-warning","aria-label":e}):["complete","completed","success","done"].includes(e)?n.createElement(Pt,{className:"a-execution-complete","aria-label":"Completed"}):Bn({phase:e})?n.createElement("span",{className:"a-execution-dot","aria-label":e}):n.createElement(cg,{"aria-label":e||"Recorded"})}const tg=e=>Number.isFinite(e)?new Date(e*1e3).toLocaleString():null;function kk({node:e,depth:t=0,ancestors:a=[],tree:r,act:o,now:i,expanded:s,toggle:l}){var T,I;const c=e.kind==="tool",u=r.children.get(e.id)||[],d=yk(e.summary||e.detail),p=c||e.kind==="llm"||!!d||u.length>15,m=!p||s.has(e.id),h=s.has(`request:${e.id}`),f=p?"button":"div",g=((T=e.requestDetail)==null?void 0:T.lines)<=15&&((I=e.requestDetail)==null?void 0:I.length)<=3e3,y=ys(e,"input",m&&c),E=ys(e,"output",m&&c),b=ys(e,"error",m),S=ys(e,"request",m&&(g||h));if(t>20||a.includes(e.id))return null;const w=c?Mq(e,y.value,E.value):null,N=e.kind==="worker"?Wa:e.kind==="llm"?Fi:{command:vx,read:No,write:um,patch:um,tasks:Zk,delegate:Wa}[w==null?void 0:w.kind]||Ex,x=e.status||e.phase,A=Np(e,i),C=e.kind==="llm"?e.usage:e.kind==="worker"?e.aggregateUsage:null,O=(w==null?void 0:w.title)||e.label||e.model||e.kind,k=[e.provider,e.model].filter(Boolean).join(" · ");return n.createElement("div",{className:"a-execution-node","data-kind":e.kind,"data-node-id":e.id,"data-action-kind":w==null?void 0:w.kind},n.createElement(f,{className:"a-execution-line a-execution-action-line",...p?{type:"button","data-action":"view.update","data-view-label":[O,w==null?void 0:w.target,k,x].filter(Boolean).join(" · "),"aria-expanded":m,onClick:()=>l(e.id)}:{}},p&&n.createElement(en,{className:`a-execution-chevron ${m?"open":""}`}),n.createElement(N,null),n.createElement("span",{className:"a-execution-label",title:[O,w==null?void 0:w.target,k,(w==null?void 0:w.preview)||d].filter(Boolean).join(" · ")},n.createElement("span",null,O,(w==null?void 0:w.target)&&n.createElement(n.Fragment,null," ",n.createElement("code",null,w.target)),["llm","worker"].includes(e.kind)&&k&&n.createElement(n.Fragment,null," · ",k),!(w!=null&&w.target)&&(w==null?void 0:w.preview)&&n.createElement(n.Fragment,null," · ",w.preview),(w==null?void 0:w.kind)==="patch"&&(w.added>0||w.removed>0)&&n.createElement("span",{className:"a-execution-counts"},n.createElement("span",null,"+",w.added),n.createElement("span",null,"−",w.removed)))),n.createElement("span",{className:"a-execution-phase",title:[e.toolCallId&&`Call: ${e.toolCallId}`,tg(e.startedAt),tg(e.endedAt)].filter(Boolean).join(" · ")},Bn(e)||["error","failed","cancelled","interrupted"].includes(x)?`${x}${A?" · ":""}`:"",A),n.createElement(Ek,{value:C,pending:["llm","worker"].includes(e.kind)&&Bn(e)}),n.createElement(wk,{status:x})),m&&n.createElement("div",{className:"a-execution-body"},c?n.createElement(qq,{node:e,action:w,input:y,output:E,error:b}):e.kind==="llm"?n.createElement(jq,{node:e,request:S,error:b,requestOpen:h,requestInline:g,toggleRequest:()=>l(`request:${e.id}`),now:i}):d&&n.createElement(Oi,{text:d,reference:e.summaryDetail||e.detailDetail,automatic:!0,markdown:!0}),e.kind==="worker"&&e.routing&&n.createElement("p",{className:"a-muted"},hk(e.routing),e.parentProvider&&e.provider&&e.parentProvider!==e.provider&&` This worker used ${e.provider}; the parent used ${e.parentProvider}.`),e.kind==="worker"&&Bn(e)&&(e.workerId||e.sessionId)&&n.createElement("button",{className:"a-link a-danger","data-action":"worker.stop",onClick:()=>o("worker.stop",{id:e.workerId||e.sessionId})},n.createElement(fx,null),"Stop worker"),u.length>0&&n.createElement("div",{className:"a-execution-children"},u.map(F=>n.createElement(kk,{key:F.id,node:F,depth:t+1,ancestors:[...a,e.id],tree:r,act:o,now:i,expanded:s,toggle:l})))))}function ng({data:e,turnId:t,state:a,act:r}){var w,N,x,A,C,O,k;const o=Qu(),i=((N=(w=o==null?void 0:o.composition)==null?void 0:w.presentation)==null?void 0:N.interfaceDetail)||((A=(x=o==null?void 0:o.composition)==null?void 0:x.presentation)==null?void 0:A.executionDetail)||"standard",s=e.turns.find(T=>T.id===t)||{},l=fF(e,t),c=e.nodes.filter(T=>T.turnId===t),u=Bn(s)||c.some(Bn),[d,p]=v.useState(()=>ks());if(v.useEffect(()=>{if(!u)return;p(ks());const T=setInterval(()=>p(ks()),1e3);return()=>clearInterval(T)},[u]),!l.roots.length&&!s.startedAt)return null;const m=new Set(((C=a.view)==null?void 0:C.executionExpanded)||[]),h=`turn:${t}`,f=bk(m,h,i),g=T=>{const I=T===h?Pq(m,T,i):new Set(m);T!==h&&(I.has(T)?I.delete(T):I.add(T)),r("view.update",{patch:{executionExpanded:[...I]}})},y=((O=s.nodeCounts)==null?void 0:O.tools)??c.filter(T=>T.kind==="tool").length,E=((k=s.nodeCounts)==null?void 0:k.models)??c.filter(T=>T.kind==="llm").length,b=Np(s,d),S=Bn(s)?`Working${b?` · ${b}`:"…"}`:b?`Worked for ${b}`:"Work details";return n.createElement("section",{className:"a-execution-turn a-execution-content","data-part":"execution","data-turn-id":s.originalTurnId||t,"data-group-id":t,"aria-label":"Execution details"},n.createElement("button",{type:"button",className:"a-execution-line a-execution-turn-line","data-action":"view.update","data-view-label":Bn(s)?"Working · expand work details":"Completed work · expand work details","aria-expanded":f,onClick:()=>g(h)},n.createElement(en,{className:`a-execution-chevron ${f?"open":""}`}),n.createElement("span",{className:"a-execution-label"},S),n.createElement(Ek,{value:s.aggregateUsage||s.usage,pending:Bn(s)}),n.createElement("span",{className:"a-execution-call-counts"},y," ",y===1?"tool call":"tool calls"," · ",E," ",E===1?"model call":"model calls"),n.createElement(wk,{status:s.status||s.phase})),f&&l.roots.length>0&&n.createElement("div",{className:"a-execution-roots"},l.roots.map(T=>n.createElement(kk,{key:T.id,node:T,tree:l,act:r,now:d,expanded:m,toggle:g}))))}function ag(e){if(!e)return;e.style.minHeight="44px",e.style.maxHeight="180px",e.style.height="auto";const t=Math.max(44,Math.min(180,e.scrollHeight));e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>180?"auto":"hidden",e.style.resize="none"}function $q({draft:e="",attachments:t=[],uploading:a=!1,working:r=!1,responseActive:o=!1,stopping:i=!1,voiceStatus:s="idle",voiceStarting:l=!1,busy:c=!1,newChatPending:u=!1,sending:d=!1,historyPending:p=!1,executionUnavailable:m=!1}={}){const h=!!e.trim()||t.length>0;return h||a?{action:"conversation.send",label:r?"Send a correction":"Send message",icon:"send",disabled:!h||c||u||a||p||m}:["idle","ended","error"].includes(s)?o?{action:"conversation.stop",label:"Stop response",icon:"cancel",disabled:i||m}:u||d?{action:"conversation.send",label:"Send message",icon:"send",disabled:!0}:{action:"call.start",label:"Start voice call",icon:"voice",disabled:c||l||p||m}:{action:"call.end",label:"End voice call",icon:"cancel",disabled:s==="ending"}}function Bq({session:e,runtimeAvailable:t=!0,dispatch:a,children:r}){var w,N,x,A;const o=Ml(e),i=e==null?void 0:e.id,[s,l]=v.useState(null),[c,u]=v.useState(null),d=v.useRef(null),p=v.useRef(null),m=v.useRef(null),h=v.useRef(i);h.current=i;const f=s===i,g=o.blocked||f,y=(e==null?void 0:e.workspaceAvailable)===!1?"This workspace is unavailable. Restore access to it before continuing.":(e==null?void 0:e.historyReadOnlyReason)||(t?"":"The Amplifier runtime is unavailable. Check Settings before trying again."),E=c&&c.id===i?c.message:"";v.useEffect(()=>u(null),[i,(w=e==null?void 0:e.ownership)==null?void 0:w.status,(N=e==null?void 0:e.ownership)==null?void 0:N.reason,(x=e==null?void 0:e.ownership)==null?void 0:x.detail]),v.useEffect(()=>{var C,O,k;g||m.current!==i||(m.current=null,(document.activeElement===document.body||(C=d.current)!=null&&C.contains(document.activeElement))&&((k=(O=d.current)==null?void 0:O.querySelector("textarea"))==null||k.focus()))},[g,i]);async function b(){if(p.current===i||!o.canTakeover||y)return;const C=i;p.current=C,m.current=C,l(C),u(null);try{await a("session.takeover",{id:C})}catch(O){h.current===C&&u({id:C,message:_a(O)})}finally{p.current===C&&(p.current=null),l(O=>O===C?null:O)}}const S=f||((A=e==null?void 0:e.ownership)==null?void 0:A.status)==="taking-over";return n.createElement("div",{className:`a-composer-access ${g?"is-blocked":""}`,ref:d},n.createElement("fieldset",{className:"a-composer-fields",disabled:g,inert:g},r),g&&n.createElement("section",{className:"a-composer-lock","aria-label":"Conversation access","aria-busy":S},n.createElement("div",{className:"a-composer-lock-copy",role:"status","aria-live":"polite","aria-atomic":"true"},S?n.createElement(dg,{className:"a-progress-spinner","aria-hidden":"true"}):n.createElement(Jk,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,S?"Taking over…":o.label),n.createElement("p",null,S?"Waiting for ownership, then loading your session. Your draft is kept.":o.detail),y&&n.createElement("p",null,y))),E&&n.createElement("p",{className:"a-composer-lock-error",role:"alert"},E," Your draft is kept. Try again when the connection is available."),o.canTakeover&&n.createElement("button",{type:"button",className:"a-primary","data-action":"session.takeover",disabled:f||!!y,onClick:b},f?"Taking over…":o.retry?"Try again":"Continue here")))}function rg({question:e,sessionId:t,dispatch:a}){var E,b;const[r,o]=v.useState(""),[i,s]=v.useState(""),[l,c]=v.useState(!1),[u,d]=v.useState(""),p=v.useRef(!1),m=v.useRef(null),h=e;async function f(S){var A;if(S.preventDefault(),p.current)return;const w=r?{optionId:r}:{text:i.trim()};if(!r&&!w.text)return;const N={sessionId:t,id:h.id,expectedRevision:h.revision,...w},x=JSON.stringify(N);((A=m.current)==null?void 0:A.key)!==x&&(m.current={key:x,id:crypto.randomUUID()}),p.current=!0,c(!0),d("");try{await a("question.answer",N,{id:m.current.id})}catch(C){d(C.message||"The answer could not be confirmed. Your choice is kept.")}finally{p.current=!1,c(!1)}}async function g(){if(!p.current){p.current=!0,c(!0),d("");try{await a("question.cancel",{sessionId:t,id:h.id,expectedRevision:h.revision,reason:"Skipped by the user"})}catch(S){d(S.message)}finally{p.current=!1,c(!1)}}}const y=(E=h.delivery)==null?void 0:E.status;return n.createElement("article",{className:"a-question","aria-label":`Question ${h.id}`,"data-question-id":h.id},n.createElement("div",{className:"a-question-kind"},h.required?"Answer needed for this step":"Optional question"),n.createElement("p",{className:"a-question-prompt"},h.prompt),n.createElement("p",{className:"a-caption"},h.dependency),h.status==="pending"?n.createElement("form",{onSubmit:f,"aria-label":`Answer: ${h.prompt}`},n.createElement("fieldset",{disabled:l},n.createElement("legend",{className:"a-sr-only"},h.prompt),h.options.map(S=>n.createElement("label",{className:"a-question-option",key:S.id},n.createElement("input",{type:"radio",name:`question-${h.id}`,value:S.id,checked:r===S.id,onChange:()=>{o(S.id),s("")}}),n.createElement("span",null,n.createElement("strong",null,S.label),S.description&&n.createElement("small",null,S.description)))),h.allowFreeText&&n.createElement("label",{className:"a-question-text"},h.options.length?"Or write your own answer":"Your answer",n.createElement("textarea",{"aria-label":`Your answer: ${h.prompt}`,value:i,rows:2,maxLength:8e3,onChange:S=>{s(S.target.value),o("")}}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"question.answer",disabled:l||!r&&!i.trim()},l?"Saving answer…":"Submit answer"),!h.required&&n.createElement("button",{className:"a-soft",type:"button","data-action":"question.cancel",disabled:l,onClick:g},"Skip question")),h.required&&n.createElement("p",{className:"a-caption"},"This step waits for your answer. Other work can continue.")):n.createElement("div",{className:"a-question-result",role:"status"},h.status==="answered"?n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,"Your answer:")," ",h.answer.text),n.createElement("small",null,y==="accepted"?"Answer saved and delivered to Amplifier.":y==="sending"?"Answer saved. Confirming delivery…":y==="rejected"?"Answer saved. Amplifier could not accept it.":"Answer saved. Delivery is unconfirmed; it has not been sent again."),((b=h.delivery)==null?void 0:b.message)&&y!=="accepted"&&n.createElement("p",null,h.delivery.message)):n.createElement("small",null,h.status==="superseded"?"Replaced by a newer question.":"Question cancelled without an answer.")),u&&n.createElement("p",{role:"alert"},u))}function Hq({session:e,dispatch:t}){const a=(e==null?void 0:e.questions)||[],r=a.filter(i=>{var s;return i.status==="pending"||i.status==="answered"&&((s=i.delivery)==null?void 0:s.status)!=="accepted"}),o=a.filter(i=>!r.includes(i)).slice(-3);return a.length?n.createElement("section",{className:"a-questions","data-part":"questions","aria-label":"Questions for you"},r.map(i=>n.createElement(rg,{key:`${i.id}:${i.revision}`,question:i,sessionId:e.id,dispatch:t})),!!o.length&&n.createElement("details",{className:"a-question-history"},n.createElement("summary",null,"Recent answers and closed questions"),o.map(i=>n.createElement(rg,{key:`${i.id}:${i.revision}`,question:i,sessionId:e.id,dispatch:t})))):null}function Vq(){let e=null;const t=new Map;function a(i){var c,u,d;const s=i.submitter||((u=(c=i.target)==null?void 0:c.closest)==null?void 0:u.call(c,"button,select,input[type=checkbox],input[type=radio],input[type=file]"));if(!s)return;if(i.type==="click"&&t.has(s)){i.preventDefault(),i.stopPropagation();return}const l={button:s,action:s.dataset.action||((d=s.closest("[data-action]"))==null?void 0:d.dataset.action)};e=l,setTimeout(()=>{e===l&&(e=null)},0)}function r(i){if(i==="view.update"||i==="canvas.visibility")return()=>{};const s=(e==null?void 0:e.action)===i?e.button:null;if(!s)return()=>{};const l=i==="view.update"?()=>{}:Wu(Sg(s)),c=t.get(s)||{count:0,busy:s.getAttribute("aria-busy")};c.count++,t.set(s,c),s.setAttribute("aria-busy","true"),s.setAttribute("data-action-pending","");let u=!1;return()=>{if(!u&&(u=!0,l(),!--c.count)){t.delete(s);for(const[d,p]of[["aria-busy",c.busy]])d==="aria-busy"&&s.getAttribute("data-operation-pending")==="true"||(p===null?s.removeAttribute(d):s.setAttribute(d,p));s.removeAttribute("data-action-pending")}}}function o(i){return i.addEventListener("click",a,!0),i.addEventListener("submit",a,!0),i.addEventListener("change",a,!0),()=>{i.removeEventListener("click",a,!0),i.removeEventListener("submit",a,!0),i.removeEventListener("change",a,!0)}}return{attach:o,begin:r}}function Wq(e,t={current:!0}){const a=e.ownerDocument.defaultView,r=()=>({top:e.scrollTop,height:e.scrollHeight,viewport:e.clientHeight});let o=r(),i=0,s=!1,l=null;const c=()=>{i=0,!s&&(t.current&&(e.scrollTop=e.scrollHeight),o=r())},u=()=>{!i&&!s&&(i=a.requestAnimationFrame(c))},d=()=>{const S=r(),w=S.height===o.height&&S.viewport===o.viewport;w&&S.topo.top+1&&S.height-S.top-S.viewport<80&&(t.current=!0),o=S,t.current&&!w&&u()},p=S=>{S.deltaY<0&&(t.current=!1)},m=S=>{var w;l=((w=S.touches[0])==null?void 0:w.clientY)??null},h=S=>{var N;const w=(N=S.touches[0])==null?void 0:N.clientY;l!==null&&w>l&&(t.current=!1),l=w??null},f=S=>{S.target.closest('input,textarea,select,[contenteditable="true"]')||(["ArrowUp","PageUp","Home"].includes(S.key)||S.key===" "&&S.shiftKey)&&(t.current=!1)},g=new a.ResizeObserver(u),y=new Set,E=()=>{for(const S of y)S.parentElement!==e&&(g.unobserve(S),y.delete(S));for(const S of e.children)y.has(S)||(g.observe(S),y.add(S))},b=new a.MutationObserver(()=>{E(),u()});return g.observe(e),E(),b.observe(e,{subtree:!0,childList:!0,characterData:!0}),e.addEventListener("scroll",d,{passive:!0}),e.addEventListener("wheel",p,{passive:!0}),e.addEventListener("touchstart",m,{passive:!0}),e.addEventListener("touchmove",h,{passive:!0}),e.addEventListener("keydown",f),u(),{update:u,reveal(){t.current=!0,a.cancelAnimationFrame(i),c(),u()},dispose(){s=!0,a.cancelAnimationFrame(i),g.disconnect(),b.disconnect(),e.removeEventListener("scroll",d),e.removeEventListener("wheel",p),e.removeEventListener("touchstart",m),e.removeEventListener("touchmove",h),e.removeEventListener("keydown",f)}}}function Zq(e,t,a){let r=e.scrollTop,o=!1,i=!1;const s=()=>{const l=e.scrollTop,c=l120||!t())&&(o=!0,Promise.resolve().then(a).finally(()=>{o=!1,r=e.scrollTop}))};return e.addEventListener("scroll",s,{passive:!0}),()=>{i=!0,e.removeEventListener("scroll",s)}}const Fc=`/* +`).slice(0,2e3):r;return v.useEffect(()=>a(!1),[r]),n.createElement(n.Fragment,null,n.createElement("pre",null,n.createElement("code",null,t?r:s)),i&&n.createElement("button",{type:"button",className:"a-link a-execution-more","aria-expanded":t,onClick:()=>a(!t)},t?"Show less":o.length>15?`Show all ${o.length} lines`:`Show all ${r.length.toLocaleString()} characters`))}function On({label:e,text:t,meta:a,children:r,copy:o=!0,loading:i=!1}){return t==null&&!r?null:n.createElement("section",{className:"a-execution-payload"},n.createElement("header",null,n.createElement("span",null,e),a!=null&&n.createElement("span",null,fr(a)),o&&n.createElement(Lq,{text:fr(t),label:e,disabled:i})),r||n.createElement(Dq,{text:t}))}function Mu({label:e,field:t}){return t.error?n.createElement("p",{role:"alert",className:"a-execution-load-error"},t.error," ",n.createElement("button",{type:"button",className:"a-link",onClick:t.retry},"Retry ",e.toLowerCase())):t.loading?n.createElement("small",{role:"status"},"Loading complete ",e.toLowerCase(),"…"):null}function Fq({action:e}){const[t,a]=v.useState(!1),r=e.rows.filter(o=>o.type!=="header"||!/^\*\*\* (Begin|End) Patch$/.test(o.text));return n.createElement(On,{label:e.path||"Patch",text:e.diff,meta:e.done?"Applied":e.running?"In progress":"Requested changes"},n.createElement("div",{className:"a-execution-diff","aria-label":"File changes"},(t||r.length<=15?r:r.slice(0,10)).map((o,i)=>o.type==="header"?n.createElement("div",{key:i,className:"a-execution-diff-header"},o.file||o.text):n.createElement("div",{key:i,className:`a-execution-diff-row ${o.type}`},n.createElement("span",{className:"a-execution-line-number"},o.old),n.createElement("span",{className:"a-execution-line-number"},o.new),n.createElement("span",null,o.type==="add"?"+":o.type==="remove"?"−":" "),n.createElement("code",null,o.text)))),r.length>15&&n.createElement("button",{type:"button",className:"a-link a-execution-more","aria-expanded":t,onClick:()=>a(!t)},t?"Show less":`Show all ${r.length} patch lines`))}function qq({node:e,action:t,input:a,output:r,error:o}){const i=t,s=fr(i.output),l=typeof i.out.stdout=="string"||typeof i.out.stderr=="string",c=r.value!=null;let u;i.kind==="command"?u=n.createElement(n.Fragment,null,n.createElement(On,{label:"Command",text:i.command,meta:i.args.working_directory||i.args.cwd}),c&&(l?n.createElement(n.Fragment,null,n.createElement(On,{label:"Output",text:i.out.stdout||"No output",meta:i.exit!=null?`Exit ${i.exit}`:null}),i.out.stderr&&n.createElement(On,{label:"Standard error",text:i.out.stderr})):n.createElement(On,{label:"Output",text:s||"No output",loading:r.incomplete}))):i.kind==="patch"?u=n.createElement(n.Fragment,null,n.createElement(Fq,{action:i}),c&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):i.kind==="read"||i.kind==="write"?u=n.createElement(n.Fragment,null,n.createElement(On,{label:i.kind==="read"?"File content":i.done?"Written content":"Requested content",text:i.kind==="read"&&i.failed?null:i.content||null,loading:i.kind==="read"?r.incomplete:a.incomplete}),c&&(!i.content||i.failed||i.kind==="write")&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):i.kind==="tasks"?u=n.createElement(n.Fragment,null,n.createElement("section",{className:"a-execution-payload"},n.createElement("header",null,n.createElement("span",null,i.done?"Task list":"Requested task list"),n.createElement("span",null,i.preview)),n.createElement("ul",{className:"a-execution-checklist"},i.tasks.map((E,y)=>{const b=typeof(E==null?void 0:E.status)=="string"?E.status:"unknown",S=b==="completed"?Pt:b==="in_progress"?Ro:cg;return n.createElement("li",{key:y,"data-status":b},n.createElement(S,{"aria-label":b}),n.createElement("span",null,fr((E==null?void 0:E.content)||(E==null?void 0:E.activeForm)||(E==null?void 0:E.title)||E)),n.createElement("small",null,b.replaceAll("_"," ")))}))),c&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):i.kind==="delegate"?u=n.createElement(n.Fragment,null,n.createElement(On,{label:"Task sent",text:i.task}),c&&n.createElement(On,{label:"Result",text:s,loading:r.incomplete})):u=n.createElement(n.Fragment,null,n.createElement(On,{label:i.kind==="app"?i.target:"Input",text:a.value,loading:a.incomplete}),n.createElement(On,{label:"Result",text:r.value,loading:r.incomplete}));const d={command:["command","cmd","working_directory","cwd"],patch:["patch","diff","file_path","path","filename","old_string","old_text","new_string","new_text"],read:["file_path","path","filename"],write:["file_path","path","filename","content","text"],tasks:["todos"],delegate:["agent","name","description","instruction","instructions","prompt","task"]}[i.kind],p=d?Object.fromEntries(Object.entries(i.args).filter(([E])=>!d.includes(E))):{},m=i.kind==="command"&&l?["stdout","stderr","returncode","exit_code","exitCode"]:i.kind==="read"&&i.content&&!i.failed?[typeof i.out.content=="string"&&i.out.content?"content":"text"]:null,h=m?Object.fromEntries(Object.entries(i.out).filter(([E])=>!m.includes(E))):{},g={...Object.hasOwn(io(i.result),"output")?Object.fromEntries(Object.entries(i.result).filter(([E])=>!["output","success","error"].includes(E))):{},...h};return n.createElement(n.Fragment,null,u,Object.keys(p).length>0&&n.createElement(On,{label:"Arguments",text:fr(p),loading:a.incomplete}),n.createElement(On,{label:"Result details",text:d&&Object.keys(g).length?fr(g):null}),n.createElement(On,{label:"Error",text:o.value??(i.kind!=="generic"&&i.kind!=="app"&&Object.hasOwn(io(i.result),"output")?i.result.error:null),loading:o.incomplete}),[["Input",a],["Result",r],["Error",o]].map(([E,y])=>n.createElement(Mu,{key:E,label:E,field:y})),gF(r.value).map(E=>n.createElement("a",{key:E,className:"a-execution-result-link",href:E,target:"_blank",rel:"noopener noreferrer"},E)),a.value==null&&r.value==null&&o.value==null&&!a.loading&&!r.loading&&!o.loading&&n.createElement("small",null,i.running?"Waiting for the event log…":"No action content is available in the event log."))}const Uq={message_count:"Messages",tool_count:"Tools",has_instructions:"Instructions",has_system:"System message",reasoning_enabled:"Reasoning enabled",thinking_enabled:"Thinking enabled",thinking_budget:"Thinking budget",background_mode:"Background mode",stream:"Streaming",max_tokens:"Maximum tokens",max_output_tokens:"Maximum output tokens",temperature:"Temperature",top_p:"Top P",parallel_tool_calls:"Parallel tool calls",tool_choice:"Tool choice",purpose:"Purpose",reasoning_effort:"Reasoning effort"};function jq({node:e,request:t,error:a,requestOpen:r,requestInline:o,toggleRequest:i,now:s}){var d,p;const l=m=>Number.isFinite(m)?new Date(m*1e3).toLocaleString():null,c=[["Provider",e.provider],["Model",e.model],["Status",e.status||e.phase],["Started",l(e.startedAt)],["Ended",l(e.endedAt)],["Elapsed",Np(e,s)],...Object.entries(e.requestInfo||{}).map(([m,h])=>[Uq[m]||m,typeof h=="boolean"?h?"Yes":"No":h])].filter(([,m])=>m!=null&&m!==""),u=Rp(e.usage,{pending:Bn(e)});return n.createElement(n.Fragment,null,n.createElement("dl",{className:"a-execution-model-facts"},c.map(([m,h])=>n.createElement(n.Fragment,{key:m},n.createElement("dt",null,m),n.createElement("dd",null,String(h))))),u&&n.createElement("p",{className:"a-execution-model-usage"},u.title),n.createElement(On,{label:"Error",text:a.value,loading:a.incomplete}),n.createElement(Mu,{label:"Error",field:a}),e.requestDetail?n.createElement(n.Fragment,null,n.createElement("small",null,"Recorded by the provider; some adapters supply a summary.",(d=e.requestCapture)!=null&&d.redacted?" Recognizable credentials redacted.":"",(p=e.requestCapture)!=null&&p.truncated?" This record reached the capture limit; part of the request is omitted.":""),!o&&n.createElement("button",{type:"button",className:"a-link a-execution-request-toggle","data-action":"view.update","aria-expanded":r,onClick:i},r?"Hide raw request":"Load raw request",!r&&` · ${e.requestDetail.length.toLocaleString()} characters`),(o||r)&&n.createElement(n.Fragment,null,n.createElement(On,{label:"Raw request",text:t.value,loading:t.incomplete}),n.createElement(Mu,{label:"Request",field:t}))):n.createElement("small",null,Bn(e)?"Waiting for the recorded request…":"No provider request was recorded for this call. Enable recording in Settings → Advanced → Diagnostics for future calls; availability depends on the provider."))}function Ek({value:e,pending:t=!1}){const a=Rp(e,{pending:t});return a?n.createElement("span",{className:"a-execution-usage",title:a.title},a.text):null}function wk({status:e}){return["error","failed","cancelled","interrupted"].includes(e)?n.createElement(zn,{className:"a-execution-warning","aria-label":e}):["complete","completed","success","done"].includes(e)?n.createElement(Pt,{className:"a-execution-complete","aria-label":"Completed"}):Bn({phase:e})?n.createElement("span",{className:"a-execution-dot","aria-label":e}):n.createElement(cg,{"aria-label":e||"Recorded"})}const tg=e=>Number.isFinite(e)?new Date(e*1e3).toLocaleString():null;function kk({node:e,depth:t=0,ancestors:a=[],tree:r,act:o,now:i,expanded:s,toggle:l}){var T,I;const c=e.kind==="tool",u=r.children.get(e.id)||[],d=yk(e.summary||e.detail),p=c||e.kind==="llm"||!!d||u.length>15,m=!p||s.has(e.id),h=s.has(`request:${e.id}`),f=p?"button":"div",g=((T=e.requestDetail)==null?void 0:T.lines)<=15&&((I=e.requestDetail)==null?void 0:I.length)<=3e3,E=ys(e,"input",m&&c),y=ys(e,"output",m&&c),b=ys(e,"error",m),S=ys(e,"request",m&&(g||h));if(t>20||a.includes(e.id))return null;const w=c?Mq(e,E.value,y.value):null,N=e.kind==="worker"?Wa:e.kind==="llm"?Fi:{command:vx,read:No,write:um,patch:um,tasks:Zk,delegate:Wa}[w==null?void 0:w.kind]||Ex,x=e.status||e.phase,A=Np(e,i),C=e.kind==="llm"?e.usage:e.kind==="worker"?e.aggregateUsage:null,O=(w==null?void 0:w.title)||e.label||e.model||e.kind,k=[e.provider,e.model].filter(Boolean).join(" · ");return n.createElement("div",{className:"a-execution-node","data-kind":e.kind,"data-node-id":e.id,"data-action-kind":w==null?void 0:w.kind},n.createElement(f,{className:"a-execution-line a-execution-action-line",...p?{type:"button","data-action":"view.update","data-view-label":[O,w==null?void 0:w.target,k,x].filter(Boolean).join(" · "),"aria-expanded":m,onClick:()=>l(e.id)}:{}},p&&n.createElement(en,{className:`a-execution-chevron ${m?"open":""}`}),n.createElement(N,null),n.createElement("span",{className:"a-execution-label",title:[O,w==null?void 0:w.target,k,(w==null?void 0:w.preview)||d].filter(Boolean).join(" · ")},n.createElement("span",null,O,(w==null?void 0:w.target)&&n.createElement(n.Fragment,null," ",n.createElement("code",null,w.target)),["llm","worker"].includes(e.kind)&&k&&n.createElement(n.Fragment,null," · ",k),!(w!=null&&w.target)&&(w==null?void 0:w.preview)&&n.createElement(n.Fragment,null," · ",w.preview),(w==null?void 0:w.kind)==="patch"&&(w.added>0||w.removed>0)&&n.createElement("span",{className:"a-execution-counts"},n.createElement("span",null,"+",w.added),n.createElement("span",null,"−",w.removed)))),n.createElement("span",{className:"a-execution-phase",title:[e.toolCallId&&`Call: ${e.toolCallId}`,tg(e.startedAt),tg(e.endedAt)].filter(Boolean).join(" · ")},Bn(e)||["error","failed","cancelled","interrupted"].includes(x)?`${x}${A?" · ":""}`:"",A),n.createElement(Ek,{value:C,pending:["llm","worker"].includes(e.kind)&&Bn(e)}),n.createElement(wk,{status:x})),m&&n.createElement("div",{className:"a-execution-body"},c?n.createElement(qq,{node:e,action:w,input:E,output:y,error:b}):e.kind==="llm"?n.createElement(jq,{node:e,request:S,error:b,requestOpen:h,requestInline:g,toggleRequest:()=>l(`request:${e.id}`),now:i}):d&&n.createElement(Oi,{text:d,reference:e.summaryDetail||e.detailDetail,automatic:!0,markdown:!0}),e.kind==="worker"&&e.routing&&n.createElement("p",{className:"a-muted"},hk(e.routing),e.parentProvider&&e.provider&&e.parentProvider!==e.provider&&` This worker used ${e.provider}; the parent used ${e.parentProvider}.`),e.kind==="worker"&&Bn(e)&&(e.workerId||e.sessionId)&&n.createElement("button",{className:"a-link a-danger","data-action":"worker.stop",onClick:()=>o("worker.stop",{id:e.workerId||e.sessionId})},n.createElement(fx,null),"Stop worker"),u.length>0&&n.createElement("div",{className:"a-execution-children"},u.map(F=>n.createElement(kk,{key:F.id,node:F,depth:t+1,ancestors:[...a,e.id],tree:r,act:o,now:i,expanded:s,toggle:l})))))}function ng({data:e,turnId:t,state:a,act:r}){var w,N,x,A,C,O,k;const o=Qu(),i=((N=(w=o==null?void 0:o.composition)==null?void 0:w.presentation)==null?void 0:N.interfaceDetail)||((A=(x=o==null?void 0:o.composition)==null?void 0:x.presentation)==null?void 0:A.executionDetail)||"standard",s=e.turns.find(T=>T.id===t)||{},l=fF(e,t),c=e.nodes.filter(T=>T.turnId===t),u=Bn(s)||c.some(Bn),[d,p]=v.useState(()=>ks());if(v.useEffect(()=>{if(!u)return;p(ks());const T=setInterval(()=>p(ks()),1e3);return()=>clearInterval(T)},[u]),!l.roots.length&&!s.startedAt)return null;const m=new Set(((C=a.view)==null?void 0:C.executionExpanded)||[]),h=`turn:${t}`,f=bk(m,h,i),g=T=>{const I=T===h?Pq(m,T,i):new Set(m);T!==h&&(I.has(T)?I.delete(T):I.add(T)),r("view.update",{patch:{executionExpanded:[...I]}})},E=((O=s.nodeCounts)==null?void 0:O.tools)??c.filter(T=>T.kind==="tool").length,y=((k=s.nodeCounts)==null?void 0:k.models)??c.filter(T=>T.kind==="llm").length,b=Np(s,d),S=Bn(s)?`Working${b?` · ${b}`:"…"}`:b?`Worked for ${b}`:"Work details";return n.createElement("section",{className:"a-execution-turn a-execution-content","data-part":"execution","data-turn-id":s.originalTurnId||t,"data-group-id":t,"aria-label":"Execution details"},n.createElement("button",{type:"button",className:"a-execution-line a-execution-turn-line","data-action":"view.update","data-view-label":Bn(s)?"Working · expand work details":"Completed work · expand work details","aria-expanded":f,onClick:()=>g(h)},n.createElement(en,{className:`a-execution-chevron ${f?"open":""}`}),n.createElement("span",{className:"a-execution-label"},S),n.createElement(Ek,{value:s.aggregateUsage||s.usage,pending:Bn(s)}),n.createElement("span",{className:"a-execution-call-counts"},E," ",E===1?"tool call":"tool calls"," · ",y," ",y===1?"model call":"model calls"),n.createElement(wk,{status:s.status||s.phase})),f&&l.roots.length>0&&n.createElement("div",{className:"a-execution-roots"},l.roots.map(T=>n.createElement(kk,{key:T.id,node:T,tree:l,act:r,now:d,expanded:m,toggle:g}))))}function ag(e){if(!e)return;e.style.minHeight="44px",e.style.maxHeight="180px",e.style.height="auto";const t=Math.max(44,Math.min(180,e.scrollHeight));e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>180?"auto":"hidden",e.style.resize="none"}function $q({draft:e="",attachments:t=[],uploading:a=!1,working:r=!1,responseActive:o=!1,stopping:i=!1,voiceStatus:s="idle",voiceStarting:l=!1,busy:c=!1,newChatPending:u=!1,sending:d=!1,historyPending:p=!1,executionUnavailable:m=!1}={}){const h=!!e.trim()||t.length>0;return h||a?{action:"conversation.send",label:r?"Send a correction":"Send message",icon:"send",disabled:!h||c||u||a||p||m}:["idle","ended","error"].includes(s)?o?{action:"conversation.stop",label:"Stop response",icon:"cancel",disabled:i||m}:u||d?{action:"conversation.send",label:"Send message",icon:"send",disabled:!0}:{action:"call.start",label:"Start voice call",icon:"voice",disabled:c||l||p||m}:{action:"call.end",label:"End voice call",icon:"cancel",disabled:s==="ending"}}function Bq({session:e,runtimeAvailable:t=!0,dispatch:a,children:r}){var w,N,x,A;const o=Ml(e),i=e==null?void 0:e.id,[s,l]=v.useState(null),[c,u]=v.useState(null),d=v.useRef(null),p=v.useRef(null),m=v.useRef(null),h=v.useRef(i);h.current=i;const f=s===i,g=o.blocked||f,E=(e==null?void 0:e.workspaceAvailable)===!1?"This workspace is unavailable. Restore access to it before continuing.":(e==null?void 0:e.historyReadOnlyReason)||(t?"":"The Amplifier runtime is unavailable. Check Settings before trying again."),y=c&&c.id===i?c.message:"";v.useEffect(()=>u(null),[i,(w=e==null?void 0:e.ownership)==null?void 0:w.status,(N=e==null?void 0:e.ownership)==null?void 0:N.reason,(x=e==null?void 0:e.ownership)==null?void 0:x.detail]),v.useEffect(()=>{var C,O,k;g||m.current!==i||(m.current=null,(document.activeElement===document.body||(C=d.current)!=null&&C.contains(document.activeElement))&&((k=(O=d.current)==null?void 0:O.querySelector("textarea"))==null||k.focus()))},[g,i]);async function b(){if(p.current===i||!o.canTakeover||E)return;const C=i;p.current=C,m.current=C,l(C),u(null);try{await a("session.takeover",{id:C})}catch(O){h.current===C&&u({id:C,message:_a(O)})}finally{p.current===C&&(p.current=null),l(O=>O===C?null:O)}}const S=f||((A=e==null?void 0:e.ownership)==null?void 0:A.status)==="taking-over";return n.createElement("div",{className:`a-composer-access ${g?"is-blocked":""}`,ref:d},n.createElement("fieldset",{className:"a-composer-fields",disabled:g,inert:g},r),g&&n.createElement("section",{className:"a-composer-lock","aria-label":"Conversation access","aria-busy":S},n.createElement("div",{className:"a-composer-lock-copy",role:"status","aria-live":"polite","aria-atomic":"true"},S?n.createElement(dg,{className:"a-progress-spinner","aria-hidden":"true"}):n.createElement(Jk,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,S?"Taking over…":o.label),n.createElement("p",null,S?"Waiting for ownership, then loading your session. Your draft is kept.":o.detail),E&&n.createElement("p",null,E))),y&&n.createElement("p",{className:"a-composer-lock-error",role:"alert"},y," Your draft is kept. Try again when the connection is available."),o.canTakeover&&n.createElement("button",{type:"button",className:"a-primary","data-action":"session.takeover",disabled:f||!!E,onClick:b},f?"Taking over…":o.retry?"Try again":"Continue here")))}function rg({question:e,sessionId:t,dispatch:a}){var y,b;const[r,o]=v.useState(""),[i,s]=v.useState(""),[l,c]=v.useState(!1),[u,d]=v.useState(""),p=v.useRef(!1),m=v.useRef(null),h=e;async function f(S){var A;if(S.preventDefault(),p.current)return;const w=r?{optionId:r}:{text:i.trim()};if(!r&&!w.text)return;const N={sessionId:t,id:h.id,expectedRevision:h.revision,...w},x=JSON.stringify(N);((A=m.current)==null?void 0:A.key)!==x&&(m.current={key:x,id:crypto.randomUUID()}),p.current=!0,c(!0),d("");try{await a("question.answer",N,{id:m.current.id})}catch(C){d(C.message||"The answer could not be confirmed. Your choice is kept.")}finally{p.current=!1,c(!1)}}async function g(){if(!p.current){p.current=!0,c(!0),d("");try{await a("question.cancel",{sessionId:t,id:h.id,expectedRevision:h.revision,reason:"Skipped by the user"})}catch(S){d(S.message)}finally{p.current=!1,c(!1)}}}const E=(y=h.delivery)==null?void 0:y.status;return n.createElement("article",{className:"a-question","aria-label":`Question ${h.id}`,"data-question-id":h.id},n.createElement("div",{className:"a-question-kind"},h.required?"Answer needed for this step":"Optional question"),n.createElement("p",{className:"a-question-prompt"},h.prompt),n.createElement("p",{className:"a-caption"},h.dependency),h.status==="pending"?n.createElement("form",{onSubmit:f,"aria-label":`Answer: ${h.prompt}`},n.createElement("fieldset",{disabled:l},n.createElement("legend",{className:"a-sr-only"},h.prompt),h.options.map(S=>n.createElement("label",{className:"a-question-option",key:S.id},n.createElement("input",{type:"radio",name:`question-${h.id}`,value:S.id,checked:r===S.id,onChange:()=>{o(S.id),s("")}}),n.createElement("span",null,n.createElement("strong",null,S.label),S.description&&n.createElement("small",null,S.description)))),h.allowFreeText&&n.createElement("label",{className:"a-question-text"},h.options.length?"Or write your own answer":"Your answer",n.createElement("textarea",{"aria-label":`Your answer: ${h.prompt}`,value:i,rows:2,maxLength:8e3,onChange:S=>{s(S.target.value),o("")}}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"question.answer",disabled:l||!r&&!i.trim()},l?"Saving answer…":"Submit answer"),!h.required&&n.createElement("button",{className:"a-soft",type:"button","data-action":"question.cancel",disabled:l,onClick:g},"Skip question")),h.required&&n.createElement("p",{className:"a-caption"},"This step waits for your answer. Other work can continue.")):n.createElement("div",{className:"a-question-result",role:"status"},h.status==="answered"?n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,"Your answer:")," ",h.answer.text),n.createElement("small",null,E==="accepted"?"Answer saved and delivered to Amplifier.":E==="sending"?"Answer saved. Confirming delivery…":E==="rejected"?"Answer saved. Amplifier could not accept it.":"Answer saved. Delivery is unconfirmed; it has not been sent again."),((b=h.delivery)==null?void 0:b.message)&&E!=="accepted"&&n.createElement("p",null,h.delivery.message)):n.createElement("small",null,h.status==="superseded"?"Replaced by a newer question.":"Question cancelled without an answer.")),u&&n.createElement("p",{role:"alert"},u))}function Hq({session:e,dispatch:t}){const a=(e==null?void 0:e.questions)||[],r=a.filter(i=>{var s;return i.status==="pending"||i.status==="answered"&&((s=i.delivery)==null?void 0:s.status)!=="accepted"}),o=a.filter(i=>!r.includes(i)).slice(-3);return a.length?n.createElement("section",{className:"a-questions","data-part":"questions","aria-label":"Questions for you"},r.map(i=>n.createElement(rg,{key:`${i.id}:${i.revision}`,question:i,sessionId:e.id,dispatch:t})),!!o.length&&n.createElement("details",{className:"a-question-history"},n.createElement("summary",null,"Recent answers and closed questions"),o.map(i=>n.createElement(rg,{key:`${i.id}:${i.revision}`,question:i,sessionId:e.id,dispatch:t})))):null}function Vq(){let e=null;const t=new Map;function a(i){var c,u,d;const s=i.submitter||((u=(c=i.target)==null?void 0:c.closest)==null?void 0:u.call(c,"button,select,input[type=checkbox],input[type=radio],input[type=file]"));if(!s)return;if(i.type==="click"&&t.has(s)){i.preventDefault(),i.stopPropagation();return}const l={button:s,action:s.dataset.action||((d=s.closest("[data-action]"))==null?void 0:d.dataset.action)};e=l,setTimeout(()=>{e===l&&(e=null)},0)}function r(i){if(i==="view.update"||i==="canvas.visibility")return()=>{};const s=(e==null?void 0:e.action)===i?e.button:null;if(!s)return()=>{};const l=i==="view.update"?()=>{}:Wu(Sg(s)),c=t.get(s)||{count:0,busy:s.getAttribute("aria-busy")};c.count++,t.set(s,c),s.setAttribute("aria-busy","true"),s.setAttribute("data-action-pending","");let u=!1;return()=>{if(!u&&(u=!0,l(),!--c.count)){t.delete(s);for(const[d,p]of[["aria-busy",c.busy]])d==="aria-busy"&&s.getAttribute("data-operation-pending")==="true"||(p===null?s.removeAttribute(d):s.setAttribute(d,p));s.removeAttribute("data-action-pending")}}}function o(i){return i.addEventListener("click",a,!0),i.addEventListener("submit",a,!0),i.addEventListener("change",a,!0),()=>{i.removeEventListener("click",a,!0),i.removeEventListener("submit",a,!0),i.removeEventListener("change",a,!0)}}return{attach:o,begin:r}}function Wq(e,t={current:!0}){const a=e.ownerDocument.defaultView,r=()=>({top:e.scrollTop,height:e.scrollHeight,viewport:e.clientHeight});let o=r(),i=0,s=!1,l=null;const c=()=>{i=0,!s&&(t.current&&(e.scrollTop=e.scrollHeight),o=r())},u=()=>{!i&&!s&&(i=a.requestAnimationFrame(c))},d=()=>{const S=r(),w=S.height===o.height&&S.viewport===o.viewport;w&&S.topo.top+1&&S.height-S.top-S.viewport<80&&(t.current=!0),o=S,t.current&&!w&&u()},p=S=>{S.deltaY<0&&(t.current=!1)},m=S=>{var w;l=((w=S.touches[0])==null?void 0:w.clientY)??null},h=S=>{var N;const w=(N=S.touches[0])==null?void 0:N.clientY;l!==null&&w>l&&(t.current=!1),l=w??null},f=S=>{S.target.closest('input,textarea,select,[contenteditable="true"]')||(["ArrowUp","PageUp","Home"].includes(S.key)||S.key===" "&&S.shiftKey)&&(t.current=!1)},g=new a.ResizeObserver(u),E=new Set,y=()=>{for(const S of E)S.parentElement!==e&&(g.unobserve(S),E.delete(S));for(const S of e.children)E.has(S)||(g.observe(S),E.add(S))},b=new a.MutationObserver(()=>{y(),u()});return g.observe(e),y(),b.observe(e,{subtree:!0,childList:!0,characterData:!0}),e.addEventListener("scroll",d,{passive:!0}),e.addEventListener("wheel",p,{passive:!0}),e.addEventListener("touchstart",m,{passive:!0}),e.addEventListener("touchmove",h,{passive:!0}),e.addEventListener("keydown",f),u(),{update:u,reveal(){t.current=!0,a.cancelAnimationFrame(i),c(),u()},dispose(){s=!0,a.cancelAnimationFrame(i),g.disconnect(),b.disconnect(),e.removeEventListener("scroll",d),e.removeEventListener("wheel",p),e.removeEventListener("touchstart",m),e.removeEventListener("touchmove",h),e.removeEventListener("keydown",f)}}}function Zq(e,t,a){let r=e.scrollTop,o=!1,i=!1;const s=()=>{const l=e.scrollTop,c=l120||!t())&&(o=!0,Promise.resolve().then(a).finally(()=>{o=!1,r=e.scrollTop}))};return e.addEventListener("scroll",s,{passive:!0}),()=>{i=!0,e.removeEventListener("scroll",s)}}const Fc=`/* * Amplifier theme v1 — Amplifier Unified * A single, self-contained skin. Edit this file and share it. * A blue/lilac palette with light and dark variants. @@ -1705,4 +1705,4 @@ html,body,#root{height:100%;height:100dvh;overflow:hidden} #amp-one.a-chat-shell .a-composer{width:calc(100% - 16px);margin-bottom:calc(8px + env(safe-area-inset-bottom))} #amp-one.a-chat-shell :is(input,textarea,select){font-size:max(16px,var(--a-text-base,14px))!important} } -`,qc="/branding/icons/amplifier-icon-128.png",Uc=e=>JSON.stringify(e,null,2),Kq=e=>{try{return new Date(typeof e=="number"&&e<1e12?e*1e3:e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{return""}};function Yq(){var Un,jn,Yr,Pn,qo,Dl,Tp,Ip,Ap,_p,Pp,Op,Mp,zp,Lp,Dp,Fp,qp,Up,jp,$p,Bp,Hp,Vp,Wp,Zp,Jp;const e=Bu(),[t,a]=v.useState(!1),r=v.useRef(Vq()),o=v.useRef(!1),i=v.useRef(null),s=v.useRef(null),[l,c]=v.useState(null),[u,d]=v.useState([]),[p,m]=v.useState(""),[h,f]=v.useState(!1),[g,y]=v.useState(!1),[E,b]=v.useState(0),[S,w]=v.useState(""),[N,x]=v.useState(""),[A,C]=v.useState(Fc),[O,k]=v.useState("Amplifier Unified"),[T,I]=v.useState(!1),[F,z]=v.useState("view.update"),[U,H]=v.useState('{"patch":{"mode":"chat"}}'),[te,j]=v.useState({status:"idle"}),[_,P]=v.useState(Date.now()),[G,W]=v.useState(!1),[D,ne]=v.useState(!1),q=v.useRef(null),Z=v.useRef(null),[ie,ke]=v.useState({status:"idle"}),[me,_e]=v.useState({status:"idle"}),Je=v.useRef(!1),[De,ue]=v.useState(!1),ye=jF(),M=v.useRef(new Set),Y=v.useRef(Promise.resolve()),se=v.useRef(new WeakMap),Fe=v.useRef(!1),[je,oe]=v.useState(!1),Ze=v.useRef({busy:!1,revision:0}),[it,zt]=v.useState(!1),ct=v.useRef(null),qt=v.useRef(Promise.resolve()),le=v.useRef(0),fe=v.useRef(null),xe=v.useRef(null),ze=v.useRef(!0),Ye=v.useRef(null),ht=v.useRef(null),bt=v.useRef(null),ft=v.useRef(null),Ce=v.useRef(null),gt=v.useRef(null),Et=v.useRef(null),vt=v.useRef(),at=v.useRef(null),X=v.useRef(null),Re=v.useRef(new Set),ae=v.useRef(null),Le=v.useRef(""),Oe=v.useRef(Promise.resolve()),et=v.useRef(Promise.resolve()),st=v.useRef(Promise.resolve()),It=v.useRef(null),xt=v.useRef(Promise.resolve()),Ut=v.useRef(new Set),rt=v.useRef(new Set),Xe=v.useRef(()=>{}),$e=v.useRef(aq()),Nt=v.useRef(null),Zt=v.useRef(uq()),rn=v.useCallback(L=>{for(const K of L||[])K.id&&rt.current.has(K.id)||(K.id&&rt.current.add(K.id),!(K.createdAt&&Date.now()-new Date(typeof K.createdAt=="number"&&K.createdAt<1e12?K.createdAt*1e3:K.createdAt).getTime()>6e4)&&Promise.resolve().then(async()=>{var de,Ie,qe,Ue;if(K.type==="download"&&gm(K.filename||"amplifier-export.json",K.content??K.data,K.mimeType||K.mime||"application/json"),K.type==="conversation.export"&&await pq(K,{request:St,download:gm,clipboard:navigator.clipboard}),K.type==="message.copy"){let Pe="ready",_t="Copied Markdown";try{await navigator.clipboard.writeText(await dq(Ce.current,K,St))}catch(yt){Pe="error",_t="Could not copy: "+yt.message}await St("/api/actions",{method:"POST",body:{action:"message.copyResult",args:{requestId:K.requestId,status:Pe,message:_t}}})}if(K.type==="download.url"){const Pe=document.createElement("a");Pe.href=K.url,Pe.download=K.filename,Pe.click()}if(K.type==="browser.open"&&window.open(K.url,"_blank","noopener,noreferrer"),["clipboard.write","clipboard.url"].includes(K.type))try{let Pe=K.content;if(K.type==="clipboard.url"){const _t=await fetch(K.url);if(!_t.ok)throw Error("Source unavailable");Pe=await _t.text()}await navigator.clipboard.writeText(Pe),await St("/api/actions",{method:"POST",body:{action:"canvas.report",args:{id:K.canvasId,part:"clipboard",status:"ready",message:"Source copied"}}})}catch(Pe){throw await St("/api/actions",{method:"POST",body:{action:"canvas.report",args:{id:K.canvasId,part:"clipboard",status:"error",message:"Clipboard unavailable: "+Pe.message}}}),Pe}if(K.type==="call.start")try{await gt.current.start(K.args||{})}catch(Pe){throw await St("/api/voice/end",{method:"POST",body:{id:null}}).catch(()=>{}),Pe}if(K.type==="canvas.checkpoint"&&await Bl(K.sessionId,K.id),K.type==="voice.visual.capture"&&await((de=q.current)==null?void 0:de.capture(K)),K.type==="computer.visual.capture"&&await((Ie=Z.current)==null?void 0:Ie.capture(K)),K.type==="call.end"&&await gt.current.end(),K.type==="call.resumeAudio"&>.current.callAudio.resumePlayback(),K.type==="call.keepAwake"&>.current.setKeepAwake(K.enabled??((qe=K.args)==null?void 0:qe.enabled)??!0),K.type==="call.mute"&>.current.setMuted(K.muted??((Ue=K.args)==null?void 0:Ue.muted)??!0),["notification.request","notification-permission"].includes(K.type)&&"Notification"in window){const Pe=await Notification.requestPermission();await St("/api/view",{method:"POST",body:{clientId:Ha,notificationPermission:Pe}})}}).catch(de=>m(_a(de))))},[]);Xe.current=rn;const In=v.useRef(new Set),yn=v.useRef(null),Fn=v.useRef(sq()),Gn=v.useRef(Promise.resolve()),An=v.useRef(new WeakSet),Jt=v.useCallback(L=>{var Ie,qe,Ue,Pe,_t;if(!L||typeof L!="object"||Nt.current&&((Ie=L.client)==null?void 0:Ie.hostInstanceId)===((qe=Nt.current.client)==null?void 0:qe.hostInstanceId)&&L.revisionyt.id===Ce.current.selectedSessionId),de=(_t=L.sessions)==null?void 0:_t.find(yt=>yt.id===L.selectedSessionId);if((K==null?void 0:K.id)===(de==null?void 0:de.id)&&Number(de==null?void 0:de.sharedHistoryOffset)Sr.getBoundingClientRect().bottom>Lt);un&&(ht.current={sessionId:de.id,messageId:un.dataset.messageId,top:un.getBoundingClientRect().top},ze.current=!1)}Nt.current=L,Zt.current.remember(L);for(const yt of In.current)yt(L);Ce.current=Zt.current.apply(L),c($e.current.apply(Ce.current)),Ut.current.forEach(yt=>yt($e.current.apply(Ce.current)))},[]),dn=v.useCallback(L=>{if(L.stateRevision===void 0)return Promise.resolve();const K=de=>{var Ie;return((Ie=de==null?void 0:de.client)==null?void 0:Ie.hostInstanceId)===L.hostInstanceId&&de.revision>=L.stateRevision};return K(Nt.current)?Promise.resolve():new Promise((de,Ie)=>{const qe=()=>{clearTimeout(Pe),In.current.delete(Ue),de()},Ue=_t=>{K(_t)&&qe()},Pe=setTimeout(()=>{In.current.delete(Ue),yn.current||(yn.current=St("/api/state").then(Jt).finally(()=>{yn.current=null})),yn.current.then(de,Ie)},1500);In.current.add(Ue)})},[Jt]),ut=v.useCallback((L,K={},de={})=>{var Gp,Qp,Xp,em,tm,nm,am,rm;if(L==="call.resumeAudio"&&((Gp=gt.current)==null||Gp.callAudio.resumePlayback()),(L==="message.reply"||L==="canvas.reference"||L==="canvas.views.command"&&K.action==="canvas.reference")&&!de.referencePrepared){if(Fe.current)return Promise.reject(Error("A reference is already being added."));const Qt=$e.current.apply(Ce.current),jo=Qt==null?void 0:Qt.selectedSessionId,Sk=((Qp=Qt==null?void 0:Qt.view)==null?void 0:Qp.draft)||"",Fl=L==="canvas.views.command"?K.args:K;Fe.current=!0,oe(!0),clearTimeout(vt.current);const om=X.current,im=at.current;return(async()=>{var lm;if(im&&om&&await xn(om,im),((lm=Ce.current)==null?void 0:lm.selectedSessionId)!==jo)throw Error("The conversation changed. Your draft was kept; select the text again.");const sm={...Fl,sessionId:Fl.sessionId??jo,...L==="message.reply"?{}:{expectedDraft:Fl.expectedDraft??Sk}};return await ut(L,L==="canvas.views.command"?{...K,args:sm}:sm,{...de,referencePrepared:!0})})().finally(()=>{Fe.current=!1,oe(!1)})}if(["conversation.send","conversation.stop","worker.spawn","worker.stop","worker.steer","approval.respond","attachment.add","attachment.remove"].includes(L)&&(K={sessionId:(Xp=Ce.current)==null?void 0:Xp.selectedSessionId,...K}),L==="conversation.send"&&!de.checkpointed)return Bl(K.sessionId).then(()=>ut(L,K,{...de,checkpointed:!0}));L==="view.update"&&Object.hasOwn(K.patch||{},"draft")&&(K={sessionId:(em=Ce.current)==null?void 0:em.selectedSessionId,...K});const qe=L==="session.select"?K.id:L==="shell.command"&&K.action==="session.select"?(tm=K.args)==null?void 0:tm.id:null,Ue=qe&&!It.current?Zt.current.begin($e.current.apply(Ce.current),qe):null;Ue&&Nt.current&&(Ce.current=Zt.current.apply(Nt.current),c($e.current.apply(Ce.current))),L==="canvas.visibility"&&(K={sessionId:((nm=Ce.current)==null?void 0:nm.selectedSessionId)??null,canvasId:((rm=(am=Ce.current)==null?void 0:am.canvas)==null?void 0:rm.id)??null,...K});const Pe=L==="canvas.visibility"?$e.current.addCanvas(Ce.current,K.open):L==="view.update"?de.pendingViewToken??$e.current.add(K.patch||{},K.sessionId):null;Pe&&Ce.current&&c($e.current.apply(Ce.current));const _t=VL(),yt=de.feedback===!1?()=>{}:r.current.begin(L==="shell.command"?K.action:L),Lt=It.current,un=async()=>{Sr&&Lt&&await Lt;const Qt=await St("/api/actions",{signal:de.signal,method:"POST",body:{action:L,args:K,id:de.id||crypto.randomUUID(),...de.expectedRevision!==void 0?{expectedRevision:de.expectedRevision}:{}}});return Qt.state?Jt(Qt.state):await dn(Qt),Qt},Sr=["session.select","session.draft","workspace.select"].includes(L)||L==="shell.command"&&["session.select","session.draft","workspace.select"].includes(K.action),xk=L==="attention.read"&&Array.isArray(K.ids)&&K.ids.length>0&&K.ids.every(Qt=>{var jo;return typeof((jo=K.fingerprints)==null?void 0:jo[Qt])=="string"}),Kp=oq(L,de),Yp=L.startsWith("coordination.")||de.presentation?{current:Promise.resolve()}:L==="canvas.visibility"?Oe:Sr?st:xk?xt:["conversation.send","message.edit","question.answer"].includes(L)?Y:Kp?Gn:et,Uo=Fn.current(Yp,un,iq(L,K,de),Kp?et.current:null).then(Qt=>(Pe&&$e.current.settle(Pe),Ue&&Zt.current.settle(Ue),Pe&&Ce.current&&c($e.current.apply(Ce.current)),An.current.has(Qt)||(An.current.add(Qt),rn(Qt.effects)),Qt)).catch(Qt=>{throw Ue&&(Zt.current.settle(Ue),Nt.current&&(Ce.current=Zt.current.apply(Nt.current),c($e.current.apply(Ce.current)))),Qt.state&&Jt(Qt.state),Pe&&($e.current.settle(Pe),Ce.current&&c($e.current.apply(Ce.current))),Qt}).finally(()=>{_t(),yt()});if(Yp.current=Uo.catch(()=>{}),L==="canvas.views.dirty"){It.current=Uo;const Qt=()=>{It.current===Uo&&(It.current=null)};Uo.then(Qt,Qt)}return Uo},[Jt,rn,dn]);v.useEffect(()=>{var L,K;for(const de of ye.entries){if(de.sessionId||!((L=de.creation)!=null&&L.id))continue;const Ie=(K=l==null?void 0:l.sessions)==null?void 0:K.find(qe=>qe.creationCommandId===de.creation.id);Ie&&ye.update(de.id,{sessionId:Ie.id})}},[l==null?void 0:l.sessions,ye.entries]);const ve=Xx(Nt.current,ut,Ha);v.useEffect(()=>ft.current?r.current.attach(ft.current):void 0,[!!l,ve.ready]);const ge=v.useCallback((L,K={})=>ut(L,K).catch(de=>m(_a(de))),[ut]),At=v.useRef(null);At.current||(At.current=cq(L=>St("/api/view",{method:"POST",body:L})));const Ot=v.useCallback(()=>{var L;Ce.current&&!document.hidden&&At.current({...jl(ft.current,Ha,{interfaceOnly:!0}),sessionId:Ce.current.selectedSessionId??null,voice:(L=gt.current)==null?void 0:L.state,notificationPermission:"Notification"in window?Notification.permission:"unsupported"})},[]);v.useEffect(()=>{let L=!0,K;const de=new AbortController;m("");const Ie=setTimeout(()=>{de.abort(),L&&!Ce.current&&m("The workspace is taking too long to respond. You can retry the connection.")},1e4);return Zx(de.signal).then(()=>{if(!L)return;St("/api/state",{signal:de.signal}).then(Ue=>{L&&(Jt(Ue.state||Ue),f(!0))}).catch(Ue=>{L&&Ue.name!=="AbortError"&&!Ce.current&&m(_a(Ue))}).finally(()=>clearTimeout(Ie)),St("/api/actions",{signal:de.signal}).then(Ue=>{L&&d(Array.isArray(Ue)?Ue:Ue.actions||[])}).catch(()=>{});let qe;ti("connecting"),K=new EventSource($i("/api/events?transport=delta-v1")),K.addEventListener("state",Ue=>{if(L)try{const Pe=!Ce.current;qe=JSON.parse(Ue.data),Jt(qe),f(!0),Pe&&m(""),clearTimeout(Ie)}catch{}}),K.addEventListener("state-delta",Ue=>{if(L)try{qe=lq(qe,JSON.parse(Ue.data)),Jt(qe),f(!0)}catch{K.close(),ti("closed"),f(!1),b(Pe=>Pe+1)}}),K.addEventListener("shell",Ue=>{try{window.dispatchEvent(new CustomEvent("amplifier-shell",{detail:JSON.parse(Ue.data)}))}catch{}}),K.onopen=()=>{ti("open"),f(!0),At.current.invalidate(),Ot(),window.dispatchEvent(new Event("amplifier-reconnected"))},K.onerror=()=>{ti(K.readyState===2?"closed":"reconnecting"),f(!1)}}).catch(qe=>{clearTimeout(Ie),L&&qe.name!=="AbortError"&&m(_a(qe))}),()=>{L=!1,clearTimeout(Ie),de.abort(),K==null||K.close(),ti("closed")}},[Jt,E]),v.useEffect(()=>(window.amplifier=Object.freeze({shellClientId:Ha,getShellState:()=>ve.data,getState:()=>({...$e.current.apply(Ce.current),renderedView:jl(ft.current,Ha)}),getActions:()=>u,dispatch:ut,subscribe:L=>(Ut.current.add(L),()=>Ut.current.delete(L))}),()=>{delete window.amplifier}),[u,ut,ve.data]),v.useEffect(()=>{const L=ft.current;if(!L)return;const K=()=>Jx(L),de=new MutationObserver(K);return K(),de.observe(L,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>de.disconnect()},[!!l,ve.ready]),v.useEffect(()=>{const L=setTimeout(Ot,300);return()=>clearTimeout(L)},[l,S,A,T,te,Ot,ve.data]),v.useEffect(()=>{let L;const K=()=>{clearTimeout(L),L=setTimeout(Ot,200)};return document.addEventListener("visibilitychange",K),document.addEventListener("selectionchange",K),document.addEventListener("focusin",K),document.addEventListener("input",K),window.addEventListener("resize",K),()=>{clearTimeout(L),document.removeEventListener("visibilitychange",K),document.removeEventListener("selectionchange",K),document.removeEventListener("focusin",K),document.removeEventListener("input",K),window.removeEventListener("resize",K)}},[Ot]),v.useEffect(()=>{var K;if(!l)return;const L=((K=l.view)==null?void 0:K.draft)||"";L!==Le.current&&(w(L),Le.current=L)},[(Un=l==null?void 0:l.view)==null?void 0:Un.draft,l==null?void 0:l.selectedSessionId]),v.useEffect(()=>{var K,de,Ie,qe;if(!l)return;const L=((K=l.theme)==null?void 0:K.name)+"::"+((de=l.theme)==null?void 0:de.css);L!==ae.current&&(C(((Ie=l.theme)==null?void 0:Ie.css)||Fc),k(((qe=l.theme)==null?void 0:qe.name)||"Amplifier Unified"),I(!1),ae.current=L)},[l==null?void 0:l.theme]),v.useEffect(()=>{const L=l==null?void 0:l.view;L&&(L.workerDraft!==void 0&&x(L.workerDraft),L.themeDraft!==void 0&&C(L.themeDraft),L.themeDraftName!==void 0&&k(L.themeDraftName),L.themePreview!==void 0&&I(L.themePreview),L.agentAction!==void 0&&z(L.agentAction),L.agentArgs!==void 0&&H(L.agentArgs))},[(jn=l==null?void 0:l.view)==null?void 0:jn.workerDraft,(Yr=l==null?void 0:l.view)==null?void 0:Yr.themeDraft,(Pn=l==null?void 0:l.view)==null?void 0:Pn.themeDraftName,(qo=l==null?void 0:l.view)==null?void 0:qo.themePreview,(Dl=l==null?void 0:l.view)==null?void 0:Dl.agentAction,(Tp=l==null?void 0:l.view)==null?void 0:Tp.agentArgs]);const Kt=$F((Ip=l==null?void 0:l.sessions)==null?void 0:Ip.find(L=>L.id===l.selectedSessionId),()=>{ze.current=!1;const L=xe.current;if(!L)return;const K=L.getBoundingClientRect().top,de=[...L.querySelectorAll("[data-message-id]")].find(Ie=>Ie.getBoundingClientRect().bottom>K);de&&(ht.current={sessionId:l.selectedSessionId,messageId:de.dataset.messageId,top:de.getBoundingClientRect().top})}),Q=Kt.session,Yt=(l==null?void 0:l.view)||{},En=Yt.mode||"chat",qn=Fw(Q),pn=qn.busy,wn=UF((Q==null?void 0:Q.messages)||[],ye.entries,Q==null?void 0:Q.id),mn=(Q==null?void 0:Q.historyLoaded)===!1||!!(Q!=null&&Q.historyLoading)&&!wn.length,_n=Ml(Q),on=(Q==null?void 0:Q.workspaceAvailable)===!1||!!(Q!=null&&Q.historyReadOnlyReason)||_n.blocked,pt=dD(Yt.panel,s,L=>ge("view.update",{patch:{panel:L}}));v.useEffect(()=>{var K;const L=(K=Q==null?void 0:Q.title)==null?void 0:K.trim();document.title=L?L+" - Amplifier":"Amplifier"},[Q==null?void 0:Q.id,Q==null?void 0:Q.title]),_x(l,ge,xe,ve.ready);const mt=uF(Q,_),V=bF(wn,dF(Q)),we=v.useRef(null);v.useEffect(()=>{var K,de,Ie;if(Q!=null&&Q.historyManaged)return;const L=(Q==null?void 0:Q.workspace)||((K=l==null?void 0:l.settings)==null?void 0:K.workspace);!L||we.current===L||(we.current=L,(((de=l.setup)==null?void 0:de.providersWorkspace)!==L||!((Ie=l.setup)!=null&&Ie.providersLoadedAt))&&ge("providers.list",Q?{sessionId:Q.id}:{}))},[Q==null?void 0:Q.workspace,Q==null?void 0:Q.historyManaged,(Ap=l==null?void 0:l.settings)==null?void 0:Ap.workspace]);const Ge=((Q==null?void 0:Q.draftAttachments)||(l==null?void 0:l.draftAttachments)||[]).filter(L=>!ye.entries.some(K=>K.sessionId===(Q==null?void 0:Q.id)&&K.attachmentIds.includes(L.id)));v.useEffect(()=>{var L,K,de,Ie;for(const qe of ye.entries){const Ue=(de=(K=(L=l==null?void 0:l.sessions)==null?void 0:L.find(Pe=>Pe.id===qe.sessionId))==null?void 0:K.messages)==null?void 0:de.find(Pe=>Pe.inputId===qe.commandId);((Ie=Ue==null?void 0:Ue.delivery)==null?void 0:Ie.status)==="accepted"&&ye.update(qe.id,null)}},[l]);const Dt=GF(Q),kn=pF(wn,V);v.useEffect(()=>{if(!mt)return;const L=setInterval(()=>P(Date.now()),1e3);return()=>clearInterval(L)},[!!mt,Q==null?void 0:Q.id]),v.useLayoutEffect(()=>{if(!xe.current)return;const L=Wq(xe.current,ze);return Ye.current=L,()=>{L.dispose(),Ye.current=null}},[!!l,ve.ready]),v.useLayoutEffect(()=>{var L;(L=Ye.current)==null||L.reveal()},[Q==null?void 0:Q.id,ve.ready]),v.useEffect(()=>{const L=xe.current;if(!(!L||!Q))return Zq(L,()=>{var K;return!Kt.busy&&!Q.historyLoading&&(((K=Q.messageWindow)==null?void 0:K.offset)>0||Q.sharedHistoryOffset>0)},()=>{var K;return ze.current=!1,((K=Q.messageWindow)==null?void 0:K.offset)>0?Kt.earlier("messages"):ge("session.history",{id:Q.id,before:Q.sharedHistoryOffset,limit:100})})},[Q==null?void 0:Q.id,(_p=Q==null?void 0:Q.messageWindow)==null?void 0:_p.offset,Q==null?void 0:Q.sharedHistoryOffset,Q==null?void 0:Q.historyLoading,Kt.busy,ge,ve.ready]),v.useLayoutEffect(()=>{const L=ht.current;if(!L||!xe.current||(ht.current=null,L.sessionId!==(Q==null?void 0:Q.id)))return;const K=xe.current,de=[...(K==null?void 0:K.querySelectorAll("[data-message-id]"))||[]].find(Ie=>Ie.dataset.messageId===L.messageId);de&&(K.scrollTop+=de.getBoundingClientRect().top-L.top)},[Q==null?void 0:Q.id,Q==null?void 0:Q.sharedHistoryOffset,(Pp=Q==null?void 0:Q.messageWindow)==null?void 0:Pp.offset,(Op=Q==null?void 0:Q.executionWindow)==null?void 0:Op.offset,ve.ready]),v.useLayoutEffect(()=>{var L;ag(bt.current),(L=Ye.current)==null||L.update()},[S,l==null?void 0:l.selectedSessionId,ve.ready]),v.useEffect(()=>{const L=()=>ag(bt.current);return window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[]),v.useEffect(()=>{if(l){for(const L of Xf(l))if(!Re.current.has(L.id)&&(Re.current.add(L.id),_q(l.notificationSettings)&&h&&"Notification"in window&&Notification.permission==="granted"&&(document.hidden||L.sessionId!==l.selectedSessionId))){const K=new Notification("Amplifier",{body:Aq(L,l.notificationSettings),icon:qc,tag:L.id});K.onclick=()=>{window.focus(),ge("session.select",{id:L.sessionId}),ge("view.update",{patch:{mode:"text"}})}}}},[l,h,ge]),v.useEffect(()=>(gt.current=new fq({request:St,onAction:(L,K)=>ut(L,K),onState:L=>{var K;j(L),L.status!=="connected"&&((K=q.current)==null||K.stop())},onError:L=>m(L.message||String(L))}),q.current=new vk({request:St,onState:ke,getVoice:()=>{var L,K,de;return{...(L=gt.current)==null?void 0:L.state,sessionId:(de=(K=Ce.current)==null?void 0:K.voice)==null?void 0:de.sessionId}}}),Z.current=new vq({request:St,onState:_e,getSession:()=>{var L;return(L=Ce.current)==null?void 0:L.selectedSessionId}}),()=>{var L,K,de;(L=Z.current)==null||L.dispose(),(K=q.current)==null||K.dispose(),(de=gt.current)==null||de.dispose()}),[]),v.useEffect(()=>{var L;(L=Z.current)==null||L.sync(null,h,l==null?void 0:l.computerVisual)},[h,l==null?void 0:l.computerVisual,l==null?void 0:l.selectedSessionId]),v.useEffect(()=>{var L,K;(K=q.current)==null||K.sync(te,h,(L=l==null?void 0:l.voice)==null?void 0:L.visual)},[te,h,(Mp=l==null?void 0:l.voice)==null?void 0:Mp.visual]);const sn=L=>{var K,de;if(L==="new-session"){Sn();return}(de=(K=Ce.current)==null?void 0:K.view)!=null&&de.panel||(i.current=document.activeElement),m(""),ge("view.update",{patch:{panel:L,toolbarMenuOpen:!1,...L==="settings"&&window.matchMedia("(max-width:959px)").matches?{settingsSection:"index",settingsExpanded:[]}:{}}})},Ca=()=>{I(!1),ge("view.update",{patch:{panel:null,themePreview:!1}})},Na=()=>s.current?s.current.close():Ca();v.useEffect(()=>{var qe,Ue;if(!pt||!ve.ready)return;const L=i.current||document.activeElement,K=(qe=ft.current)==null?void 0:qe.querySelector(".a-overlay [role=dialog]");if(!K)return;const de=()=>[...K.querySelectorAll("button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href]")].filter(Pe=>Pe.getClientRects().length);K.contains(document.activeElement)||(Ue=de()[0])==null||Ue.focus();const Ie=Pe=>{var _t;if(Pe.key==="Escape"&&(s.current?s.current.close():(I(!1),ge("view.update",{patch:{panel:null,themePreview:!1}}))),Pe.key==="Tab"){const yt=de(),Lt=yt[0],un=yt.at(-1);yt.includes(document.activeElement)?Pe.shiftKey&&document.activeElement===Lt?(Pe.preventDefault(),un==null||un.focus()):!Pe.shiftKey&&document.activeElement===un&&(Pe.preventDefault(),Lt==null||Lt.focus()):(Pe.preventDefault(),(_t=Pe.shiftKey?un:Lt)==null||_t.focus())}};return window.addEventListener("keydown",Ie),()=>{window.removeEventListener("keydown",Ie),i.current=null,L!=null&&L.isConnected&&L.focus()}},[pt,ge,ve.ready]);function pa(L){const K=X.current;!at.current||(K==null?void 0:K.sessionId)===L||(clearTimeout(vt.current),xn(K,at.current).catch(de=>m(_a(de))),at.current=null)}function xn(L,K){if(se.current.has(L))return se.current.get(L);const de=(async()=>{if(L.sessionId===null&&ct.current){const Ie=await ct.current;L.sessionId=Ie.id,$e.current.bindDraft(K,Ie.id)}try{return await ut("view.update",L,{pendingViewToken:K})}catch(Ie){throw at.current===K&&(at.current=$e.current.add(L.patch,L.sessionId),Ce.current&&c($e.current.apply(Ce.current))),Ie}finally{at.current===K&&(at.current=null)}})();return se.current.set(L,de),de.catch(()=>se.current.delete(L)),de}function ta(L){var qe;if(Fe.current)return;const K=((qe=Ce.current)==null?void 0:qe.selectedSessionId)??null;pa(K),w(L),Le.current=L,$e.current.settle(at.current);const de=$e.current.add({draft:L},K),Ie={patch:{draft:L},sessionId:K};at.current=de,X.current=Ie,Ce.current&&c($e.current.apply(Ce.current)),clearTimeout(vt.current),vt.current=setTimeout(()=>{xn(Ie,de).catch(Ue=>m(_a(Ue)))},220)}async function Sn(L){pa(null),ze.current=!0,await ge("session.draft",L?{workspace:L}:{})}async function ma(L){var de,Ie;const K=!L&&((Ie=(de=Ce.current)==null?void 0:de.sessions)==null?void 0:Ie.find(qe=>{var Ue;return qe.id===((Ue=Ce.current)==null?void 0:Ue.selectedSessionId)}));return K||(ct.current||(ct.current=ut("session.create",{...(L==null?void 0:L.setup)||Ja($e.current.apply(Ce.current)),fromDraft:!0},{id:L==null?void 0:L.id}).catch(qe=>{var Pe,_t;const Ue=(L==null?void 0:L.id)&&((_t=(Pe=Ce.current)==null?void 0:Pe.sessions)==null?void 0:_t.find(yt=>yt.creationCommandId===L.id));if(Ue)return{sessionId:Ue.id};throw qe}).then(qe=>{const Ue={id:qe.sessionId||qe.state.selectedSessionId},Pe=X.current;return at.current&&(Pe==null?void 0:Pe.sessionId)===null&&(Pe.sessionId=Ue.id,$e.current.bindDraft(at.current,Ue.id),clearTimeout(vt.current),xn(Pe,at.current).catch(_t=>m(_a(_t))),Ce.current&&c($e.current.apply(Ce.current))),Ue}).finally(()=>{ct.current=null})),ct.current)}function na(L){var Ie;if(!(L!=null&&L.length)||on||mn)return;const K=((Ie=Ce.current)==null?void 0:Ie.selectedSessionId)??null;le.current++,W(!0),m("");const de=async()=>{try{for(const qe of L)await ut("attachment.add",{sessionId:K,name:qe.name,base64:await KF(qe)})}catch(qe){m(qe.message)}finally{le.current--,W(le.current>0)}};qt.current=qt.current.then(de,de)}async function Ga(L){var K,de,Ie,qe,Ue;if(!M.current.has(L.id)){M.current.add(L.id),ye.update(L.id,{status:"sending",error:""});try{if(!L.sessionId){const _t=await ma(L.creation);L=ye.update(L.id,{sessionId:_t.id})}const Pe=await ut("conversation.send",{sessionId:L.sessionId,text:L.text,...L.replyTo?{replyId:L.replyTo.id}:{},attachmentIds:L.attachmentIds,via:L.via,preserveDraft:!0},{id:L.commandId,feedback:!1});ye.update(L.id,["sending","unknown"].includes(Pe.delivery)?{status:"unknown",error:"Delivery has not been confirmed. Checking again will not run it twice."}:null)}catch(Pe){((qe=(Ie=(de=(K=Ce.current)==null?void 0:K.sessions)==null?void 0:de.find(yt=>yt.id===L.sessionId))==null?void 0:Ie.messages)==null?void 0:qe.some(yt=>{var Lt;return yt.inputId===L.commandId&&((Lt=yt.delivery)==null?void 0:Lt.status)==="accepted"}))&&Pe.code!=="session_busy"?ye.update(L.id,null):ye.update(L.id,{status:((Ue=Pe.receipt)==null?void 0:Ue.delivery)==="failed"||Pe.status>=400&&Pe.status<500&&Pe.status!==408?"failed":"unknown",error:_a(Pe)})}finally{M.current.delete(L.id)}}}function Qa(L){var Ie,qe,Ue,Pe,_t,yt,Lt;const K=ye.current.current.find(un=>{var Sr;return un.id===((Sr=L.localDelivery)==null?void 0:Sr.id)});!K||K.status!=="failed"||M.current.has(K.id)||(Pe=(Ue=(qe=(Ie=Ce.current)==null?void 0:Ie.sessions)==null?void 0:qe.find(un=>un.id===K.sessionId))==null?void 0:Ue.messages)!=null&&Pe.some(un=>un.inputId===K.commandId)||(ye.update(K.id,null),((Lt=(yt=(_t=Ce.current)==null?void 0:_t.view)==null?void 0:yt.messageEdit)==null?void 0:Lt.messageId)===L.id&&ge("view.update",{patch:{messageEdit:null}}))}async function Xa(L,K){const de=ye.current.current.find(Ue=>{var Pe;return Ue.id===(((Pe=L.localDelivery)==null?void 0:Pe.id)||L.id)});if(!de||de.status==="sending"||de.status==="unknown"&&K!==void 0)return;const Ie=de.status==="failed"&&!de.sessionId?{id:crypto.randomUUID(),setup:Ja($e.current.apply(Ce.current))}:de.creation,qe=ye.update(de.id,{creation:Ie,...de.status==="failed"?{commandId:crypto.randomUUID(),...K!==void 0?{text:K}:{}}:{},status:"sending",error:""});K!==void 0&&ge("view.update",{patch:{messageEdit:null}}),await Ga(qe)}async function aa(L){var Pe,_t,yt;if(L==null||L.preventDefault(),Fe.current||!S.trim()&&!Ge.length||le.current||g||he||mn||on)return;pa((Q==null?void 0:Q.id)??null);const K=S,de=crypto.randomUUID(),Ie=Ge;if(!K.trim()&&!Ie.length)return;(Pe=Ye.current)==null||Pe.reveal(),m(""),ta(""),clearTimeout(vt.current);const qe=at.current;let Ue=ye.update(de,{commandId:de,sessionId:(Q==null?void 0:Q.id)??null,...Q?{}:{creation:{id:crypto.randomUUID(),setup:Ja($e.current.apply(Ce.current))}},text:K,...(_t=l.view)!=null&&_t.messageReply?{replyTo:l.view.messageReply}:{},via:En==="text"?"text":"chat",attachmentIds:Ie.map(Lt=>Lt.id),attachments:Ie,status:"sending",createdAt:Date.now()/1e3});try{await xn(X.current,qe);const Lt=Q||await ma(Ue.creation);Ue=ye.update(de,{sessionId:Lt.id}),await Ga(Ue)}catch(Lt){ye.update(de,{status:((yt=Lt.receipt)==null?void 0:yt.delivery)==="failed"||Lt.status>=400&&Lt.status<500&&Lt.status!==408?"failed":"unknown",error:_a(Lt)})}finally{$e.current.settle(qe),at.current===qe&&(at.current=null),Ce.current&&c($e.current.apply(Ce.current))}}async function Cn(L){var qe,Ue,Pe,_t,yt,Lt;if(L.preventDefault(),Ze.current.busy||!N.trim())return;const K=Ze.current.revision,de=(qe=Ce.current)==null?void 0:qe.selectedSessionId,Ie=N;Ze.current.busy=!0,zt(!0),m("");try{await ut("worker.spawn",{sessionId:de,instruction:Ie});const un=(Pe=(Ue=$e.current.apply(Ce.current))==null?void 0:Ue.view)==null?void 0:Pe.workerDraft;Ze.current.revision===K&&((_t=Ce.current)==null?void 0:_t.selectedSessionId)===de&&un===Ie&&(x(""),await ut("view.update",{patch:{workerDraft:"",...((Lt=(yt=Ce.current)==null?void 0:yt.view)==null?void 0:Lt.panel)==="worker"?{panel:null}:{}}}))}catch(un){m(un.message)}finally{Ze.current.busy=!1,zt(!1)}}async function ir(){var L;if(((L=l.voiceConfiguration)==null?void 0:L.available)===!1){await ut("view.update",{patch:{panel:"settings",settingsSection:"setup",settingsExpanded:["voice"]}});return}if(!Je.current){Je.current=!0,ue(!0),m("");try{await ma(),await ut("view.update",{patch:{mode:"call"}}),await ut("call.start",{})}catch(K){m(_a(K))}finally{Je.current=!1,ue(!1)}}}const ha=!["idle","ended","error"].includes(te.status||"idle"),Ra=T?A:((zp=l==null?void 0:l.theme)==null?void 0:zp.css)||"",ln=ve.composition.presentation,Qn=ln.scheme||Yt.scheme,ja=Qn==="system"?"light dark":Qn||"light",cn=QL(Qn);XL({root:ft,state:l,shell:ve,scheme:Qn,mode:cn,preview:T,css:Ra}),Nx(l);const he=!Q&&ye.entries.some(L=>L.sessionId===null&&["sending","unknown"].includes(L.status)),$=pn||((Q==null?void 0:Q.workers)||[]).some(L=>["queued","starting","working","running","stopping"].includes(L.status)),ee=ye.entries.some(L=>L.sessionId===((Q==null?void 0:Q.id)??null)&&L.status==="sending"),pe=$q({draft:S,attachments:Ge,uploading:G,working:pn,responseActive:$,stopping:(Q==null?void 0:Q.status)==="stopping",voiceStatus:te.status,voiceStarting:De,busy:g,newChatPending:he,sending:ee,historyPending:mn,executionUnavailable:on}),Me=JL({enabled:!!l&&ve.ready,blocked:ha||De?"Finish your voice call, then reload.":G||ee||g?"Wait for the current upload or send to finish.":"",prepare:async()=>{var de,Ie,qe;await Promise.all([st.current,et.current,Y.current,qt.current]),await Bl((de=Ce.current)==null?void 0:de.selectedSessionId),clearTimeout(vt.current),at.current&&await xn(X.current,at.current);const L=((Ie=Ce.current)==null?void 0:Ie.selectedSessionId)??null,K=Le.current;if(await ut("view.update",{sessionId:L,patch:{draft:K}}),K!==Le.current||L!==(((qe=Ce.current)==null?void 0:qe.selectedSessionId)??null))throw Error("Your draft changed while saving. Select Reload now again when you’re ready.")}}),Be=_s(l)!=="chat",ot=(L,K=null)=>ge("view.update",{patch:{...Tk(L,K),navExpanded:!1}}),Ft={browse:ot,create:()=>a(!0),newChat:Sn},Gt=Be?{...l,canvas:{...l==null?void 0:l.canvas,open:!1}}:l;return!l||!ve.ready?n.createElement("div",{className:"boot"},n.createElement("img",{src:qc}),n.createElement("h1",null,"Amplifier"),n.createElement("p",null,p||ve.error||"Connecting to your workspace…"),(p||ve.error)&&n.createElement(n.Fragment,null,n.createElement("button",{onClick:()=>{b(L=>L+1),ve.refresh()}},"Retry connection"),n.createElement("p",null,n.createElement("a",{href:"?shell=recovery"},"Open recovery mode")))):n.createElement(zi.Provider,{value:Ft},n.createElement(_g.Provider,{value:ve},n.createElement(Bw.Provider,{value:Me},n.createElement("div",{id:"amp-one",className:"a-chat-shell a-approachable-shell","data-work-surface":_s(l),ref:ft,"data-layout":ln.layout||Yt.layout||"balanced","data-interface-detail":ln.interfaceDetail||ln.executionDetail||"standard","data-execution-detail":ln.interfaceDetail||ln.executionDetail||"standard","data-density":ln.density||"comfortable",style:{colorScheme:ja,...ln.accent?{"--a-accent":ln.accent}:{}},"data-theme-scheme":cn,"data-decorations":ln.decorations===!1?"off":"on","data-part":"app"},Ra&&n.createElement("style",null,Ra),n.createElement("style",null,Jq),n.createElement("style",null,HL),n.createElement(qL,{state:l,session:Q,act:ge,open:sn,narrow:e,presentation:ln}),n.createElement(Hw,null),p&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,p),n.createElement("button",{"aria-label":"Dismiss error",onClick:()=>{m(""),ge("view.update",{patch:{notice:null}})},"data-action":"view.update"},n.createElement(nn,null))),n.createElement(SF,{state:l,session:Q,act:ge}),!((Lp=l.runtime)!=null&&Lp.available)&&n.createElement("div",{className:"a-alert a-runtime"},n.createElement("span",null,n.createElement("strong",null,"Connect Amplifier to get started.")," ",((Dp=l.runtime)==null?void 0:Dp.error)||"The Amplifier runtime is not installed. Install this app with its runtime dependencies, then relaunch."),n.createElement("button",{className:"a-link",onClick:()=>sn("settings"),"data-action":"view.update"},"Setup details ",n.createElement(en,null))),n.createElement(BL,{voice:te,callSession:l.sessions.find(L=>{var K;return L.id===((K=l.voice)==null?void 0:K.sessionId)}),callActive:ha,browsing:Be,working:pn&&!on,session:Q,act:ge,onReturn:()=>ot("chat")},n.createElement(yq,{sessionId:Q==null?void 0:Q.id,visual:me,client:Z,dispatch:ut,onError:L=>m(L.message)})),n.createElement(_L,{state:Gt,act:ge,presentation:ln},n.createElement(OL,{footer:n.createElement(FL,{state:l,act:ge,connected:h,open:sn}),shell:ve,state:l,session:Q,act:ge,selectSession:L=>{ze.current=!0,ge("session.select",{id:L})},newSession:Sn}),n.createElement("section",{className:`a-conversation ${wn.length||mn||Q!=null&&Q.historyError||on?"has-messages":"is-empty"}`,"data-part":"conversation","aria-label":"Shared conversation"},Be&&n.createElement($L,{shell:ve,state:l,act:ge}),n.createElement(WF,{session:Q,focus:(Fp=l.view)==null?void 0:Fp.messageFocus,detail:Kt}),n.createElement("div",{className:"a-messages",ref:xe,"data-part":"messages","data-view-source":Q?"conversation":void 0,role:"log","aria-label":"Conversation messages","aria-live":"polite","aria-busy":!!(Q!=null&&Q.historyLoading)},n.createElement("div",{className:"a-session-history"},Kt.controls),n.createElement(ML,{session:((qp=Q==null?void 0:Q.messageWindow)==null?void 0:qp.offset)>0?{...Q,sharedHistoryOffset:0}:Q,act:ge,onLoadEarlier:()=>{ze.current=!1}}),(Q==null?void 0:Q.parentId)&&n.createElement("div",{className:"a-chat-origin"},n.createElement(Wa,null),n.createElement("span",null,ho(Q)?Q.editOrigin?"Continued from an edited message":"Forked conversation":"Subagent conversation"),n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",disabled:!l.sessions.some(L=>L.id===Q.parentId),onClick:()=>ge("session.select",{id:Q.parentId})},ho(Q)?"Open original chat":"Open parent chat")),kn.before.map(L=>n.createElement(ng,{key:L,data:V,turnId:L,state:l,act:ge})),!Q&&n.createElement(Wx,{state:l,act:ge})," ",wn.length===0&&!mn&&!(Q!=null&&Q.historyError)&&!on?Q&&n.createElement("div",{className:"a-empty"},n.createElement("img",{src:qc,alt:""}),n.createElement("h2",null,"What shall we work on?"),n.createElement("p",null,"Bring an idea, a question, or a file.")):QF(wn,kn.after).map(L=>Array.isArray(L)?n.createElement(XF,{key:L[0].id,messages:L,session:Q||{id:null},state:l,act:ge,renderArtifacts:K=>n.createElement(Em,{state:l,message:K,act:ge})}):n.createElement(n.Fragment,{key:L.id},n.createElement(gk,{message:L,session:Q||{id:null},state:l,act:ge,stamp:Kq,working:pn,forkTurn:Dt.get(L.id),retry:Xa,discard:Qa,dispatch:ut}),(kn.after.get(L.id)||[]).map(K=>n.createElement(ng,{key:K,data:V,turnId:K,state:l,act:ge})),n.createElement(Em,{state:l,message:L,act:ge}))),(Q==null?void 0:Q.streaming)&&n.createElement("article",{className:"a-message a-assistant"},n.createElement("div",{className:"a-msg-meta"},n.createElement("strong",null,"Amplifier"),n.createElement("span",null,"Working…")),n.createElement(ml,{text:Q.streaming})),n.createElement("div",{ref:Et})),mt&&n.createElement("div",{className:"a-live-activity","data-part":"activity","data-view-source":"activity",role:"status","aria-live":"polite"},n.createElement("span",{className:"a-activity-pulse","aria-hidden":"true"},n.createElement("b",null),n.createElement("b",null),n.createElement("b",null)),n.createElement("div",null,n.createElement("strong",null,mt.label),(mt.toolLabels.length>0||mt.lastTool||mt.workerCount>0)&&n.createElement("small",null,mt.toolLabels.join(" · "),mt.lastTool&&`Last tool: ${mt.lastTool}`,mt.workerCount>0&&mt.phase!=="workers"?`${mt.toolLabels.length||mt.lastTool?" · ":""}${mt.workerCount} active ${mt.workerCount===1?"worker":"workers"}`:"")),mt.elapsed&&n.createElement("span",{className:"a-activity-elapsed",role:"timer","aria-live":"off","aria-label":`Elapsed ${mt.elapsed}`},mt.elapsed)),!!((Up=Q==null?void 0:Q.approvals)!=null&&Up.filter(L=>L.status==="pending"||!L.status).length)&&n.createElement("section",{className:"a-card a-approvals","data-part":"approvals"},n.createElement("div",{className:"a-card-header"},n.createElement("h2",null,"Needs your attention")),Q.approvals.filter(L=>L.status==="pending"||!L.status).map(L=>n.createElement("div",{key:L.id,"data-approval-id":L.id},n.createElement("strong",null,L.title||L.tool||"Approval requested"),n.createElement("p",null,L.prompt||L.message||L.description),L.details&&n.createElement("pre",null,typeof L.details=="string"?L.details:Uc(L.details)),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"approval.respond",onClick:()=>ge("approval.respond",{id:L.id,decision:"approve"})},n.createElement(Pt,null),"Allow"),n.createElement("button",{className:"a-soft","data-action":"approval.respond",onClick:()=>ge("approval.respond",{id:L.id,decision:"deny"})},"Deny"))))),n.createElement(Hq,{session:Q,dispatch:ut}),n.createElement("form",{className:`a-composer ${D?"drag-over":""}`,"data-part":"composer","data-action":"conversation.send",onSubmit:aa,onDragOver:L=>{L.dataTransfer.types.includes("Files")&&(L.preventDefault(),on||ne(!0))},onDragLeave:L=>{L.currentTarget.contains(L.relatedTarget)||ne(!1)},onDrop:L=>{L.dataTransfer.files.length&&(L.preventDefault(),ne(!1),na([...L.dataTransfer.files]))},onPaste:L=>{if(on){L.preventDefault();return}const K=[...L.clipboardData.items].filter(de=>de.kind==="file").map(de=>de.getAsFile()).filter(Boolean);if(K.length){L.preventDefault();const de=L.clipboardData.getData("text/plain");if(de){const Ie=bt.current,qe=(Ie==null?void 0:Ie.selectionStart)??S.length,Ue=(Ie==null?void 0:Ie.selectionEnd)??qe;ta(S.slice(0,qe)+de+S.slice(Ue))}na(K)}}},ye.storageError&&ye.entries.length>0&&n.createElement("p",{role:"alert",className:"a-upload-status"},"This browser could not save the pending message. Keep this tab open until delivery is confirmed."),n.createElement(Bq,{session:Q,runtimeAvailable:((jp=l.runtime)==null?void 0:jp.available)!==!1,dispatch:ut},!Q&&n.createElement(LL,{state:l,act:ge}),n.createElement(fk,{items:Ge,remove:L=>ge("attachment.remove",{sessionId:(Q==null?void 0:Q.id)??null,id:L})}),G&&n.createElement("p",{role:"status",className:"a-upload-status"},"Uploading attachments…"),D&&n.createElement("p",{className:"a-upload-status"},"Drop files or images to attach"),n.createElement(HF,{quote:($p=l.view)==null?void 0:$p.messageReply,sessionId:Q==null?void 0:Q.id,dispatch:ut}),n.createElement("textarea",{ref:bt,rows:1,disabled:on,readOnly:je,"aria-busy":je,value:S,onChange:L=>ta(L.target.value),"data-action":"view.update","aria-label":"Message Amplifier",placeholder:"Ask Amplifier anything…",onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&!L.nativeEvent.isComposing&&(L.preventDefault(),aa())}}),n.createElement("div",{className:"a-compose-bottom"},ee&&n.createElement("span",{role:"status",className:"a-caption"},"Sending message…"),n.createElement("div",{className:"a-compose-tools"},n.createElement("input",{ref:fe,type:"file",multiple:!0,className:"a-file-input","aria-label":"Attach files","data-action":"attachment.add",onChange:L=>{na([...L.target.files]),L.target.value=""}}),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Add attachments",title:"Attach files or images · up to 32 MB each",disabled:G||on||mn,"data-action":"attachment.add",onClick:()=>fe.current.click()},n.createElement(Ln,null)),n.createElement(Ur,{name:"composer.actions"},n.createElement(JF,{state:l,session:Q,act:ge,ensureSession:ma,working:pn}),n.createElement(tk,{compact:!0,state:l,session:Q,act:ge,working:pn}),Q&&n.createElement("button",{type:"button",className:"a-icon a-composer-controls","aria-label":"Chat controls","data-action":"view.update",disabled:on||mn,onClick:()=>sn("runtime")},n.createElement(tl,null)))),n.createElement("button",{type:pe.action==="conversation.send"?"submit":"button",className:"a-send","data-part":"composer-primary-action","data-action":pe.action,"aria-label":pe.action==="call.start"&&((Bp=l.voiceConfiguration)==null?void 0:Bp.available)===!1?"Set up voice":pe.label,title:pe.action==="call.start"&&((Hp=l.voiceConfiguration)==null?void 0:Hp.available)===!1?"Set up voice in Settings":pe.label,disabled:pe.disabled||je&&pe.action==="conversation.send",onClick:pe.action==="call.start"?ir:pe.action==="call.end"?()=>ge("call.end"):pe.action==="conversation.stop"?()=>ge("conversation.stop",{sessionId:Q.id}):void 0},pe.icon==="voice"?n.createElement(zu,null):pe.icon==="cancel"?n.createElement(nn,null):n.createElement(Li,null)))))),n.createElement(fL,{scheme:Qn},n.createElement(zL,{suppressed:Be,state:l,act:ge,dispatch:ut}))),t&&n.createElement(DL,{state:l,act:ge,onClose:()=>a(!1)}),n.createElement(Iq,{state:l,act:ge}),pt&&n.createElement("div",{className:`a-overlay ${pt==="settings"||pt==="appearance"?"a-settings-overlay a-settings-redesign-overlay":""}`,"data-part":"overlay",onPointerDown:L=>{o.current=L.target===L.currentTarget},onClick:L=>{o.current&&L.target===L.currentTarget&&Na()}},n.createElement("section",{role:"dialog","aria-modal":"true","aria-labelledby":"panel-title",className:`a-dialog ${pt==="appearance"||pt==="agent"||pt==="runtime"||pt==="settings"?"wide":""}`,"data-part":"dialog"},n.createElement("div",{className:"a-dialog-head"},n.createElement("h2",{id:"panel-title"},{appearance:"Settings",agent:"What the agent sees",settings:"Settings",activity:"Ready for you",feedback:"Send feedback",worker:"Give it a worker lane","delete-session":"Delete chat?",runtime:"Chat controls","session-details":"Chat details","subagent-history":"Subagent history",coordination:"Tasks and workers"}[pt]||pt),n.createElement("button",{className:"a-icon","data-action":"view.update","aria-label":"Close panel",onClick:Na},n.createElement(nn,null))),p&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,p),n.createElement("button",{type:"button","aria-label":"Dismiss error",onClick:()=>m("")},n.createElement(nn,null))),pt==="session-details"&&Q&&n.createElement(n.Fragment,null,n.createElement(uk,{key:Q.id,session:Q,act:ut}),n.createElement("h3",null,"Export chat"),n.createElement(dk,{session:Q,state:l,act:ge}),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Mg,{state:l,session:Q,act:ge}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>sn("coordination")},n.createElement(Wa,null),"Tasks and workers"),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>sn("worker")},n.createElement(Wa,null),"Delegate work"))),pt==="coordination"&&n.createElement(nq,{dispatch:ut}),pt==="subagent-history"&&n.createElement(uS,{state:l,session:Q,act:ge}),pt==="activity"&&n.createElement(Ix,{state:l,act:ge}),pt==="feedback"&&n.createElement(Tq,{state:l,act:ut}),pt==="runtime"&&n.createElement(lk,{state:l,session:Q,act:ge,computerControls:n.createElement(bq,{sessionId:Q==null?void 0:Q.id,visual:me,client:Z,dispatch:ut,onError:L=>m(L.message||String(L))})}),pt==="worker"&&n.createElement("form",{"data-action":"worker.spawn",onSubmit:Cn},n.createElement("p",null,"Tell the worker what to investigate or build. Results return to this conversation."),n.createElement("label",{htmlFor:"worker-instruction"},"Work to delegate"),n.createElement("textarea",{id:"worker-instruction",value:N,"data-action":"view.update",onChange:L=>{Ze.current.revision++,x(L.target.value),ge("view.update",{patch:{workerDraft:L.target.value}})},placeholder:"Review the project and propose a focused implementation plan…"}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:it||!N.trim()},n.createElement(Wa,null),it?"Starting…":"Start worker"))),pt==="agent"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Every app control uses the same action interface. The agent can read the selected conversation, worker lanes, drafts, open panels, and the controls currently on screen."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",null,"Current state"),n.createElement("pre",{className:"a-state-view"},Uc({...l,devices:Object.fromEntries(Object.entries(l.devices||{}).map(([L,K])=>{var de,Ie;return[L,{clientId:K.clientId,viewport:K.viewport,controls:(de=K.controls)==null?void 0:de.length,visibleTextLength:(Ie=K.visibleText)==null?void 0:Ie.length,voice:K.voice,notificationPermission:K.notificationPermission}]})),deviceCommands:(l.deviceCommands||[]).map(({id:L,type:K,origin:de,createdAt:Ie})=>({id:L,type:K,origin:de,createdAt:Ie})),theme:{name:(Vp=l.theme)==null?void 0:Vp.name,css:`${((Zp=(Wp=l.theme)==null?void 0:Wp.css)==null?void 0:Zp.length)||0} characters`},view:{...Yt,themeDraft:Yt.themeDraft?`${Yt.themeDraft.length} characters`:void 0}}))),n.createElement("div",null,n.createElement("label",null,"Visible controls"),n.createElement("pre",{className:"a-state-view"},Uc((Jp=jl(ft.current,Ha).controls)==null?void 0:Jp.map(L=>({label:L.label,action:L.action,disabled:L.disabled})))))),n.createElement("label",{htmlFor:"agent-action"},"Run an app action"),n.createElement("select",{id:"agent-action",value:F,"data-action":"view.update",onChange:L=>{z(L.target.value),ge("view.update",{patch:{agentAction:L.target.value}})}},u.map(L=>n.createElement("option",{key:L.name||L.action,value:L.name||L.action},L.name||L.action))),n.createElement("label",{htmlFor:"agent-args"},"Arguments (JSON)"),n.createElement("textarea",{id:"agent-args",className:"a-css-editor",style:{minHeight:100},value:U,"data-action":"view.update",onChange:L=>{H(L.target.value),ge("view.update",{patch:{agentArgs:L.target.value}})}}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":F,onClick:()=>{try{ge(F,JSON.parse(U))}catch(L){m(_a(L))}}},"Run action"),n.createElement("button",{className:"a-soft","data-action":"state.export",onClick:()=>ge("state.export")},n.createElement(wa,null),"Export app state")),n.createElement("p",{className:"a-caption"},"Also available to integrations as window.amplifier.getState(), getActions(), and dispatch().")),pt==="delete-session"&&n.createElement(Tg,{key:Q==null?void 0:Q.id,id:Q==null?void 0:Q.id,act:ut,cancel:Na}),(pt==="settings"||pt==="appearance")&&n.createElement(FF,{state:l,session:Q,act:ge,dispatch:ut,open:sn,close:Ca,navigationRef:s,appearance:n.createElement(aD,{state:l,shell:ve,act:ut,name:O,css:A,preview:T,setName:k,setCss:C,setPreview:I,defaultSkin:Fc})})))))))}Rk.createRoot(document.getElementById("root")).render(n.createElement(Yq,null));export{zg as _,t1 as p}; +`,qc="/branding/icons/amplifier-icon-128.png",Uc=e=>JSON.stringify(e,null,2),Kq=e=>{try{return new Date(typeof e=="number"&&e<1e12?e*1e3:e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{return""}};function Yq(){var Un,jn,Yr,Pn,qo,Dl,Tp,Ip,Ap,_p,Pp,Op,Mp,zp,Lp,Dp,Fp,qp,Up,jp,$p,Bp,Hp,Vp,Wp,Zp,Jp;const e=Bu(),[t,a]=v.useState(!1),r=v.useRef(Vq()),o=v.useRef(!1),i=v.useRef(null),s=v.useRef(null),[l,c]=v.useState(null),[u,d]=v.useState([]),[p,m]=v.useState(""),[h,f]=v.useState(!1),[g,E]=v.useState(!1),[y,b]=v.useState(0),[S,w]=v.useState(""),[N,x]=v.useState(""),[A,C]=v.useState(Fc),[O,k]=v.useState("Amplifier Unified"),[T,I]=v.useState(!1),[F,z]=v.useState("view.update"),[q,W]=v.useState('{"patch":{"mode":"chat"}}'),[X,U]=v.useState({status:"idle"}),[_,P]=v.useState(Date.now()),[G,Z]=v.useState(!1),[D,ne]=v.useState(!1),H=v.useRef(null),j=v.useRef(null),[ie,Ee]=v.useState({status:"idle"}),[me,_e]=v.useState({status:"idle"}),Je=v.useRef(!1),[De,ue]=v.useState(!1),ye=jF(),M=v.useRef(new Set),Y=v.useRef(Promise.resolve()),se=v.useRef(new WeakMap),Fe=v.useRef(!1),[je,oe]=v.useState(!1),Ze=v.useRef({busy:!1,revision:0}),[it,zt]=v.useState(!1),ct=v.useRef(null),qt=v.useRef(Promise.resolve()),le=v.useRef(0),fe=v.useRef(null),xe=v.useRef(null),ze=v.useRef(!0),Ye=v.useRef(null),ht=v.useRef(null),bt=v.useRef(null),ft=v.useRef(null),Ce=v.useRef(null),gt=v.useRef(null),Et=v.useRef(null),vt=v.useRef(),at=v.useRef(null),ee=v.useRef(null),Re=v.useRef(new Set),ae=v.useRef(null),Le=v.useRef(""),Oe=v.useRef(Promise.resolve()),et=v.useRef(Promise.resolve()),st=v.useRef(Promise.resolve()),It=v.useRef(null),xt=v.useRef(Promise.resolve()),Ut=v.useRef(new Set),rt=v.useRef(new Set),Xe=v.useRef(()=>{}),$e=v.useRef(aq()),Nt=v.useRef(null),Zt=v.useRef(uq()),rn=v.useCallback(L=>{for(const K of L||[])K.id&&rt.current.has(K.id)||(K.id&&rt.current.add(K.id),!(K.createdAt&&Date.now()-new Date(typeof K.createdAt=="number"&&K.createdAt<1e12?K.createdAt*1e3:K.createdAt).getTime()>6e4)&&Promise.resolve().then(async()=>{var de,Ie,qe,Ue;if(K.type==="download"&&gm(K.filename||"amplifier-export.json",K.content??K.data,K.mimeType||K.mime||"application/json"),K.type==="conversation.export"&&await pq(K,{request:St,download:gm,clipboard:navigator.clipboard}),K.type==="message.copy"){let Pe="ready",_t="Copied Markdown";try{await navigator.clipboard.writeText(await dq(Ce.current,K,St))}catch(yt){Pe="error",_t="Could not copy: "+yt.message}await St("/api/actions",{method:"POST",body:{action:"message.copyResult",args:{requestId:K.requestId,status:Pe,message:_t}}})}if(K.type==="download.url"){const Pe=document.createElement("a");Pe.href=K.url,Pe.download=K.filename,Pe.click()}if(K.type==="browser.open"&&window.open(K.url,"_blank","noopener,noreferrer"),["clipboard.write","clipboard.url"].includes(K.type))try{let Pe=K.content;if(K.type==="clipboard.url"){const _t=await fetch(K.url);if(!_t.ok)throw Error("Source unavailable");Pe=await _t.text()}await navigator.clipboard.writeText(Pe),await St("/api/actions",{method:"POST",body:{action:"canvas.report",args:{id:K.canvasId,part:"clipboard",status:"ready",message:"Source copied"}}})}catch(Pe){throw await St("/api/actions",{method:"POST",body:{action:"canvas.report",args:{id:K.canvasId,part:"clipboard",status:"error",message:"Clipboard unavailable: "+Pe.message}}}),Pe}if(K.type==="call.start")try{await gt.current.start(K.args||{})}catch(Pe){throw await St("/api/voice/end",{method:"POST",body:{id:null}}).catch(()=>{}),Pe}if(K.type==="canvas.checkpoint"&&await Bl(K.sessionId,K.id),K.type==="voice.visual.capture"&&await((de=H.current)==null?void 0:de.capture(K)),K.type==="computer.visual.capture"&&await((Ie=j.current)==null?void 0:Ie.capture(K)),K.type==="call.end"&&await gt.current.end(),K.type==="call.resumeAudio"&>.current.callAudio.resumePlayback(),K.type==="call.keepAwake"&>.current.setKeepAwake(K.enabled??((qe=K.args)==null?void 0:qe.enabled)??!0),K.type==="call.mute"&>.current.setMuted(K.muted??((Ue=K.args)==null?void 0:Ue.muted)??!0),["notification.request","notification-permission"].includes(K.type)&&"Notification"in window){const Pe=await Notification.requestPermission();await St("/api/view",{method:"POST",body:{clientId:Ha,notificationPermission:Pe}})}}).catch(de=>m(_a(de))))},[]);Xe.current=rn;const In=v.useRef(new Set),yn=v.useRef(null),Fn=v.useRef(sq()),Gn=v.useRef(Promise.resolve()),An=v.useRef(new WeakSet),Jt=v.useCallback(L=>{var Ie,qe,Ue,Pe,_t;if(!L||typeof L!="object"||Nt.current&&((Ie=L.client)==null?void 0:Ie.hostInstanceId)===((qe=Nt.current.client)==null?void 0:qe.hostInstanceId)&&L.revisionyt.id===Ce.current.selectedSessionId),de=(_t=L.sessions)==null?void 0:_t.find(yt=>yt.id===L.selectedSessionId);if((K==null?void 0:K.id)===(de==null?void 0:de.id)&&Number(de==null?void 0:de.sharedHistoryOffset)Sr.getBoundingClientRect().bottom>Lt);un&&(ht.current={sessionId:de.id,messageId:un.dataset.messageId,top:un.getBoundingClientRect().top},ze.current=!1)}Nt.current=L,Zt.current.remember(L);for(const yt of In.current)yt(L);Ce.current=Zt.current.apply(L),c($e.current.apply(Ce.current)),Ut.current.forEach(yt=>yt($e.current.apply(Ce.current)))},[]),dn=v.useCallback(L=>{if(L.stateRevision===void 0)return Promise.resolve();const K=de=>{var Ie;return((Ie=de==null?void 0:de.client)==null?void 0:Ie.hostInstanceId)===L.hostInstanceId&&de.revision>=L.stateRevision};return K(Nt.current)?Promise.resolve():new Promise((de,Ie)=>{const qe=()=>{clearTimeout(Pe),In.current.delete(Ue),de()},Ue=_t=>{K(_t)&&qe()},Pe=setTimeout(()=>{In.current.delete(Ue),yn.current||(yn.current=St("/api/state").then(Jt).finally(()=>{yn.current=null})),yn.current.then(de,Ie)},1500);In.current.add(Ue)})},[Jt]),ut=v.useCallback((L,K={},de={})=>{var Gp,Qp,Xp,em,tm,nm,am,rm;if(L==="call.resumeAudio"&&((Gp=gt.current)==null||Gp.callAudio.resumePlayback()),(L==="message.reply"||L==="canvas.reference"||L==="canvas.views.command"&&K.action==="canvas.reference")&&!de.referencePrepared){if(Fe.current)return Promise.reject(Error("A reference is already being added."));const Qt=$e.current.apply(Ce.current),jo=Qt==null?void 0:Qt.selectedSessionId,Sk=((Qp=Qt==null?void 0:Qt.view)==null?void 0:Qp.draft)||"",Fl=L==="canvas.views.command"?K.args:K;Fe.current=!0,oe(!0),clearTimeout(vt.current);const om=ee.current,im=at.current;return(async()=>{var lm;if(im&&om&&await xn(om,im),((lm=Ce.current)==null?void 0:lm.selectedSessionId)!==jo)throw Error("The conversation changed. Your draft was kept; select the text again.");const sm={...Fl,sessionId:Fl.sessionId??jo,...L==="message.reply"?{}:{expectedDraft:Fl.expectedDraft??Sk}};return await ut(L,L==="canvas.views.command"?{...K,args:sm}:sm,{...de,referencePrepared:!0})})().finally(()=>{Fe.current=!1,oe(!1)})}if(["conversation.send","conversation.stop","worker.spawn","worker.stop","worker.steer","approval.respond","attachment.add","attachment.remove"].includes(L)&&(K={sessionId:(Xp=Ce.current)==null?void 0:Xp.selectedSessionId,...K}),L==="conversation.send"&&!de.checkpointed)return Bl(K.sessionId).then(()=>ut(L,K,{...de,checkpointed:!0}));L==="view.update"&&Object.hasOwn(K.patch||{},"draft")&&(K={sessionId:(em=Ce.current)==null?void 0:em.selectedSessionId,...K});const qe=L==="session.select"?K.id:L==="shell.command"&&K.action==="session.select"?(tm=K.args)==null?void 0:tm.id:null,Ue=qe&&!It.current?Zt.current.begin($e.current.apply(Ce.current),qe):null;Ue&&Nt.current&&(Ce.current=Zt.current.apply(Nt.current),c($e.current.apply(Ce.current))),L==="canvas.visibility"&&(K={sessionId:((nm=Ce.current)==null?void 0:nm.selectedSessionId)??null,canvasId:((rm=(am=Ce.current)==null?void 0:am.canvas)==null?void 0:rm.id)??null,...K});const Pe=L==="canvas.visibility"?$e.current.addCanvas(Ce.current,K.open):L==="view.update"?de.pendingViewToken??$e.current.add(K.patch||{},K.sessionId):null;Pe&&Ce.current&&c($e.current.apply(Ce.current));const _t=VL(),yt=de.feedback===!1?()=>{}:r.current.begin(L==="shell.command"?K.action:L),Lt=It.current,un=async()=>{Sr&&Lt&&await Lt;const Qt=await St("/api/actions",{signal:de.signal,method:"POST",body:{action:L,args:K,id:de.id||crypto.randomUUID(),...de.expectedRevision!==void 0?{expectedRevision:de.expectedRevision}:{}}});return Qt.state?Jt(Qt.state):await dn(Qt),Qt},Sr=["session.select","session.draft","workspace.select"].includes(L)||L==="shell.command"&&["session.select","session.draft","workspace.select"].includes(K.action),xk=L==="attention.read"&&Array.isArray(K.ids)&&K.ids.length>0&&K.ids.every(Qt=>{var jo;return typeof((jo=K.fingerprints)==null?void 0:jo[Qt])=="string"}),Kp=oq(L,de),Yp=L.startsWith("coordination.")||de.presentation?{current:Promise.resolve()}:L==="canvas.visibility"?Oe:Sr?st:xk?xt:["conversation.send","message.edit","question.answer"].includes(L)?Y:Kp?Gn:et,Uo=Fn.current(Yp,un,iq(L,K,de),Kp?et.current:null).then(Qt=>(Pe&&$e.current.settle(Pe),Ue&&Zt.current.settle(Ue),Pe&&Ce.current&&c($e.current.apply(Ce.current)),An.current.has(Qt)||(An.current.add(Qt),rn(Qt.effects)),Qt)).catch(Qt=>{throw Ue&&(Zt.current.settle(Ue),Nt.current&&(Ce.current=Zt.current.apply(Nt.current),c($e.current.apply(Ce.current)))),Qt.state&&Jt(Qt.state),Pe&&($e.current.settle(Pe),Ce.current&&c($e.current.apply(Ce.current))),Qt}).finally(()=>{_t(),yt()});if(Yp.current=Uo.catch(()=>{}),L==="canvas.views.dirty"){It.current=Uo;const Qt=()=>{It.current===Uo&&(It.current=null)};Uo.then(Qt,Qt)}return Uo},[Jt,rn,dn]);v.useEffect(()=>{var L,K;for(const de of ye.entries){if(de.sessionId||!((L=de.creation)!=null&&L.id))continue;const Ie=(K=l==null?void 0:l.sessions)==null?void 0:K.find(qe=>qe.creationCommandId===de.creation.id);Ie&&ye.update(de.id,{sessionId:Ie.id})}},[l==null?void 0:l.sessions,ye.entries]);const ve=Xx(Nt.current,ut,Ha);v.useEffect(()=>ft.current?r.current.attach(ft.current):void 0,[!!l,ve.ready]);const ge=v.useCallback((L,K={})=>ut(L,K).catch(de=>m(_a(de))),[ut]),At=v.useRef(null);At.current||(At.current=cq(L=>St("/api/view",{method:"POST",body:L})));const Ot=v.useCallback(()=>{var L;Ce.current&&!document.hidden&&At.current({...jl(ft.current,Ha,{interfaceOnly:!0}),sessionId:Ce.current.selectedSessionId??null,voice:(L=gt.current)==null?void 0:L.state,notificationPermission:"Notification"in window?Notification.permission:"unsupported"})},[]);v.useEffect(()=>{let L=!0,K;const de=new AbortController;m("");const Ie=setTimeout(()=>{de.abort(),L&&!Ce.current&&m("The workspace is taking too long to respond. You can retry the connection.")},1e4);return Zx(de.signal).then(()=>{if(!L)return;St("/api/state",{signal:de.signal}).then(Ue=>{L&&(Jt(Ue.state||Ue),f(!0))}).catch(Ue=>{L&&Ue.name!=="AbortError"&&!Ce.current&&m(_a(Ue))}).finally(()=>clearTimeout(Ie)),St("/api/actions",{signal:de.signal}).then(Ue=>{L&&d(Array.isArray(Ue)?Ue:Ue.actions||[])}).catch(()=>{});let qe;ti("connecting"),K=new EventSource($i("/api/events?transport=delta-v1")),K.addEventListener("state",Ue=>{if(L)try{const Pe=!Ce.current;qe=JSON.parse(Ue.data),Jt(qe),f(!0),Pe&&m(""),clearTimeout(Ie)}catch{}}),K.addEventListener("state-delta",Ue=>{if(L)try{qe=lq(qe,JSON.parse(Ue.data)),Jt(qe),f(!0)}catch{K.close(),ti("closed"),f(!1),b(Pe=>Pe+1)}}),K.addEventListener("shell",Ue=>{try{window.dispatchEvent(new CustomEvent("amplifier-shell",{detail:JSON.parse(Ue.data)}))}catch{}}),K.onopen=()=>{ti("open"),f(!0),At.current.invalidate(),Ot(),window.dispatchEvent(new Event("amplifier-reconnected"))},K.onerror=()=>{ti(K.readyState===2?"closed":"reconnecting"),f(!1)}}).catch(qe=>{clearTimeout(Ie),L&&qe.name!=="AbortError"&&m(_a(qe))}),()=>{L=!1,clearTimeout(Ie),de.abort(),K==null||K.close(),ti("closed")}},[Jt,y]),v.useEffect(()=>(window.amplifier=Object.freeze({shellClientId:Ha,getShellState:()=>ve.data,getState:()=>({...$e.current.apply(Ce.current),renderedView:jl(ft.current,Ha)}),getActions:()=>u,dispatch:ut,subscribe:L=>(Ut.current.add(L),()=>Ut.current.delete(L))}),()=>{delete window.amplifier}),[u,ut,ve.data]),v.useEffect(()=>{const L=ft.current;if(!L)return;const K=()=>Jx(L),de=new MutationObserver(K);return K(),de.observe(L,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>de.disconnect()},[!!l,ve.ready]),v.useEffect(()=>{const L=setTimeout(Ot,300);return()=>clearTimeout(L)},[l,S,A,T,X,Ot,ve.data]),v.useEffect(()=>{let L;const K=()=>{clearTimeout(L),L=setTimeout(Ot,200)};return document.addEventListener("visibilitychange",K),document.addEventListener("selectionchange",K),document.addEventListener("focusin",K),document.addEventListener("input",K),window.addEventListener("resize",K),()=>{clearTimeout(L),document.removeEventListener("visibilitychange",K),document.removeEventListener("selectionchange",K),document.removeEventListener("focusin",K),document.removeEventListener("input",K),window.removeEventListener("resize",K)}},[Ot]),v.useEffect(()=>{var K;if(!l)return;const L=((K=l.view)==null?void 0:K.draft)||"";L!==Le.current&&(w(L),Le.current=L)},[(Un=l==null?void 0:l.view)==null?void 0:Un.draft,l==null?void 0:l.selectedSessionId]),v.useEffect(()=>{var K,de,Ie,qe;if(!l)return;const L=((K=l.theme)==null?void 0:K.name)+"::"+((de=l.theme)==null?void 0:de.css);L!==ae.current&&(C(((Ie=l.theme)==null?void 0:Ie.css)||Fc),k(((qe=l.theme)==null?void 0:qe.name)||"Amplifier Unified"),I(!1),ae.current=L)},[l==null?void 0:l.theme]),v.useEffect(()=>{const L=l==null?void 0:l.view;L&&(L.workerDraft!==void 0&&x(L.workerDraft),L.themeDraft!==void 0&&C(L.themeDraft),L.themeDraftName!==void 0&&k(L.themeDraftName),L.themePreview!==void 0&&I(L.themePreview),L.agentAction!==void 0&&z(L.agentAction),L.agentArgs!==void 0&&W(L.agentArgs))},[(jn=l==null?void 0:l.view)==null?void 0:jn.workerDraft,(Yr=l==null?void 0:l.view)==null?void 0:Yr.themeDraft,(Pn=l==null?void 0:l.view)==null?void 0:Pn.themeDraftName,(qo=l==null?void 0:l.view)==null?void 0:qo.themePreview,(Dl=l==null?void 0:l.view)==null?void 0:Dl.agentAction,(Tp=l==null?void 0:l.view)==null?void 0:Tp.agentArgs]);const Kt=$F((Ip=l==null?void 0:l.sessions)==null?void 0:Ip.find(L=>L.id===l.selectedSessionId),()=>{ze.current=!1;const L=xe.current;if(!L)return;const K=L.getBoundingClientRect().top,de=[...L.querySelectorAll("[data-message-id]")].find(Ie=>Ie.getBoundingClientRect().bottom>K);de&&(ht.current={sessionId:l.selectedSessionId,messageId:de.dataset.messageId,top:de.getBoundingClientRect().top})}),Q=Kt.session,Yt=(l==null?void 0:l.view)||{},En=Yt.mode||"chat",qn=Fw(Q),pn=qn.busy,wn=UF((Q==null?void 0:Q.messages)||[],ye.entries,Q==null?void 0:Q.id),mn=(Q==null?void 0:Q.historyLoaded)===!1||!!(Q!=null&&Q.historyLoading)&&!wn.length,_n=Ml(Q),on=(Q==null?void 0:Q.workspaceAvailable)===!1||!!(Q!=null&&Q.historyReadOnlyReason)||_n.blocked,pt=dD(Yt.panel,s,L=>ge("view.update",{patch:{panel:L}}));v.useEffect(()=>{var K;const L=(K=Q==null?void 0:Q.title)==null?void 0:K.trim();document.title=L?L+" - Amplifier":"Amplifier"},[Q==null?void 0:Q.id,Q==null?void 0:Q.title]),_x(l,ge,xe,ve.ready);const mt=uF(Q,_),V=bF(wn,dF(Q)),ke=v.useRef(null);v.useEffect(()=>{var K,de,Ie;if(Q!=null&&Q.historyManaged)return;const L=(Q==null?void 0:Q.workspace)||((K=l==null?void 0:l.settings)==null?void 0:K.workspace);!L||ke.current===L||(ke.current=L,(((de=l.setup)==null?void 0:de.providersWorkspace)!==L||!((Ie=l.setup)!=null&&Ie.providersLoadedAt))&&ge("providers.list",Q?{sessionId:Q.id}:{}))},[Q==null?void 0:Q.workspace,Q==null?void 0:Q.historyManaged,(Ap=l==null?void 0:l.settings)==null?void 0:Ap.workspace]);const Ge=((Q==null?void 0:Q.draftAttachments)||(l==null?void 0:l.draftAttachments)||[]).filter(L=>!ye.entries.some(K=>K.sessionId===(Q==null?void 0:Q.id)&&K.attachmentIds.includes(L.id)));v.useEffect(()=>{var L,K,de,Ie;for(const qe of ye.entries){const Ue=(de=(K=(L=l==null?void 0:l.sessions)==null?void 0:L.find(Pe=>Pe.id===qe.sessionId))==null?void 0:K.messages)==null?void 0:de.find(Pe=>Pe.inputId===qe.commandId);((Ie=Ue==null?void 0:Ue.delivery)==null?void 0:Ie.status)==="accepted"&&ye.update(qe.id,null)}},[l]);const Dt=GF(Q),kn=pF(wn,V);v.useEffect(()=>{if(!mt)return;const L=setInterval(()=>P(Date.now()),1e3);return()=>clearInterval(L)},[!!mt,Q==null?void 0:Q.id]),v.useLayoutEffect(()=>{if(!xe.current)return;const L=Wq(xe.current,ze);return Ye.current=L,()=>{L.dispose(),Ye.current=null}},[!!l,ve.ready]),v.useLayoutEffect(()=>{var L;(L=Ye.current)==null||L.reveal()},[Q==null?void 0:Q.id,ve.ready]),v.useEffect(()=>{const L=xe.current;if(!(!L||!Q))return Zq(L,()=>{var K;return!Kt.busy&&!Q.historyLoading&&(((K=Q.messageWindow)==null?void 0:K.offset)>0||Q.sharedHistoryOffset>0)},()=>{var K;return ze.current=!1,((K=Q.messageWindow)==null?void 0:K.offset)>0?Kt.earlier("messages"):ge("session.history",{id:Q.id,before:Q.sharedHistoryOffset,limit:100})})},[Q==null?void 0:Q.id,(_p=Q==null?void 0:Q.messageWindow)==null?void 0:_p.offset,Q==null?void 0:Q.sharedHistoryOffset,Q==null?void 0:Q.historyLoading,Kt.busy,ge,ve.ready]),v.useLayoutEffect(()=>{const L=ht.current;if(!L||!xe.current||(ht.current=null,L.sessionId!==(Q==null?void 0:Q.id)))return;const K=xe.current,de=[...(K==null?void 0:K.querySelectorAll("[data-message-id]"))||[]].find(Ie=>Ie.dataset.messageId===L.messageId);de&&(K.scrollTop+=de.getBoundingClientRect().top-L.top)},[Q==null?void 0:Q.id,Q==null?void 0:Q.sharedHistoryOffset,(Pp=Q==null?void 0:Q.messageWindow)==null?void 0:Pp.offset,(Op=Q==null?void 0:Q.executionWindow)==null?void 0:Op.offset,ve.ready]),v.useLayoutEffect(()=>{var L;ag(bt.current),(L=Ye.current)==null||L.update()},[S,l==null?void 0:l.selectedSessionId,ve.ready]),v.useEffect(()=>{const L=()=>ag(bt.current);return window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[]),v.useEffect(()=>{if(l){for(const L of Xf(l))if(!Re.current.has(L.id)&&(Re.current.add(L.id),_q(l.notificationSettings)&&h&&"Notification"in window&&Notification.permission==="granted"&&(document.hidden||L.sessionId!==l.selectedSessionId))){const K=new Notification("Amplifier",{body:Aq(L,l.notificationSettings),icon:qc,tag:L.id});K.onclick=()=>{window.focus(),ge("session.select",{id:L.sessionId}),ge("view.update",{patch:{mode:"text"}})}}}},[l,h,ge]),v.useEffect(()=>(gt.current=new fq({request:St,onAction:(L,K)=>ut(L,K),onState:L=>{var K;U(L),L.status!=="connected"&&((K=H.current)==null||K.stop())},onError:L=>m(L.message||String(L))}),H.current=new vk({request:St,onState:Ee,getVoice:()=>{var L,K,de;return{...(L=gt.current)==null?void 0:L.state,sessionId:(de=(K=Ce.current)==null?void 0:K.voice)==null?void 0:de.sessionId}}}),j.current=new vq({request:St,onState:_e,getSession:()=>{var L;return(L=Ce.current)==null?void 0:L.selectedSessionId}}),()=>{var L,K,de;(L=j.current)==null||L.dispose(),(K=H.current)==null||K.dispose(),(de=gt.current)==null||de.dispose()}),[]),v.useEffect(()=>{var L;(L=j.current)==null||L.sync(null,h,l==null?void 0:l.computerVisual)},[h,l==null?void 0:l.computerVisual,l==null?void 0:l.selectedSessionId]),v.useEffect(()=>{var L,K;(K=H.current)==null||K.sync(X,h,(L=l==null?void 0:l.voice)==null?void 0:L.visual)},[X,h,(Mp=l==null?void 0:l.voice)==null?void 0:Mp.visual]);const sn=L=>{var K,de;if(L==="new-session"){Sn();return}(de=(K=Ce.current)==null?void 0:K.view)!=null&&de.panel||(i.current=document.activeElement),m(""),ge("view.update",{patch:{panel:L,toolbarMenuOpen:!1,...L==="settings"&&window.matchMedia("(max-width:959px)").matches?{settingsSection:"index",settingsExpanded:[]}:{}}})},Ca=()=>{I(!1),ge("view.update",{patch:{panel:null,themePreview:!1}})},Na=()=>s.current?s.current.close():Ca();v.useEffect(()=>{var qe,Ue;if(!pt||!ve.ready)return;const L=i.current||document.activeElement,K=(qe=ft.current)==null?void 0:qe.querySelector(".a-overlay [role=dialog]");if(!K)return;const de=()=>[...K.querySelectorAll("button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href]")].filter(Pe=>Pe.getClientRects().length);K.contains(document.activeElement)||(Ue=de()[0])==null||Ue.focus();const Ie=Pe=>{var _t;if(Pe.key==="Escape"&&(s.current?s.current.close():(I(!1),ge("view.update",{patch:{panel:null,themePreview:!1}}))),Pe.key==="Tab"){const yt=de(),Lt=yt[0],un=yt.at(-1);yt.includes(document.activeElement)?Pe.shiftKey&&document.activeElement===Lt?(Pe.preventDefault(),un==null||un.focus()):!Pe.shiftKey&&document.activeElement===un&&(Pe.preventDefault(),Lt==null||Lt.focus()):(Pe.preventDefault(),(_t=Pe.shiftKey?un:Lt)==null||_t.focus())}};return window.addEventListener("keydown",Ie),()=>{window.removeEventListener("keydown",Ie),i.current=null,L!=null&&L.isConnected&&L.focus()}},[pt,ge,ve.ready]);function pa(L){const K=ee.current;!at.current||(K==null?void 0:K.sessionId)===L||(clearTimeout(vt.current),xn(K,at.current).catch(de=>m(_a(de))),at.current=null)}function xn(L,K){if(se.current.has(L))return se.current.get(L);const de=(async()=>{if(L.sessionId===null&&ct.current){const Ie=await ct.current;L.sessionId=Ie.id,$e.current.bindDraft(K,Ie.id)}try{return await ut("view.update",L,{pendingViewToken:K})}catch(Ie){throw at.current===K&&(at.current=$e.current.add(L.patch,L.sessionId),Ce.current&&c($e.current.apply(Ce.current))),Ie}finally{at.current===K&&(at.current=null)}})();return se.current.set(L,de),de.catch(()=>se.current.delete(L)),de}function ta(L){var qe;if(Fe.current)return;const K=((qe=Ce.current)==null?void 0:qe.selectedSessionId)??null;pa(K),w(L),Le.current=L,$e.current.settle(at.current);const de=$e.current.add({draft:L},K),Ie={patch:{draft:L},sessionId:K};at.current=de,ee.current=Ie,Ce.current&&c($e.current.apply(Ce.current)),clearTimeout(vt.current),vt.current=setTimeout(()=>{xn(Ie,de).catch(Ue=>m(_a(Ue)))},220)}async function Sn(L){pa(null),ze.current=!0,await ge("session.draft",L?{workspace:L}:{})}async function ma(L){var de,Ie;const K=!L&&((Ie=(de=Ce.current)==null?void 0:de.sessions)==null?void 0:Ie.find(qe=>{var Ue;return qe.id===((Ue=Ce.current)==null?void 0:Ue.selectedSessionId)}));return K||(ct.current||(ct.current=ut("session.create",{...(L==null?void 0:L.setup)||Ja($e.current.apply(Ce.current)),fromDraft:!0},{id:L==null?void 0:L.id}).catch(qe=>{var Pe,_t;const Ue=(L==null?void 0:L.id)&&((_t=(Pe=Ce.current)==null?void 0:Pe.sessions)==null?void 0:_t.find(yt=>yt.creationCommandId===L.id));if(Ue)return{sessionId:Ue.id};throw qe}).then(qe=>{const Ue={id:qe.sessionId||qe.state.selectedSessionId},Pe=ee.current;return at.current&&(Pe==null?void 0:Pe.sessionId)===null&&(Pe.sessionId=Ue.id,$e.current.bindDraft(at.current,Ue.id),clearTimeout(vt.current),xn(Pe,at.current).catch(_t=>m(_a(_t))),Ce.current&&c($e.current.apply(Ce.current))),Ue}).finally(()=>{ct.current=null})),ct.current)}function na(L){var Ie;if(!(L!=null&&L.length)||on||mn)return;const K=((Ie=Ce.current)==null?void 0:Ie.selectedSessionId)??null;le.current++,Z(!0),m("");const de=async()=>{try{for(const qe of L)await ut("attachment.add",{sessionId:K,name:qe.name,base64:await KF(qe)})}catch(qe){m(qe.message)}finally{le.current--,Z(le.current>0)}};qt.current=qt.current.then(de,de)}async function Ga(L){var K,de,Ie,qe,Ue;if(!M.current.has(L.id)){M.current.add(L.id),ye.update(L.id,{status:"sending",error:""});try{if(!L.sessionId){const _t=await ma(L.creation);L=ye.update(L.id,{sessionId:_t.id})}const Pe=await ut("conversation.send",{sessionId:L.sessionId,text:L.text,...L.replyTo?{replyId:L.replyTo.id}:{},attachmentIds:L.attachmentIds,via:L.via,preserveDraft:!0},{id:L.commandId,feedback:!1});ye.update(L.id,["sending","unknown"].includes(Pe.delivery)?{status:"unknown",error:"Delivery has not been confirmed. Checking again will not run it twice."}:null)}catch(Pe){((qe=(Ie=(de=(K=Ce.current)==null?void 0:K.sessions)==null?void 0:de.find(yt=>yt.id===L.sessionId))==null?void 0:Ie.messages)==null?void 0:qe.some(yt=>{var Lt;return yt.inputId===L.commandId&&((Lt=yt.delivery)==null?void 0:Lt.status)==="accepted"}))&&Pe.code!=="session_busy"?ye.update(L.id,null):ye.update(L.id,{status:((Ue=Pe.receipt)==null?void 0:Ue.delivery)==="failed"||Pe.status>=400&&Pe.status<500&&Pe.status!==408?"failed":"unknown",error:_a(Pe)})}finally{M.current.delete(L.id)}}}function Qa(L){var Ie,qe,Ue,Pe,_t,yt,Lt;const K=ye.current.current.find(un=>{var Sr;return un.id===((Sr=L.localDelivery)==null?void 0:Sr.id)});!K||K.status!=="failed"||M.current.has(K.id)||(Pe=(Ue=(qe=(Ie=Ce.current)==null?void 0:Ie.sessions)==null?void 0:qe.find(un=>un.id===K.sessionId))==null?void 0:Ue.messages)!=null&&Pe.some(un=>un.inputId===K.commandId)||(ye.update(K.id,null),((Lt=(yt=(_t=Ce.current)==null?void 0:_t.view)==null?void 0:yt.messageEdit)==null?void 0:Lt.messageId)===L.id&&ge("view.update",{patch:{messageEdit:null}}))}async function Xa(L,K){const de=ye.current.current.find(Ue=>{var Pe;return Ue.id===(((Pe=L.localDelivery)==null?void 0:Pe.id)||L.id)});if(!de||de.status==="sending"||de.status==="unknown"&&K!==void 0)return;const Ie=de.status==="failed"&&!de.sessionId?{id:crypto.randomUUID(),setup:Ja($e.current.apply(Ce.current))}:de.creation,qe=ye.update(de.id,{creation:Ie,...de.status==="failed"?{commandId:crypto.randomUUID(),...K!==void 0?{text:K}:{}}:{},status:"sending",error:""});K!==void 0&&ge("view.update",{patch:{messageEdit:null}}),await Ga(qe)}async function aa(L){var Pe,_t,yt;if(L==null||L.preventDefault(),Fe.current||!S.trim()&&!Ge.length||le.current||g||he||mn||on)return;pa((Q==null?void 0:Q.id)??null);const K=S,de=crypto.randomUUID(),Ie=Ge;if(!K.trim()&&!Ie.length)return;(Pe=Ye.current)==null||Pe.reveal(),m(""),ta(""),clearTimeout(vt.current);const qe=at.current;let Ue=ye.update(de,{commandId:de,sessionId:(Q==null?void 0:Q.id)??null,...Q?{}:{creation:{id:crypto.randomUUID(),setup:Ja($e.current.apply(Ce.current))}},text:K,...(_t=l.view)!=null&&_t.messageReply?{replyTo:l.view.messageReply}:{},via:En==="text"?"text":"chat",attachmentIds:Ie.map(Lt=>Lt.id),attachments:Ie,status:"sending",createdAt:Date.now()/1e3});try{await xn(ee.current,qe);const Lt=Q||await ma(Ue.creation);Ue=ye.update(de,{sessionId:Lt.id}),await Ga(Ue)}catch(Lt){ye.update(de,{status:((yt=Lt.receipt)==null?void 0:yt.delivery)==="failed"||Lt.status>=400&&Lt.status<500&&Lt.status!==408?"failed":"unknown",error:_a(Lt)})}finally{$e.current.settle(qe),at.current===qe&&(at.current=null),Ce.current&&c($e.current.apply(Ce.current))}}async function Cn(L){var qe,Ue,Pe,_t,yt,Lt;if(L.preventDefault(),Ze.current.busy||!N.trim())return;const K=Ze.current.revision,de=(qe=Ce.current)==null?void 0:qe.selectedSessionId,Ie=N;Ze.current.busy=!0,zt(!0),m("");try{await ut("worker.spawn",{sessionId:de,instruction:Ie});const un=(Pe=(Ue=$e.current.apply(Ce.current))==null?void 0:Ue.view)==null?void 0:Pe.workerDraft;Ze.current.revision===K&&((_t=Ce.current)==null?void 0:_t.selectedSessionId)===de&&un===Ie&&(x(""),await ut("view.update",{patch:{workerDraft:"",...((Lt=(yt=Ce.current)==null?void 0:yt.view)==null?void 0:Lt.panel)==="worker"?{panel:null}:{}}}))}catch(un){m(un.message)}finally{Ze.current.busy=!1,zt(!1)}}async function ir(){var L;if(((L=l.voiceConfiguration)==null?void 0:L.available)===!1){await ut("view.update",{patch:{panel:"settings",settingsSection:"setup",settingsExpanded:["voice"]}});return}if(!Je.current){Je.current=!0,ue(!0),m("");try{await ma(),await ut("view.update",{patch:{mode:"call"}}),await ut("call.start",{})}catch(K){m(_a(K))}finally{Je.current=!1,ue(!1)}}}const ha=!["idle","ended","error"].includes(X.status||"idle"),Ra=T?A:((zp=l==null?void 0:l.theme)==null?void 0:zp.css)||"",ln=ve.composition.presentation,Qn=ln.scheme||Yt.scheme,ja=Qn==="system"?"light dark":Qn||"light",cn=QL(Qn);XL({root:ft,state:l,shell:ve,scheme:Qn,mode:cn,preview:T,css:Ra}),Nx(l);const he=!Q&&ye.entries.some(L=>L.sessionId===null&&["sending","unknown"].includes(L.status)),$=pn||((Q==null?void 0:Q.workers)||[]).some(L=>["queued","starting","working","running","stopping"].includes(L.status)),te=ye.entries.some(L=>L.sessionId===((Q==null?void 0:Q.id)??null)&&L.status==="sending"),pe=$q({draft:S,attachments:Ge,uploading:G,working:pn,responseActive:$,stopping:(Q==null?void 0:Q.status)==="stopping",voiceStatus:X.status,voiceStarting:De,busy:g,newChatPending:he,sending:te,historyPending:mn,executionUnavailable:on}),Me=JL({enabled:!!l&&ve.ready,blocked:ha||De?"Finish your voice call, then reload.":G||te||g?"Wait for the current upload or send to finish.":"",prepare:async()=>{var de,Ie,qe;await Promise.all([st.current,et.current,Y.current,qt.current]),await Bl((de=Ce.current)==null?void 0:de.selectedSessionId),clearTimeout(vt.current),at.current&&await xn(ee.current,at.current);const L=((Ie=Ce.current)==null?void 0:Ie.selectedSessionId)??null,K=Le.current;if(await ut("view.update",{sessionId:L,patch:{draft:K}}),K!==Le.current||L!==(((qe=Ce.current)==null?void 0:qe.selectedSessionId)??null))throw Error("Your draft changed while saving. Select Reload now again when you’re ready.")}}),Be=_s(l)!=="chat",ot=(L,K=null)=>ge("view.update",{patch:{...Tk(L,K),navExpanded:!1}}),Ft={browse:ot,create:()=>a(!0),newChat:Sn},Gt=Be?{...l,canvas:{...l==null?void 0:l.canvas,open:!1}}:l;return!l||!ve.ready?n.createElement("div",{className:"boot"},n.createElement("img",{src:qc}),n.createElement("h1",null,"Amplifier"),n.createElement("p",null,p||ve.error||"Connecting to your workspace…"),(p||ve.error)&&n.createElement(n.Fragment,null,n.createElement("button",{onClick:()=>{b(L=>L+1),ve.refresh()}},"Retry connection"),n.createElement("p",null,n.createElement("a",{href:"?shell=recovery"},"Open recovery mode")))):n.createElement(zi.Provider,{value:Ft},n.createElement(_g.Provider,{value:ve},n.createElement(Bw.Provider,{value:Me},n.createElement("div",{id:"amp-one",className:"a-chat-shell a-approachable-shell","data-work-surface":_s(l),ref:ft,"data-layout":ln.layout||Yt.layout||"balanced","data-interface-detail":ln.interfaceDetail||ln.executionDetail||"standard","data-execution-detail":ln.interfaceDetail||ln.executionDetail||"standard","data-density":ln.density||"comfortable",style:{colorScheme:ja,...ln.accent?{"--a-accent":ln.accent}:{}},"data-theme-scheme":cn,"data-decorations":ln.decorations===!1?"off":"on","data-part":"app"},Ra&&n.createElement("style",null,Ra),n.createElement("style",null,Jq),n.createElement("style",null,HL),n.createElement(qL,{state:l,session:Q,act:ge,open:sn,narrow:e,presentation:ln}),n.createElement(Hw,null),p&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,p),n.createElement("button",{"aria-label":"Dismiss error",onClick:()=>{m(""),ge("view.update",{patch:{notice:null}})},"data-action":"view.update"},n.createElement(nn,null))),n.createElement(SF,{state:l,session:Q,act:ge}),!((Lp=l.runtime)!=null&&Lp.available)&&n.createElement("div",{className:"a-alert a-runtime"},n.createElement("span",null,n.createElement("strong",null,"Connect Amplifier to get started.")," ",((Dp=l.runtime)==null?void 0:Dp.error)||"The Amplifier runtime is not installed. Install this app with its runtime dependencies, then relaunch."),n.createElement("button",{className:"a-link",onClick:()=>sn("settings"),"data-action":"view.update"},"Setup details ",n.createElement(en,null))),n.createElement(BL,{voice:X,callSession:l.sessions.find(L=>{var K;return L.id===((K=l.voice)==null?void 0:K.sessionId)}),callActive:ha,browsing:Be,working:pn&&!on,session:Q,act:ge,onReturn:()=>ot("chat")},n.createElement(yq,{sessionId:Q==null?void 0:Q.id,visual:me,client:j,dispatch:ut,onError:L=>m(L.message)})),n.createElement(_L,{state:Gt,act:ge,presentation:ln},n.createElement(OL,{footer:n.createElement(FL,{state:l,act:ge,connected:h,open:sn}),shell:ve,state:l,session:Q,act:ge,selectSession:L=>{ze.current=!0,ge("session.select",{id:L})},newSession:Sn}),n.createElement("section",{className:`a-conversation ${wn.length||mn||Q!=null&&Q.historyError||on?"has-messages":"is-empty"}`,"data-part":"conversation","aria-label":"Shared conversation"},Be&&n.createElement($L,{shell:ve,state:l,act:ge}),n.createElement(WF,{session:Q,focus:(Fp=l.view)==null?void 0:Fp.messageFocus,detail:Kt}),n.createElement("div",{className:"a-messages",ref:xe,"data-part":"messages","data-view-source":Q?"conversation":void 0,role:"log","aria-label":"Conversation messages","aria-live":"polite","aria-busy":!!(Q!=null&&Q.historyLoading)},n.createElement("div",{className:"a-session-history"},Kt.controls),n.createElement(ML,{session:((qp=Q==null?void 0:Q.messageWindow)==null?void 0:qp.offset)>0?{...Q,sharedHistoryOffset:0}:Q,act:ge,onLoadEarlier:()=>{ze.current=!1}}),(Q==null?void 0:Q.parentId)&&n.createElement("div",{className:"a-chat-origin"},n.createElement(Wa,null),n.createElement("span",null,ho(Q)?Q.editOrigin?"Continued from an edited message":"Forked conversation":"Subagent conversation"),n.createElement("button",{type:"button",className:"a-link","data-action":"session.select",disabled:!l.sessions.some(L=>L.id===Q.parentId),onClick:()=>ge("session.select",{id:Q.parentId})},ho(Q)?"Open original chat":"Open parent chat")),kn.before.map(L=>n.createElement(ng,{key:L,data:V,turnId:L,state:l,act:ge})),!Q&&n.createElement(Wx,{state:l,act:ge})," ",wn.length===0&&!mn&&!(Q!=null&&Q.historyError)&&!on?Q&&n.createElement("div",{className:"a-empty"},n.createElement("img",{src:qc,alt:""}),n.createElement("h2",null,"What shall we work on?"),n.createElement("p",null,"Bring an idea, a question, or a file.")):QF(wn,kn.after).map(L=>Array.isArray(L)?n.createElement(XF,{key:L[0].id,messages:L,session:Q||{id:null},state:l,act:ge,renderArtifacts:K=>n.createElement(Em,{state:l,message:K,act:ge})}):n.createElement(n.Fragment,{key:L.id},n.createElement(gk,{message:L,session:Q||{id:null},state:l,act:ge,stamp:Kq,working:pn,forkTurn:Dt.get(L.id),retry:Xa,discard:Qa,dispatch:ut}),(kn.after.get(L.id)||[]).map(K=>n.createElement(ng,{key:K,data:V,turnId:K,state:l,act:ge})),n.createElement(Em,{state:l,message:L,act:ge}))),(Q==null?void 0:Q.streaming)&&n.createElement("article",{className:"a-message a-assistant"},n.createElement("div",{className:"a-msg-meta"},n.createElement("strong",null,"Amplifier"),n.createElement("span",null,"Working…")),n.createElement(ml,{text:Q.streaming})),n.createElement("div",{ref:Et})),mt&&n.createElement("div",{className:"a-live-activity","data-part":"activity","data-view-source":"activity",role:"status","aria-live":"polite"},n.createElement("span",{className:"a-activity-pulse","aria-hidden":"true"},n.createElement("b",null),n.createElement("b",null),n.createElement("b",null)),n.createElement("div",null,n.createElement("strong",null,mt.label),(mt.toolLabels.length>0||mt.lastTool||mt.workerCount>0)&&n.createElement("small",null,mt.toolLabels.join(" · "),mt.lastTool&&`Last tool: ${mt.lastTool}`,mt.workerCount>0&&mt.phase!=="workers"?`${mt.toolLabels.length||mt.lastTool?" · ":""}${mt.workerCount} active ${mt.workerCount===1?"worker":"workers"}`:"")),mt.elapsed&&n.createElement("span",{className:"a-activity-elapsed",role:"timer","aria-live":"off","aria-label":`Elapsed ${mt.elapsed}`},mt.elapsed)),!!((Up=Q==null?void 0:Q.approvals)!=null&&Up.filter(L=>L.status==="pending"||!L.status).length)&&n.createElement("section",{className:"a-card a-approvals","data-part":"approvals"},n.createElement("div",{className:"a-card-header"},n.createElement("h2",null,"Needs your attention")),Q.approvals.filter(L=>L.status==="pending"||!L.status).map(L=>n.createElement("div",{key:L.id,"data-approval-id":L.id},n.createElement("strong",null,L.title||L.tool||"Approval requested"),n.createElement("p",null,L.prompt||L.message||L.description),L.details&&n.createElement("pre",null,typeof L.details=="string"?L.details:Uc(L.details)),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"approval.respond",onClick:()=>ge("approval.respond",{id:L.id,decision:"approve"})},n.createElement(Pt,null),"Allow"),n.createElement("button",{className:"a-soft","data-action":"approval.respond",onClick:()=>ge("approval.respond",{id:L.id,decision:"deny"})},"Deny"))))),n.createElement(Hq,{session:Q,dispatch:ut}),n.createElement("form",{className:`a-composer ${D?"drag-over":""}`,"data-part":"composer","data-action":"conversation.send",onSubmit:aa,onDragOver:L=>{L.dataTransfer.types.includes("Files")&&(L.preventDefault(),on||ne(!0))},onDragLeave:L=>{L.currentTarget.contains(L.relatedTarget)||ne(!1)},onDrop:L=>{L.dataTransfer.files.length&&(L.preventDefault(),ne(!1),na([...L.dataTransfer.files]))},onPaste:L=>{if(on){L.preventDefault();return}const K=[...L.clipboardData.items].filter(de=>de.kind==="file").map(de=>de.getAsFile()).filter(Boolean);if(K.length){L.preventDefault();const de=L.clipboardData.getData("text/plain");if(de){const Ie=bt.current,qe=(Ie==null?void 0:Ie.selectionStart)??S.length,Ue=(Ie==null?void 0:Ie.selectionEnd)??qe;ta(S.slice(0,qe)+de+S.slice(Ue))}na(K)}}},ye.storageError&&ye.entries.length>0&&n.createElement("p",{role:"alert",className:"a-upload-status"},"This browser could not save the pending message. Keep this tab open until delivery is confirmed."),n.createElement(Bq,{session:Q,runtimeAvailable:((jp=l.runtime)==null?void 0:jp.available)!==!1,dispatch:ut},!Q&&n.createElement(LL,{state:l,act:ge}),n.createElement(fk,{items:Ge,remove:L=>ge("attachment.remove",{sessionId:(Q==null?void 0:Q.id)??null,id:L})}),G&&n.createElement("p",{role:"status",className:"a-upload-status"},"Uploading attachments…"),D&&n.createElement("p",{className:"a-upload-status"},"Drop files or images to attach"),n.createElement(HF,{quote:($p=l.view)==null?void 0:$p.messageReply,sessionId:Q==null?void 0:Q.id,dispatch:ut}),n.createElement("textarea",{ref:bt,rows:1,disabled:on,readOnly:je,"aria-busy":je,value:S,onChange:L=>ta(L.target.value),"data-action":"view.update","aria-label":"Message Amplifier",placeholder:"Ask Amplifier anything…",onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&!L.nativeEvent.isComposing&&(L.preventDefault(),aa())}}),n.createElement("div",{className:"a-compose-bottom"},te&&n.createElement("span",{role:"status",className:"a-caption"},"Sending message…"),n.createElement("div",{className:"a-compose-tools"},n.createElement("input",{ref:fe,type:"file",multiple:!0,className:"a-file-input","aria-label":"Attach files","data-action":"attachment.add",onChange:L=>{na([...L.target.files]),L.target.value=""}}),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Add attachments",title:"Attach files or images · up to 32 MB each",disabled:G||on||mn,"data-action":"attachment.add",onClick:()=>fe.current.click()},n.createElement(Ln,null)),n.createElement(Ur,{name:"composer.actions"},n.createElement(JF,{state:l,session:Q,act:ge,ensureSession:ma,working:pn}),n.createElement(tk,{compact:!0,state:l,session:Q,act:ge,working:pn}),Q&&n.createElement("button",{type:"button",className:"a-icon a-composer-controls","aria-label":"Chat controls","data-action":"view.update",disabled:on||mn,onClick:()=>sn("runtime")},n.createElement(tl,null)))),n.createElement("button",{type:pe.action==="conversation.send"?"submit":"button",className:"a-send","data-part":"composer-primary-action","data-action":pe.action,"aria-label":pe.action==="call.start"&&((Bp=l.voiceConfiguration)==null?void 0:Bp.available)===!1?"Set up voice":pe.label,title:pe.action==="call.start"&&((Hp=l.voiceConfiguration)==null?void 0:Hp.available)===!1?"Set up voice in Settings":pe.label,disabled:pe.disabled||je&&pe.action==="conversation.send",onClick:pe.action==="call.start"?ir:pe.action==="call.end"?()=>ge("call.end"):pe.action==="conversation.stop"?()=>ge("conversation.stop",{sessionId:Q.id}):void 0},pe.icon==="voice"?n.createElement(zu,null):pe.icon==="cancel"?n.createElement(nn,null):n.createElement(Li,null)))))),n.createElement(fL,{scheme:Qn},n.createElement(zL,{suppressed:Be,state:l,act:ge,dispatch:ut}))),t&&n.createElement(DL,{state:l,act:ge,onClose:()=>a(!1)}),n.createElement(Iq,{state:l,act:ge}),pt&&n.createElement("div",{className:`a-overlay ${pt==="settings"||pt==="appearance"?"a-settings-overlay a-settings-redesign-overlay":""}`,"data-part":"overlay",onPointerDown:L=>{o.current=L.target===L.currentTarget},onClick:L=>{o.current&&L.target===L.currentTarget&&Na()}},n.createElement("section",{role:"dialog","aria-modal":"true","aria-labelledby":"panel-title",className:`a-dialog ${pt==="appearance"||pt==="agent"||pt==="runtime"||pt==="settings"?"wide":""}`,"data-part":"dialog"},n.createElement("div",{className:"a-dialog-head"},n.createElement("h2",{id:"panel-title"},{appearance:"Settings",agent:"What the agent sees",settings:"Settings",activity:"Ready for you",feedback:"Send feedback",worker:"Give it a worker lane","delete-session":"Delete chat?",runtime:"Chat controls","session-details":"Chat details","subagent-history":"Subagent history",coordination:"Tasks and workers"}[pt]||pt),n.createElement("button",{className:"a-icon","data-action":"view.update","aria-label":"Close panel",onClick:Na},n.createElement(nn,null))),p&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,p),n.createElement("button",{type:"button","aria-label":"Dismiss error",onClick:()=>m("")},n.createElement(nn,null))),pt==="session-details"&&Q&&n.createElement(n.Fragment,null,n.createElement(uk,{key:Q.id,session:Q,act:ut}),n.createElement("h3",null,"Export chat"),n.createElement(dk,{session:Q,state:l,act:ge}),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Mg,{state:l,session:Q,act:ge}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>sn("coordination")},n.createElement(Wa,null),"Tasks and workers"),n.createElement("button",{type:"button",className:"a-soft","data-action":"view.update",onClick:()=>sn("worker")},n.createElement(Wa,null),"Delegate work"))),pt==="coordination"&&n.createElement(nq,{dispatch:ut}),pt==="subagent-history"&&n.createElement(uS,{state:l,session:Q,act:ge}),pt==="activity"&&n.createElement(Ix,{state:l,act:ge}),pt==="feedback"&&n.createElement(Tq,{state:l,act:ut}),pt==="runtime"&&n.createElement(lk,{state:l,session:Q,act:ge,computerControls:n.createElement(bq,{sessionId:Q==null?void 0:Q.id,visual:me,client:j,dispatch:ut,onError:L=>m(L.message||String(L))})}),pt==="worker"&&n.createElement("form",{"data-action":"worker.spawn",onSubmit:Cn},n.createElement("p",null,"Tell the worker what to investigate or build. Results return to this conversation."),n.createElement("label",{htmlFor:"worker-instruction"},"Work to delegate"),n.createElement("textarea",{id:"worker-instruction",value:N,"data-action":"view.update",onChange:L=>{Ze.current.revision++,x(L.target.value),ge("view.update",{patch:{workerDraft:L.target.value}})},placeholder:"Review the project and propose a focused implementation plan…"}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:it||!N.trim()},n.createElement(Wa,null),it?"Starting…":"Start worker"))),pt==="agent"&&n.createElement(n.Fragment,null,n.createElement("p",null,"Every app control uses the same action interface. The agent can read the selected conversation, worker lanes, drafts, open panels, and the controls currently on screen."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",null,"Current state"),n.createElement("pre",{className:"a-state-view"},Uc({...l,devices:Object.fromEntries(Object.entries(l.devices||{}).map(([L,K])=>{var de,Ie;return[L,{clientId:K.clientId,viewport:K.viewport,controls:(de=K.controls)==null?void 0:de.length,visibleTextLength:(Ie=K.visibleText)==null?void 0:Ie.length,voice:K.voice,notificationPermission:K.notificationPermission}]})),deviceCommands:(l.deviceCommands||[]).map(({id:L,type:K,origin:de,createdAt:Ie})=>({id:L,type:K,origin:de,createdAt:Ie})),theme:{name:(Vp=l.theme)==null?void 0:Vp.name,css:`${((Zp=(Wp=l.theme)==null?void 0:Wp.css)==null?void 0:Zp.length)||0} characters`},view:{...Yt,themeDraft:Yt.themeDraft?`${Yt.themeDraft.length} characters`:void 0}}))),n.createElement("div",null,n.createElement("label",null,"Visible controls"),n.createElement("pre",{className:"a-state-view"},Uc((Jp=jl(ft.current,Ha).controls)==null?void 0:Jp.map(L=>({label:L.label,action:L.action,disabled:L.disabled})))))),n.createElement("label",{htmlFor:"agent-action"},"Run an app action"),n.createElement("select",{id:"agent-action",value:F,"data-action":"view.update",onChange:L=>{z(L.target.value),ge("view.update",{patch:{agentAction:L.target.value}})}},u.map(L=>n.createElement("option",{key:L.name||L.action,value:L.name||L.action},L.name||L.action))),n.createElement("label",{htmlFor:"agent-args"},"Arguments (JSON)"),n.createElement("textarea",{id:"agent-args",className:"a-css-editor",style:{minHeight:100},value:q,"data-action":"view.update",onChange:L=>{W(L.target.value),ge("view.update",{patch:{agentArgs:L.target.value}})}}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":F,onClick:()=>{try{ge(F,JSON.parse(q))}catch(L){m(_a(L))}}},"Run action"),n.createElement("button",{className:"a-soft","data-action":"state.export",onClick:()=>ge("state.export")},n.createElement(wa,null),"Export app state")),n.createElement("p",{className:"a-caption"},"Also available to integrations as window.amplifier.getState(), getActions(), and dispatch().")),pt==="delete-session"&&n.createElement(Tg,{key:Q==null?void 0:Q.id,id:Q==null?void 0:Q.id,act:ut,cancel:Na}),(pt==="settings"||pt==="appearance")&&n.createElement(FF,{state:l,session:Q,act:ge,dispatch:ut,open:sn,close:Ca,navigationRef:s,appearance:n.createElement(aD,{state:l,shell:ve,act:ut,name:O,css:A,preview:T,setName:k,setCss:C,setPreview:I,defaultSkin:Fc})})))))))}Rk.createRoot(document.getElementById("root")).render(n.createElement(Yq,null));export{zg as _,t1 as p}; diff --git a/amplifier_web/static/assets/arc-DXFEdbiI.js b/amplifier_web/static/assets/arc-CxD3pp7w.js similarity index 98% rename from amplifier_web/static/assets/arc-DXFEdbiI.js rename to amplifier_web/static/assets/arc-CxD3pp7w.js index 6d60f71d7..396a0082a 100644 --- a/amplifier_web/static/assets/arc-DXFEdbiI.js +++ b/amplifier_web/static/assets/arc-CxD3pp7w.js @@ -1 +1 @@ -import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-CDlaSEyP.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,B,a){var O=I-l,i=D-h,n=B-v,d=a-A,u=d*O-n*i;if(!(u*ur*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,C=rn(c-f),t=c>f;if(a||(a=n=O()),sy))a.moveTo(0,0);else if(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(Cy?x>y?(e=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),pr*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,C=rn(c-f),t=c>f;if(a||(a=n=O()),sy))a.moveTo(0,0);else if(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(Cy?x>y?(e=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),ps?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=O[tt],O[tt]=O[H],O[H]=k;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(k)||(a.nodesInRelativeHorizontal.push(k),a.nodeToRelativeConstraintMapHorizontal.set(k,[]),a.dummyToNodeForVerticalAlignment.has(k)?a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(k).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,k=0;k{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var Z=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?Z++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,Z=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var Z={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var Z=new Set;Ot[U].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(Z).x,Z.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(Z).y,Z.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],k=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(k).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var Z=void 0;if(U){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(Z.isParent()?w[U].push(b.get(Z.id())):w[U].push(Z.id()))})});var Nt=function(U){var Z=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[Z].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=ur(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await gr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` +import{p as qe}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as ct,D as Qe,X as Je,l as Fe,b as Ke,a as je,n as _e,o as tr,g as er,s as rr,p as ir,A as ar,y as nr,B as or,c as Ee,b4 as Te,aj as pe,i as sr,j as hr,q as lr,ak as fr,b5 as cr}from"./mermaid.core-BQ5lTCZr.js";import{p as gr}from"./cynefin-OW5HDTMX-C5aohCXI.js";import{c as be}from"./cytoscape.esm-Ix0LnXOy.js";import{g as ur}from"./client-BPXDbY79.js";import"./app-zsnl1T1T.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=O[tt],O[tt]=O[H],O[H]=k;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(k)||(a.nodesInRelativeHorizontal.push(k),a.nodeToRelativeConstraintMapHorizontal.set(k,[]),a.dummyToNodeForVerticalAlignment.has(k)?a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(k).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,k=0;k{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var Z=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?Z++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,Z=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var Z={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var Z=new Set;Ot[U].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(Z).x,Z.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(Z).y,Z.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],k=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(k).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var Z=void 0;if(U){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(Z.isParent()?w[U].push(b.get(Z.id())):w[U].push(Z.id()))})});var Nt=function(U){var Z=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[Z].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=ur(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await gr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` .edge { stroke-width: ${I.archEdgeWidth}; stroke: ${I.archEdgeColor}; diff --git a/amplifier_web/static/assets/blockDiagram-I7D4REHJ-BfemG4eq.js b/amplifier_web/static/assets/blockDiagram-I7D4REHJ-JIRyk-UT.js similarity index 99% rename from amplifier_web/static/assets/blockDiagram-I7D4REHJ-BfemG4eq.js rename to amplifier_web/static/assets/blockDiagram-I7D4REHJ-JIRyk-UT.js index 1b12feb09..abd8edf25 100644 --- a/amplifier_web/static/assets/blockDiagram-I7D4REHJ-BfemG4eq.js +++ b/amplifier_web/static/assets/blockDiagram-I7D4REHJ-JIRyk-UT.js @@ -1,4 +1,4 @@ -import{g as Pe}from"./chunk-5VM5RSS4-DlVFuaV7.js";import{aC as Fe,aD as ye,aE as Me,aF as Ke,aG as Ye,aH as We,aI as Ve,aJ as Ue,aK as He,aL as Xe,aM as je,aN as Ge,aO as qe,aP as Je,aQ as Ze,aR as Qe,aS as $e,aT as et,aU as tt,aV as st,aW as rt,aX as it,aY as at,aZ as nt,a_ as ot,_ as g,y as j,j as J,a$ as ct,d as lt,l as m,p as ut,r as gt,c as me,P as ht,ay as dt,ax as pt,az as ft,k as St,b0 as xt,af as be,ag as Lt}from"./mermaid.core-CDlaSEyP.js";import{c as yt}from"./channel-BqsL4B4X.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";function mt(e){return Array.isArray(e)}function bt(e){if(Fe(e))return e;const n=ye(e);if(!wt(e))return{};if(mt(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Me(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(n==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(n==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(n==="[object Boolean]"||n==="[object Number]"||n==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return n==="[object String]"?_t(c,e):re(c,e),c}if(n==="[object Date]")return new Date(Number(e));if(n==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(n==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(n==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(n==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(n==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(ye(e)){case ot:case nt:case at:case it:case rt:case st:case tt:case et:case $e:case Qe:case Ze:case Je:case qe:case Ge:case je:case Xe:case He:case Ue:case Ve:case We:case Ye:case Ke:return!0;default:return!1}}function re(e,n){for(const l in n)Object.hasOwn(n,l)&&(e[l]=n[l])}function Et(e,n){const l=Object.getOwnPropertySymbols(n);for(let s=0;s=l)&&(e[s]=n[s])}function Dt(e,n){const l=Object.getPrototypeOf(n);l!==null&&typeof n.constructor=="function"&&Object.setPrototypeOf(e,l)}var ae=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),n=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],y=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var a=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[a-1]),u.setHierarchy(t[a-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[a]),typeof t[a].length=="number"?this.$=t[a]:this.$=[t[a]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[a-1]),this.$=[t[a-1]].concat(t[a]);break;case 14:u.getLogger().debug("Rule: link: ",t[a],h),this.$={edgeTypeStr:t[a],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[a-3],t[a-1],t[a]),this.$={edgeTypeStr:t[a],label:t[a-1]};break;case 18:const f=parseInt(t[a]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[a-2],t[a-1],t[a]," typestr: ",t[a-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[a-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[a-1].edgeTypeStr),K=u.edgeStrToThickness(t[a-1].edgeTypeStr),b=u.edgeStrToPattern(t[a-1].edgeTypeStr);this.$=[{id:t[a-2].id,label:t[a-2].label,type:t[a-2].type,directions:t[a-2].directions},{id:t[a-2].id+"-"+t[a].id,start:t[a-2].id,end:t[a].id,label:t[a-1].label,type:"edge",thickness:K,pattern:b,directions:t[a].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[a-1],t[a]),this.$={id:t[a-1].id,label:t[a-1].label,type:u.typeStr2Type(t[a-1].typeStr),directions:t[a-1].directions,widthInColumns:parseInt(t[a],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[a]),this.$={id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[a]),this.$={type:"column-setting",columns:t[a]==="auto"?-1:parseInt(t[a])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[a-2],t[a-1]),u.generateId(),this.$={...t[a-2],type:"composite",children:t[a-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[a-2],t[a-1],t[a]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[a-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[a]),this.$={id:t[a]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[a-1],t[a]),this.$={id:t[a-1],label:t[a].label,typeStr:t[a].typeStr,directions:t[a].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[a]),this.$=[t[a]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[a-1],t[a]),this.$=[t[a-1]].concat(t[a]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[a-2],t[a-1],t[a]),this.$={typeStr:t[a-2]+t[a],label:t[a-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[a-3],t[a-2]," #3:",t[a-1],t[a]),this.$={typeStr:t[a-3]+t[a],label:t[a-2],directions:t[a-1]};break;case 35:case 36:this.$={type:"classDef",id:t[a-1].trim(),css:t[a].trim()};break;case 37:this.$={type:"applyClass",id:t[a-1].trim(),styleClass:t[a].trim()};break;case 38:this.$={type:"applyStyles",id:t[a-1].trim(),stylesStr:t[a].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:n,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(y,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:n,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:n,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(y,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:n,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,a="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: +import{g as Pe}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{aC as Fe,aD as ye,aE as Me,aF as Ke,aG as Ye,aH as We,aI as Ve,aJ as Ue,aK as He,aL as Xe,aM as je,aN as Ge,aO as qe,aP as Je,aQ as Ze,aR as Qe,aS as $e,aT as et,aU as tt,aV as st,aW as rt,aX as it,aY as at,aZ as nt,a_ as ot,_ as g,y as j,j as J,a$ as ct,d as lt,l as m,p as ut,r as gt,c as me,P as ht,ay as dt,ax as pt,az as ft,k as St,b0 as xt,af as be,ag as Lt}from"./mermaid.core-BQ5lTCZr.js";import{c as yt}from"./channel-CSv1n6Zd.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";function mt(e){return Array.isArray(e)}function bt(e){if(Fe(e))return e;const n=ye(e);if(!wt(e))return{};if(mt(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Me(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(n==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(n==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(n==="[object Boolean]"||n==="[object Number]"||n==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return n==="[object String]"?_t(c,e):re(c,e),c}if(n==="[object Date]")return new Date(Number(e));if(n==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(n==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(n==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(n==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(n==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(ye(e)){case ot:case nt:case at:case it:case rt:case st:case tt:case et:case $e:case Qe:case Ze:case Je:case qe:case Ge:case je:case Xe:case He:case Ue:case Ve:case We:case Ye:case Ke:return!0;default:return!1}}function re(e,n){for(const l in n)Object.hasOwn(n,l)&&(e[l]=n[l])}function Et(e,n){const l=Object.getOwnPropertySymbols(n);for(let s=0;s=l)&&(e[s]=n[s])}function Dt(e,n){const l=Object.getPrototypeOf(n);l!==null&&typeof n.constructor=="function"&&Object.setPrototypeOf(e,l)}var ae=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),n=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],y=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var a=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[a-1]),u.setHierarchy(t[a-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[a]),typeof t[a].length=="number"?this.$=t[a]:this.$=[t[a]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[a-1]),this.$=[t[a-1]].concat(t[a]);break;case 14:u.getLogger().debug("Rule: link: ",t[a],h),this.$={edgeTypeStr:t[a],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[a-3],t[a-1],t[a]),this.$={edgeTypeStr:t[a],label:t[a-1]};break;case 18:const f=parseInt(t[a]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[a-2],t[a-1],t[a]," typestr: ",t[a-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[a-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[a-1].edgeTypeStr),K=u.edgeStrToThickness(t[a-1].edgeTypeStr),b=u.edgeStrToPattern(t[a-1].edgeTypeStr);this.$=[{id:t[a-2].id,label:t[a-2].label,type:t[a-2].type,directions:t[a-2].directions},{id:t[a-2].id+"-"+t[a].id,start:t[a-2].id,end:t[a].id,label:t[a-1].label,type:"edge",thickness:K,pattern:b,directions:t[a].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[a-1],t[a]),this.$={id:t[a-1].id,label:t[a-1].label,type:u.typeStr2Type(t[a-1].typeStr),directions:t[a-1].directions,widthInColumns:parseInt(t[a],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[a]),this.$={id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[a]),this.$={type:"column-setting",columns:t[a]==="auto"?-1:parseInt(t[a])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[a-2],t[a-1]),u.generateId(),this.$={...t[a-2],type:"composite",children:t[a-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[a-2],t[a-1],t[a]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[a-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[a]),this.$={id:t[a]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[a-1],t[a]),this.$={id:t[a-1],label:t[a].label,typeStr:t[a].typeStr,directions:t[a].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[a]),this.$=[t[a]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[a-1],t[a]),this.$=[t[a-1]].concat(t[a]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[a-2],t[a-1],t[a]),this.$={typeStr:t[a-2]+t[a],label:t[a-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[a-3],t[a-2]," #3:",t[a-1],t[a]),this.$={typeStr:t[a-3]+t[a],label:t[a-2],directions:t[a-1]};break;case 35:case 36:this.$={type:"classDef",id:t[a-1].trim(),css:t[a].trim()};break;case 37:this.$={type:"applyClass",id:t[a-1].trim(),styleClass:t[a].trim()};break;case 38:this.$={type:"applyStyles",id:t[a-1].trim(),stylesStr:t[a].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:n,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(y,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:n,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:n,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(y,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:n,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,a="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: `+b.showPosition()+` Expecting `+q.join(", ")+", got '"+(this.terminals_[B]||B)+"'":se="Parse error on line "+(f+1)+": Unexpected "+(B==M?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(se,{text:b.match,token:this.terminals_[B]||B,line:b.yylineno,loc:H,expected:q})}if(P[0]instanceof Array&&P.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(P[0]){case 1:o.push(B),L.push(b.yytext),t.push(b.yylloc),o.push(P[1]),B=null,w=b.yyleng,a=b.yytext,f=b.yylineno,H=b.yylloc;break;case 2:if(W=this.productions_[P[1]][1],U.$=L[L.length-W],U._$={first_line:t[t.length-(W||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(W||1)].first_column,last_column:t[t.length-1].last_column},ee&&(U._$.range=[t[t.length-(W||1)].range[0],t[t.length-1].range[1]]),te=this.performAction.apply(U,[a,w,f,R.yy,P[1],L,t].concat(K)),typeof te<"u")return te;W&&(o=o.slice(0,-1*W*2),L=L.slice(0,-1*W),t=t.slice(0,-1*W)),o.push(this.productions_[P[1]][0]),L.push(U.$),t.push(U._$),fe=O[o[o.length-2]][o[o.length-1]],o.push(fe);break;case 3:return!0}}return!0},"parse")},D=(function(){var T={EOF:1,parseError:g(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:g(function(h,i){return this.yy=i||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var i=h.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:g(function(h){var i=h.length,o=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var L=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===u.length?this.yylloc.first_column:0)+u[u.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[L[0],L[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(h){this.unput(this.match.slice(h))},"less"),pastInput:g(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var h=this.pastInput(),i=new Array(h.length+1).join("-");return h+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/c4Diagram-7LVT6UL2-Q9nf5Gsa.js b/amplifier_web/static/assets/c4Diagram-7LVT6UL2-DdetwEv8.js similarity index 99% rename from amplifier_web/static/assets/c4Diagram-7LVT6UL2-Q9nf5Gsa.js rename to amplifier_web/static/assets/c4Diagram-7LVT6UL2-DdetwEv8.js index 11404b26b..fcdc8a7ee 100644 --- a/amplifier_web/static/assets/c4Diagram-7LVT6UL2-Q9nf5Gsa.js +++ b/amplifier_web/static/assets/c4Diagram-7LVT6UL2-DdetwEv8.js @@ -1,4 +1,4 @@ -import{d as Le}from"./chunk-F27PBJKO-D9qW0VD2.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as be,j as Jt,w as je,k as $t,m as de}from"./mermaid.core-CDlaSEyP.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var Ut=(function(){var t=d(function(yt,m,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=m);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],b=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(m,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(m,x){if(x.recoverable)this.trace(m);else{var E=new Error(m);throw E.hash=x,E}},"parseError"),parse:d(function(m){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(m,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: +import{d as Le}from"./chunk-F27PBJKO-35QGDevQ.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as be,j as Jt,w as je,k as $t,m as de}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Ut=(function(){var t=d(function(yt,m,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=m);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],b=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(m,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(m,x){if(x.recoverable)this.trace(m);else{var E=new Error(m);throw E.hash=x,E}},"parseError"),parse:d(function(m){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(m,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: `+A.showPosition()+` Expecting `+Yt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":Gt="Parse error on line "+(xt+1)+": Unexpected "+(M==le?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(Gt,{text:A.match,token:this.terminals_[M]||M,line:A.yylineno,loc:Qt,expected:Yt})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Et+", token: "+M);switch(V[0]){case 1:E.push(M),D.push(A.yytext),i.push(A.yylloc),E.push(V[1]),M=null,oe=A.yyleng,p=A.yytext,xt=A.yylineno,Qt=A.yylloc;break;case 2:if(j=this.productions_[V[1]][1],Tt.$=D[D.length-j],Tt._$={first_line:i[i.length-(j||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(j||1)].first_column,last_column:i[i.length-1].last_column},Ne&&(Tt._$.range=[i[i.length-(j||1)].range[0],i[i.length-1].range[1]]),Kt=this.performAction.apply(Tt,[p,oe,xt,vt.yy,V[1],D,i].concat(De)),typeof Kt<"u")return Kt;j&&(E=E.slice(0,-1*j*2),D=D.slice(0,-1*j),i=i.slice(0,-1*j)),E.push(this.productions_[V[1]][0]),D.push(Tt.$),i.push(Tt._$),ue=Pt[E[E.length-2]][E[E.length-1]],E.push(ue);break;case 3:return!0}}return!0},"parse")},Oe=(function(){var yt={EOF:1,parseError:d(function(x,E){if(this.yy.parser)this.yy.parser.parseError(x,E);else throw new Error(x)},"parseError"),setInput:d(function(m,x){return this.yy=x||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var x=m.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:d(function(m){var x=m.length,E=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var _=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var D=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===_.length?this.yylloc.first_column:0)+_[_.length-E.length].length-E[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(m){this.unput(this.match.slice(m))},"less"),pastInput:d(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var m=this.pastInput(),x=new Array(m.length+1).join("-");return m+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/channel-BqsL4B4X.js b/amplifier_web/static/assets/channel-BqsL4B4X.js deleted file mode 100644 index 06ddfe9e1..000000000 --- a/amplifier_web/static/assets/channel-BqsL4B4X.js +++ /dev/null @@ -1 +0,0 @@ -import{ah as o,ai as n}from"./mermaid.core-CDlaSEyP.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c}; diff --git a/amplifier_web/static/assets/channel-CSv1n6Zd.js b/amplifier_web/static/assets/channel-CSv1n6Zd.js new file mode 100644 index 000000000..63dbab77f --- /dev/null +++ b/amplifier_web/static/assets/channel-CSv1n6Zd.js @@ -0,0 +1 @@ +import{ah as o,ai as n}from"./mermaid.core-BQ5lTCZr.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c}; diff --git a/amplifier_web/static/assets/chunk-2Q5K7J3B-CLX5dmV-.js b/amplifier_web/static/assets/chunk-2Q5K7J3B-DR5XPUmF.js similarity index 66% rename from amplifier_web/static/assets/chunk-2Q5K7J3B-CLX5dmV-.js rename to amplifier_web/static/assets/chunk-2Q5K7J3B-DR5XPUmF.js index f6d3798e7..4044eaa0b 100644 --- a/amplifier_web/static/assets/chunk-2Q5K7J3B-CLX5dmV-.js +++ b/amplifier_web/static/assets/chunk-2Q5K7J3B-DR5XPUmF.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-CDlaSEyP.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; +import{_ as s}from"./mermaid.core-BQ5lTCZr.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; diff --git a/amplifier_web/static/assets/chunk-5VM5RSS4-DlVFuaV7.js b/amplifier_web/static/assets/chunk-5VM5RSS4-XkKVGNmc.js similarity index 83% rename from amplifier_web/static/assets/chunk-5VM5RSS4-DlVFuaV7.js rename to amplifier_web/static/assets/chunk-5VM5RSS4-XkKVGNmc.js index 4047d0d7e..96fc84bce 100644 --- a/amplifier_web/static/assets/chunk-5VM5RSS4-DlVFuaV7.js +++ b/amplifier_web/static/assets/chunk-5VM5RSS4-XkKVGNmc.js @@ -1,4 +1,4 @@ -import{_ as e}from"./mermaid.core-CDlaSEyP.js";var l=e(()=>` +import{_ as e}from"./mermaid.core-BQ5lTCZr.js";var l=e(()=>` /* Font Awesome icon styling - consolidated */ .label-icon { display: inline-block; diff --git a/amplifier_web/static/assets/chunk-F27PBJKO-D9qW0VD2.js b/amplifier_web/static/assets/chunk-F27PBJKO-35QGDevQ.js similarity index 96% rename from amplifier_web/static/assets/chunk-F27PBJKO-D9qW0VD2.js rename to amplifier_web/static/assets/chunk-F27PBJKO-35QGDevQ.js index d1201477b..c333e3989 100644 --- a/amplifier_web/static/assets/chunk-F27PBJKO-D9qW0VD2.js +++ b/amplifier_web/static/assets/chunk-F27PBJKO-35QGDevQ.js @@ -1 +1 @@ -import{_ as i,j as l,T as d,G as o}from"./mermaid.core-CDlaSEyP.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,h as b,g as c,x as d,m as e,w as f,f as g,y as h}; +import{_ as i,j as l,T as d,G as o}from"./mermaid.core-BQ5lTCZr.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,h as b,g as c,x as d,m as e,w as f,f as g,y as h}; diff --git a/amplifier_web/static/assets/chunk-IMKFNOWR-CF8hlUB5.js b/amplifier_web/static/assets/chunk-IMKFNOWR-D_IoXv7y.js similarity index 99% rename from amplifier_web/static/assets/chunk-IMKFNOWR-CF8hlUB5.js rename to amplifier_web/static/assets/chunk-IMKFNOWR-D_IoXv7y.js index 3c91bccd4..0339b8e11 100644 --- a/amplifier_web/static/assets/chunk-IMKFNOWR-CF8hlUB5.js +++ b/amplifier_web/static/assets/chunk-IMKFNOWR-D_IoXv7y.js @@ -1,4 +1,4 @@ -import{g as ee}from"./chunk-XXDRQBXY-BvgnYF8f.js";import{s as se}from"./chunk-POPQ4Y6H-fljvmLmW.js";import{_ as S,l as b,c as F,v as ie,x as re,a as ae,b as ne,g as oe,s as le,n as ce,o as he,S as ue,k as K,p as de,j as Dt}from"./mermaid.core-CDlaSEyP.js";import{f as fe}from"./chunk-F27PBJKO-D9qW0VD2.js";import{p as pe}from"./app-W22-ExtL.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],I=[1,20],v=[1,21],x=[1,22],$=[1,23],O=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(R){n.length=n.length-2*R,_.length=_.length-R,r.length=r.length-R}S(te,"popStack");function wt(){var R;return R=g.pop()||D.lex()||et,typeof R!="number"&&(R instanceof Array&&(g=R,R=g.pop()),R=u.symbols_[R]||R),R}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,It,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: +import{g as ee}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as se}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as S,l as b,c as F,v as ie,x as re,a as ae,b as ne,g as oe,s as le,n as ce,o as he,S as ue,k as K,p as de,j as Dt}from"./mermaid.core-BQ5lTCZr.js";import{f as fe}from"./chunk-F27PBJKO-35QGDevQ.js";import{p as pe}from"./app-zsnl1T1T.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],I=[1,20],v=[1,21],x=[1,22],$=[1,23],O=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(R){n.length=n.length-2*R,_.length=_.length-R,r.length=r.length-R}S(te,"popStack");function wt(){var R;return R=g.pop()||D.lex()||et,typeof R!="number"&&(R instanceof Array&&(g=R,R=g.pop()),R=u.symbols_[R]||R),R}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,It,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: `+D.showPosition()+` Expecting `+ft.join(", ")+", got '"+(this.terminals_[w]||w)+"'":bt="Parse error on line "+(G+1)+": Unexpected "+(w==et?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(bt,{text:D.match,token:this.terminals_[w]||w,line:D.yylineno,loc:_t,expected:ft})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+w);switch(N[0]){case 1:n.push(w),_.push(D.yytext),r.push(D.yylloc),n.push(N[1]),w=null,q=D.yyleng,c=D.yytext,G=D.yylineno,_t=D.yylloc;break;case 2:if(M=this.productions_[N[1]][1],Q.$=_[_.length-M],Q._$={first_line:r[r.length-(M||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(M||1)].first_column,last_column:r[r.length-1].last_column},Zt&&(Q._$.range=[r[r.length-(M||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(Q,[c,q,G,H.yy,N[1],_,r].concat(Tt)),typeof mt<"u")return mt;M&&(n=n.slice(0,-1*M*2),_=_.slice(0,-1*M),r=r.slice(0,-1*M)),n.push(this.productions_[N[1]][0]),_.push(Q.$),r.push(Q._$),It=Y[n[n.length-2]][n[n.length-1]],n.push(It);break;case 3:return!0}}return!0},"parse")},Qt=(function(){var U={EOF:1,parseError:S(function(u,n){if(this.yy.parser)this.yy.parser.parseError(u,n);else throw new Error(u)},"parseError"),setInput:S(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:S(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:S(function(l){var u=l.length,n=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===g.length?this.yylloc.first_column:0)+g[g.length-n.length].length-n[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:S(function(){return this._more=!0,this},"more"),reject:S(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:S(function(l){this.unput(this.match.slice(l))},"less"),pastInput:S(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:S(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:S(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/chunk-JWPE2WC7-DxHQQjxU.js b/amplifier_web/static/assets/chunk-JWPE2WC7-wq4F1yC9.js similarity index 78% rename from amplifier_web/static/assets/chunk-JWPE2WC7-DxHQQjxU.js rename to amplifier_web/static/assets/chunk-JWPE2WC7-wq4F1yC9.js index 5298b8341..887ce1430 100644 --- a/amplifier_web/static/assets/chunk-JWPE2WC7-DxHQQjxU.js +++ b/amplifier_web/static/assets/chunk-JWPE2WC7-wq4F1yC9.js @@ -1 +1 @@ -import{_ as l}from"./mermaid.core-CDlaSEyP.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; +import{_ as l}from"./mermaid.core-BQ5lTCZr.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; diff --git a/amplifier_web/static/assets/chunk-POPQ4Y6H-fljvmLmW.js b/amplifier_web/static/assets/chunk-POPQ4Y6H-C_hQ_kWj.js similarity index 87% rename from amplifier_web/static/assets/chunk-POPQ4Y6H-fljvmLmW.js rename to amplifier_web/static/assets/chunk-POPQ4Y6H-C_hQ_kWj.js index a92b1ef15..67e3587bc 100644 --- a/amplifier_web/static/assets/chunk-POPQ4Y6H-fljvmLmW.js +++ b/amplifier_web/static/assets/chunk-POPQ4Y6H-C_hQ_kWj.js @@ -1 +1 @@ -import{_ as a,d as w,l as x}from"./mermaid.core-CDlaSEyP.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; +import{_ as a,d as w,l as x}from"./mermaid.core-BQ5lTCZr.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; diff --git a/amplifier_web/static/assets/chunk-SVP7TREG-BBG-Pp77.js b/amplifier_web/static/assets/chunk-SVP7TREG-DegBQCYH.js similarity index 99% rename from amplifier_web/static/assets/chunk-SVP7TREG-BBG-Pp77.js rename to amplifier_web/static/assets/chunk-SVP7TREG-DegBQCYH.js index 2dc8f18a1..1d51b8f61 100644 --- a/amplifier_web/static/assets/chunk-SVP7TREG-BBG-Pp77.js +++ b/amplifier_web/static/assets/chunk-SVP7TREG-DegBQCYH.js @@ -1,4 +1,4 @@ -import{_ as p,l as k,D as H,y as B,p as q,E as G,d as U,i as j,c as K}from"./mermaid.core-CDlaSEyP.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),k.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),k.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};k.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&k.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),k.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` +import{_ as p,l as k,D as H,y as B,p as q,E as G,d as U,i as j,c as K}from"./mermaid.core-BQ5lTCZr.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),k.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),k.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};k.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&k.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),k.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` `),k.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),ie=p(()=>O,"getAccDescription"),ne=Y,ae=P,oe={clear:J,setTitle:Y,getTitle:P,addRule:Q,getRules:Z,getRule:V,setAccTitle:ee,getAccTitle:te,setAccDescription:re,getAccDescription:ie,setDiagramTitle:ne,getDiagramTitle:ae},f={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},le=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,se=/^[\w "',.-]+$/,de=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),L=p(e=>e?Object.keys(e).every(i=>i==="railroad"||de.has(i)):!1,"isRailroadStyleOptions"),ce=p(e=>e?"railroad"in e&&e.railroad?e.railroad:L(e)?e:{}:{},"extractRailroadOverrides"),me=p(e=>{if(!e||L(e))return{};const{railroad:i,svgId:a,theme:n,look:t,...r}=e;return r},"extractThemeOverrides"),m=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return le.test(a)?a:i},"sanitizeColorValue"),I=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return se.test(a)?a:i},"sanitizeFontFamilyValue"),F=p((e,i)=>{const a=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(a)&&a>=0?a:i},"sanitizeNumberValue"),he=p(e=>{const i=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(i)&&i>0?i:void 0},"parseThemeFontSize"),pe=p(e=>{const i=I(e.fontFamily,f.fontFamily),a=he(e.fontSize)??f.fontSize;return{...f,fontFamily:i,fontSize:a,terminalFill:m(e.secondBkg??e.secondaryColor,f.terminalFill),terminalStroke:m(e.secondaryBorderColor??e.lineColor,f.terminalStroke),terminalTextColor:m(e.secondaryTextColor??e.textColor,f.terminalTextColor),nonTerminalFill:m(e.mainBkg??e.background,f.nonTerminalFill),nonTerminalStroke:m(e.primaryBorderColor??e.lineColor,f.nonTerminalStroke),nonTerminalTextColor:m(e.primaryTextColor??e.textColor,f.nonTerminalTextColor),lineColor:m(e.lineColor,f.lineColor),markerFill:m(e.lineColor,f.markerFill),commentFill:m(e.labelBackground??e.tertiaryColor,f.commentFill),commentStroke:m(e.tertiaryBorderColor??e.lineColor,f.commentStroke),commentTextColor:m(e.tertiaryTextColor??e.textColor,f.commentTextColor),specialFill:m(e.tertiaryColor??e.secondaryColor,f.specialFill),specialStroke:m(e.tertiaryBorderColor??e.secondaryBorderColor,f.specialStroke),ruleNameColor:m(e.titleColor??e.textColor,f.ruleNameColor)}},"buildThemeDefaults"),E=p(e=>{const i=B(),a={...G(),...i.themeVariables??{},...me(e)},n=pe(a),t={...i.railroad??{},...ce(e)};return{compactMode:t.compactMode??n.compactMode,padding:F(t.padding,n.padding),verticalSeparation:F(t.verticalSeparation,n.verticalSeparation),horizontalSeparation:F(t.horizontalSeparation,n.horizontalSeparation),arcRadius:F(t.arcRadius,n.arcRadius),fontSize:F(t.fontSize,n.fontSize),fontFamily:I(t.fontFamily,n.fontFamily),terminalFill:m(t.terminalFill,n.terminalFill),terminalStroke:m(t.terminalStroke,n.terminalStroke),terminalTextColor:m(t.terminalTextColor,n.terminalTextColor),nonTerminalFill:m(t.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:m(t.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:m(t.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:m(t.lineColor,n.lineColor),strokeWidth:F(t.strokeWidth,n.strokeWidth),markerFill:m(t.markerFill,n.markerFill),commentFill:m(t.commentFill,n.commentFill),commentStroke:m(t.commentStroke,n.commentStroke),commentTextColor:m(t.commentTextColor,n.commentTextColor),specialFill:m(t.specialFill,n.specialFill),specialStroke:m(t.specialStroke,n.specialStroke),ruleNameColor:m(t.ruleNameColor,n.ruleNameColor),showMarkers:t.showMarkers??n.showMarkers,markerRadius:F(t.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),Te=p(e=>{const{fontFamily:i,fontSize:a,terminalFill:n,terminalStroke:t,terminalTextColor:r,nonTerminalFill:o,nonTerminalStroke:g,nonTerminalTextColor:l,lineColor:s,strokeWidth:h,markerFill:u,commentFill:c,commentStroke:w,commentTextColor:d,specialFill:T,specialStroke:z,ruleNameColor:S}=E(e);return` .railroad-diagram { font-family: ${i}; diff --git a/amplifier_web/static/assets/chunk-TICWLB2K-DG6NUFQe.js b/amplifier_web/static/assets/chunk-TICWLB2K--YXzYqRv.js similarity index 99% rename from amplifier_web/static/assets/chunk-TICWLB2K-DG6NUFQe.js rename to amplifier_web/static/assets/chunk-TICWLB2K--YXzYqRv.js index 79f97dd00..d18486cfd 100644 --- a/amplifier_web/static/assets/chunk-TICWLB2K-DG6NUFQe.js +++ b/amplifier_web/static/assets/chunk-TICWLB2K--YXzYqRv.js @@ -1,4 +1,4 @@ -import{g as st}from"./chunk-5VM5RSS4-DlVFuaV7.js";import{g as it}from"./chunk-XXDRQBXY-BvgnYF8f.js";import{s as at}from"./chunk-POPQ4Y6H-fljvmLmW.js";import{_ as g,l as we,c as F,u as rt,v as nt,x as Ve,j as fe,b as ut,a as lt,s as ct,g as ot,n as ht,o as dt,k as I,p as pt,q as At,i as ft,O as z}from"./mermaid.core-CDlaSEyP.js";import{f as gt}from"./chunk-F27PBJKO-D9qW0VD2.js";import{p as mt}from"./app-W22-ExtL.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: +import{g as st}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{g as it}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as at}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as g,l as we,c as F,u as rt,v as nt,x as Ve,j as fe,b as ut,a as lt,s as ct,g as ot,n as ht,o as dt,k as I,p as pt,q as At,i as ft,O as z}from"./mermaid.core-BQ5lTCZr.js";import{f as gt}from"./chunk-F27PBJKO-35QGDevQ.js";import{p as mt}from"./app-zsnl1T1T.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: `+D.showPosition()+` Expecting `+Ae.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Oe="Parse error on line "+(de+1)+": Unexpected "+(_==We?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Oe,{text:D.match,token:this.terminals_[_]||_,line:D.yylineno,loc:ve,expected:Ae})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+_);switch(L[0]){case 1:p.push(_),C.push(D.yytext),e.push(D.yylloc),p.push(L[1]),_=null,Ke=D.yyleng,t=D.yytext,de=D.yylineno,ve=D.yylloc;break;case 2:if(v=this.productions_[L[1]][1],U.$=C[C.length-v],U._$={first_line:e[e.length-(v||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(v||1)].first_column,last_column:e[e.length-1].last_column},et&&(U._$.range=[e[e.length-(v||1)].range[0],e[e.length-1].range[1]]),Ie=this.performAction.apply(U,[t,Ke,de,V.yy,L[1],C,e].concat($e)),typeof Ie<"u")return Ie;v&&(p=p.slice(0,-1*v*2),C=C.slice(0,-1*v),e=e.slice(0,-1*v)),p.push(this.productions_[L[1]][0]),C.push(U.$),e.push(U._$),je=ee[p[p.length-2]][p[p.length-1]],p.push(je);break;case 3:return!0}}return!0},"parse")},Je=(function(){var O={EOF:1,parseError:g(function(d,p){if(this.yy.parser)this.yy.parser.parseError(d,p);else throw new Error(d)},"parseError"),setInput:g(function(o,d){return this.yy=d||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var d=o.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:g(function(o){var d=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===l.length?this.yylloc.first_column:0)+l[l.length-p.length].length-p[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(o){this.unput(this.match.slice(o))},"less"),pastInput:g(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var o=this.pastInput(),d=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/chunk-XXDRQBXY-BvgnYF8f.js b/amplifier_web/static/assets/chunk-XXDRQBXY-DdE0HtLo.js similarity index 72% rename from amplifier_web/static/assets/chunk-XXDRQBXY-BvgnYF8f.js rename to amplifier_web/static/assets/chunk-XXDRQBXY-DdE0HtLo.js index 39ca203f1..94a29fd52 100644 --- a/amplifier_web/static/assets/chunk-XXDRQBXY-BvgnYF8f.js +++ b/amplifier_web/static/assets/chunk-XXDRQBXY-DdE0HtLo.js @@ -1 +1 @@ -import{_ as a,j as o}from"./mermaid.core-CDlaSEyP.js";var g=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{g}; +import{_ as a,j as o}from"./mermaid.core-BQ5lTCZr.js";var g=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{g}; diff --git a/amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js b/amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js new file mode 100644 index 000000000..2ea1526bf --- /dev/null +++ b/amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K--YXzYqRv.js";import{_ as i}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-5VM5RSS4-XkKVGNmc.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/classDiagram-ZZMXUADV-Deegt-EK.js b/amplifier_web/static/assets/classDiagram-ZZMXUADV-Deegt-EK.js deleted file mode 100644 index 75155bcef..000000000 --- a/amplifier_web/static/assets/classDiagram-ZZMXUADV-Deegt-EK.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-DG6NUFQe.js";import{_ as i}from"./mermaid.core-CDlaSEyP.js";import"./chunk-5VM5RSS4-DlVFuaV7.js";import"./chunk-XXDRQBXY-BvgnYF8f.js";import"./chunk-POPQ4Y6H-fljvmLmW.js";import"./chunk-F27PBJKO-D9qW0VD2.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js b/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js new file mode 100644 index 000000000..2ea1526bf --- /dev/null +++ b/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K--YXzYqRv.js";import{_ as i}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-5VM5RSS4-XkKVGNmc.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-Deegt-EK.js b/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-Deegt-EK.js deleted file mode 100644 index 75155bcef..000000000 --- a/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-Deegt-EK.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-DG6NUFQe.js";import{_ as i}from"./mermaid.core-CDlaSEyP.js";import"./chunk-5VM5RSS4-DlVFuaV7.js";import"./chunk-XXDRQBXY-BvgnYF8f.js";import"./chunk-POPQ4Y6H-fljvmLmW.js";import"./chunk-F27PBJKO-D9qW0VD2.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/cose-bilkent-JH36ORCC-C7XBKZ-1.js b/amplifier_web/static/assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js similarity index 99% rename from amplifier_web/static/assets/cose-bilkent-JH36ORCC-C7XBKZ-1.js rename to amplifier_web/static/assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js index 3cc3d8aa4..40eb1fca2 100644 --- a/amplifier_web/static/assets/cose-bilkent-JH36ORCC-C7XBKZ-1.js +++ b/amplifier_web/static/assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js @@ -1 +1 @@ -import{_ as V,l as k,j as lt}from"./mermaid.core-CDlaSEyP.js";import{c as tt}from"./cytoscape.esm-Ix0LnXOy.js";import{g as gt}from"./client-BPXDbY79.js";import"./app-W22-ExtL.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,q;function ft(){return q||(q=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var j=(c+F*W)%360,ht=(j+W)%360;y.branchRadialLayout(K,s,j,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render}; +import{_ as V,l as k,j as lt}from"./mermaid.core-BQ5lTCZr.js";import{c as tt}from"./cytoscape.esm-Ix0LnXOy.js";import{g as gt}from"./client-BPXDbY79.js";import"./app-zsnl1T1T.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,q;function ft(){return q||(q=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var j=(c+F*W)%360,ht=(j+W)%360;y.branchRadialLayout(K,s,j,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render}; diff --git a/amplifier_web/static/assets/cynefin-OW5HDTMX-BZuqA1Xc.js b/amplifier_web/static/assets/cynefin-OW5HDTMX-C5aohCXI.js similarity index 99% rename from amplifier_web/static/assets/cynefin-OW5HDTMX-BZuqA1Xc.js rename to amplifier_web/static/assets/cynefin-OW5HDTMX-C5aohCXI.js index 2b943fd03..14290e853 100644 --- a/amplifier_web/static/assets/cynefin-OW5HDTMX-BZuqA1Xc.js +++ b/amplifier_web/static/assets/cynefin-OW5HDTMX-C5aohCXI.js @@ -1,4 +1,4 @@ -var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./app-W22-ExtL.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` +var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./app-zsnl1T1T.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` `,`\r `,"\r"],(function(a){function i(c,f,d,p){return new iv(c,f,d,p)}s(i,"create"),a.create=i;function o(c){let f=c;return!!(C.defined(f)&&C.string(f.uri)&&(C.undefined(f.languageId)||C.string(f.languageId))&&C.uinteger(f.lineCount)&&C.func(f.getText)&&C.func(f.positionAt)&&C.func(f.offsetAt))}s(o,"is"),a.is=o;function u(c,f){let d=c.getText(),p=l(f,(y,v)=>{let E=y.range.start.line-v.range.start.line;return E===0?y.range.start.character-v.range.start.character:E}),h=d.length;for(let y=p.length-1;y>=0;y--){let v=p[y],E=c.offsetAt(v.range.start),T=c.offsetAt(v.range.end);if(T<=h)d=d.substring(0,E)+v.newText+d.substring(T,d.length);else throw new Error("Overlapping edit");h=E}return d}s(u,"applyEdits"),a.applyEdits=u;function l(c,f){if(c.length<=1)return c;const d=c.length/2|0,p=c.slice(0,d),h=c.slice(d);l(p,f),l(h,f);let y=0,v=0,E=0;for(;y({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(V,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,R=o.boundaryAmplitude,_=i+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(i,f),Z=it(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,I=u.cx-C/2;M.attr("transform",`translate(${I}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),I=C*.15,G=-x/C,ht=$/C,et=M+G*I,nt=P+ht*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Vt();return` +import{p as xt}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{s as gt,g as $t,o as bt,n as wt,a as Ct,b as vt,_ as s,l as O,D as Dt,d as kt,p as At,A as U,y as Q,B as Tt,E as ot}from"./mermaid.core-BQ5lTCZr.js";import{p as Bt}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(V,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,R=o.boundaryAmplitude,_=i+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(i,f),Z=it(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,I=u.cx-C/2;M.attr("transform",`translate(${I}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),I=C*.15,G=-x/C,ht=$/C,et=M+G*I,nt=P+ht*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Vt();return` .cynefinDomain { stroke: none; } diff --git a/amplifier_web/static/assets/dagre-GXQ25YYZ-BPre4f4O.js b/amplifier_web/static/assets/dagre-GXQ25YYZ-DqSq41IB.js similarity index 98% rename from amplifier_web/static/assets/dagre-GXQ25YYZ-BPre4f4O.js rename to amplifier_web/static/assets/dagre-GXQ25YYZ-DqSq41IB.js index 0d7507c24..0e77a1442 100644 --- a/amplifier_web/static/assets/dagre-GXQ25YYZ-BPre4f4O.js +++ b/amplifier_web/static/assets/dagre-GXQ25YYZ-DqSq41IB.js @@ -1,4 +1,4 @@ -import{_ as m,an as D,c as A,P as Y,l as p,ao as _,ap as z,aq as b,ar as H,as as J,at as T,au as R,av as F,aw as q,ax as C,ag as P,ae as W,ay as j,az as U}from"./mermaid.core-CDlaSEyP.js";import{l as K}from"./layout-KwbWDr7K.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Q=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(E=>s.push(E));return}c.sort((E,x)=>E.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(E=>s.push(E));return}const w={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,w.width??0),n=ee(a,f,y,e,w),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:w.width,height:w.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),G=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=H(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=Q(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX +import{_ as m,an as D,c as A,P as Y,l as p,ao as _,ap as z,aq as b,ar as H,as as J,at as T,au as R,av as F,aw as q,ax as C,ag as P,ae as W,ay as j,az as U}from"./mermaid.core-BQ5lTCZr.js";import{l as K}from"./layout-xx7K6ykp.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Q=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(E=>s.push(E));return}c.sort((E,x)=>E.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(E=>s.push(E));return}const w={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,w.width??0),n=ee(a,f,y,e,w),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:w.width,height:w.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),G=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=H(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=Q(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX Node.id = `,f,` data=`,u.height,` Parent cluster`,s.height),e.setNode(s.id,u),e.parent(f)||(p.trace("Setting parent",f,s.id),e.setParent(f,s.id,u))}if(p.info("(Insert) Node XXX"+f+": "+JSON.stringify(e.node(f))),n!=null&&n.clusterNode){p.info("Cluster identified XBX",f,n.width,e.node(f));const{ranksep:u,nodesep:E}=e.graph();n.graph.setGraph({...n.graph.graph(),ranksep:u+25,nodesep:E});const x=await ne({element:l,graph:n.graph,diagramType:d,id:g,parentCluster:e.node(f),siteConfig:h}),S=x.elem;J(n,S),n.diff=x.diff||0,p.info("New compound node after recursive render XAX",f,"width",n.width,"height",n.height),T(S,n)}else e.children(f).length>0?(p.trace("Cluster - the non recursive path XBX",f,n.id,n,n.width,"Graph:",e),p.trace(R(n.id,e)),b.set(n.id,{id:R(n.id,e),node:n})):(p.trace("Node - the non recursive path XAX",f,l,e.node(f),L),await F(l,e.node(f),{config:h,dir:L}))})),await m(async()=>{const f=e.edges().map(async function(n){var E,x,S,X;const u=e.edge(n.v,n.w,n.name);if(p.info("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),p.info("Edge "+n.v+" -> "+n.w+": ",n," ",JSON.stringify(e.edge(n))),p.info("Fix",b,"ids:",n.v,n.w,"Translating: ",b.get(n.v),b.get(n.w)),a&&u.selfLoop){if(u.selfLoop.order!==1)return;const N={...u.originalEdge,...u,id:u.selfLoop.id,startLabelLeft:((E=u.originalEdge)==null?void 0:E.startLabelLeft)??u.startLabelLeft,startLabelRight:((x=u.originalEdge)==null?void 0:x.startLabelRight)??u.startLabelRight,endLabelLeft:((S=u.originalEdge)==null?void 0:S.endLabelLeft)??u.endLabelLeft,endLabelRight:((X=u.originalEdge)==null?void 0:X.endLabelRight)??u.endLabelRight};await C(o,N),u.width=N.width,u.height=N.height,u.labelStyle=N.labelStyle;return}await C(o,u)});await Promise.all(f)},"processEdges")();const{subGraphTitleTotalMargin:y}=q(h);return{elem:r,graph:e,groups:{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r},diagramType:d,id:g,mergeSelfLoops:a,subGraphTitleTotalMargin:y}},"measureDagreGraph"),k=m(t=>{p.info("############################################# XXX"),p.info("### Layout ### XXX"),p.info("############################################# XXX"),K(t)},"runDagreGraphLayout"),te=m((t,e,d)=>{const g=t.node(e);if(!g)return;const s={...g};return g!=null&&g.clusterNode?s.y=(g.y??0)+d:t.children(e).length>0?s.height=(g.height??0)+d:s.y=(g.y??0)+d/2,s},"normalizeDagreNode"),I=m((t,e)=>{V.forEach(d=>{e[d]!==void 0&&(t[d]=e[d])})},"applyDagreNodeLayout"),re=m((t,e,d,g)=>({...t,start:t.start??e,end:t.end??d,points:(t.points??[]).map(s=>({...s,y:typeof s.y=="number"?s.y+g:s.y}))}),"normalizeDagreEdge"),ae=m((t,e)=>{const{graph:d,mergeSelfLoops:g,subGraphTitleTotalMargin:s=0}=e,h=new Map(t.nodes.map(c=>[c.id,c]));D(d).forEach(c=>{const i=te(d,c,s);if(!i)return;I(d.node(c),i);const o=h.get(c);o&&I(o,i)});const L=s/2;return t.edges=M(d,L,{mergeSelfLoops:g}).map(({edge:c,start:i,end:o})=>re(c,i,o,L)),t},"applyDagreLayoutResult"),oe=m(async({elem:t,graph:e,groups:{clusters:d,edgePaths:g},diagramType:s,id:h,mergeSelfLoops:L,subGraphTitleTotalMargin:c})=>{let i=0;await Promise.all(D(e).map(async function(r){var w;const a=e.node(r);if(p.info("Position XBX => "+r+": ("+a.x,","+a.y,") width: ",a.width," height: ",a.height),a!=null&&a.clusterNode)a.y+=c,p.info("A tainted cluster node XBX1",r,a.id,a.width,a.height,a.x,a.y,e.parent(r)),b.get(a.id).node=a,P(a);else if(e.children(r).length>0){p.info("A pure cluster node XBX1",r,a.id,a.x,a.y,a.width,a.height,e.parent(r)),a.height+=c,e.node(a.parentId);const y=(a==null?void 0:a.padding)/2||0,f=((w=a==null?void 0:a.labelBBox)==null?void 0:w.height)||0,n=f-y||0;p.debug("OffsetY",n,"labelHeight",f,"halfPadding",y),await W(d,a),b.get(a.id).node=a}else{const y=e.node(a.parentId);a.y+=c/2,p.info("A regular node XBX1 - using the padding",a.id,"parent",a.parentId,a.width,a.height,a.x,a.y,"offsetY",a.offsetY,"parent",y,y==null?void 0:y.offsetY,a),P(a)}}));const o=c/2;return M(e,o,{mergeSelfLoops:L}).forEach(function({edge:r,start:a,end:w}){p.info("Edge "+a+" -> "+w+": "+JSON.stringify(r),r),r.points.forEach(u=>u.y+=o);const y=e.node(a),f=e.node(w),n=j(g,r,b,s,y,f,h);U(r,n)}),e.nodes().forEach(function(r){const a=e.node(r);p.info(r,a.type,a.diff),a.isGroup&&(i=a.diff)}),p.warn("Returning from recursive render XAX",t,i),{elem:t,diff:i}},"paintDagreLayoutCore"),ne=m(async t=>{const e=await G(t);return k(e.graph),await oe(e)},"renderDagreSubgraph"),O=m(t=>{var d,g,s,h,L,c;const e=new Y({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:((d=t.config)==null?void 0:d.nodeSpacing)||t.nodeSpacing||((s=(g=t.config)==null?void 0:g.flowchart)==null?void 0:s.nodeSpacing),ranksep:((h=t.config)==null?void 0:h.rankSpacing)||t.rankSpacing||((c=(L=t.config)==null?void 0:L.flowchart)==null?void 0:c.rankSpacing),marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return t.nodes.forEach(i=>{e.setNode(i.id,{...i}),i.parentId&&e.setParent(i.id,i.parentId)}),p.debug("Edges:",t.edges),t.edges.forEach(i=>{if(i.start===i.end){const o=i.start,l=o+"---"+o+"---1",r=o+"---"+o+"---2",a=e.node(o);e.setNode(l,{domId:l,id:l,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(l,a.parentId),e.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(r,a.parentId);const w=structuredClone(i),y=structuredClone(i),f=structuredClone(i),n=structuredClone(i);y.originalEdge=w,y.selfLoop={id:w.id,order:0},f.originalEdge=w,f.selfLoop={id:w.id,order:1},n.originalEdge=w,n.selfLoop={id:w.id,order:2},y.label="",y.arrowTypeEnd="none",y.endLabelLeft="",y.endLabelRight="",y.startLabelLeft="",y.id=o+"-cyclic-special-1",f.startLabelRight="",f.startLabelLeft="",f.endLabelLeft="",f.endLabelRight="",f.arrowTypeStart="none",f.arrowTypeEnd="none",f.id=o+"-cyclic-special-mid",n.label="",n.startLabelRight="",n.startLabelLeft="",n.arrowTypeStart="none",a.isGroup&&(y.fromCluster=o,n.toCluster=o),n.id=o+"-cyclic-special-2",n.arrowTypeStart="none",e.setEdge(o,l,y,o+"-cyclic-special-0"),e.setEdge(l,r,f,o+"-cyclic-special-1"),e.setEdge(r,o,n,o+"-cyclic-special-2")}else e.setEdge(i.start,i.end,{...i},i.id)}),_(e),{graph:e}},"prepareLayoutForDagre"),se=m(async(t,{element:e,preparedLayout:d})=>{const g=d??O(t),s=A(),h=await G({element:e,graph:g.graph,diagramType:t.type,id:t.diagramId,parentCluster:void 0,siteConfig:s});return g.measuredLayout=h,h},"measureDagreLayout"),ie=m((t,e)=>{var g;const d=(g=e.preparedLayout)==null?void 0:g.measuredLayout;if(!d)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return k(d.graph),ae(t,d),d},"runDagreLayoutCore"),de=m((t,{measure:e})=>D(e.graph).map(d=>e.graph.node(d)).filter(Boolean),"getDagrePaintNodes"),le=m((t,e,{measure:d})=>t?d.graph.node(t):void 0,"getDagreEdgeNode"),ue=z({prepareLayout:O,measureLayout:se,runLayoutCore:ie,paintOptions:{clusterDb:b,getNodes:de,getEdgeNode:le,skipNode:m((t,{measure:e})=>!e.graph.hasNode(t.id),"skipNode"),isCluster:m((t,{measure:e})=>e.graph.hasNode(t.id)&&(e.graph.children(t.id)??[]).length>0,"isCluster")}});export{ae as applyDagreLayoutResult,M as getEdgesToRender,se as measureDagreLayout,O as prepareLayoutForDagre,ue as render,ie as runDagreLayoutCore}; diff --git a/amplifier_web/static/assets/diagram-S7CK7UJ4-BS8K541U.js b/amplifier_web/static/assets/diagram-S7CK7UJ4-Bhn2u9og.js similarity index 96% rename from amplifier_web/static/assets/diagram-S7CK7UJ4-BS8K541U.js rename to amplifier_web/static/assets/diagram-S7CK7UJ4-Bhn2u9og.js index bf7c2058a..3735bf02c 100644 --- a/amplifier_web/static/assets/diagram-S7CK7UJ4-BS8K541U.js +++ b/amplifier_web/static/assets/diagram-S7CK7UJ4-Bhn2u9og.js @@ -1,4 +1,4 @@ -import{I as X}from"./chunk-2Q5K7J3B-CLX5dmV-.js";import{p as z}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{n as O,b as G,s as Y,o as P,g as F,a as Z,_ as g,A,l as E,D as j,d as q,y as D,p as U,i as J,aj as K,B as Q,ak as ee}from"./mermaid.core-CDlaSEyP.js";import{p as te}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var L=/[─━│┃└┗├┣]/,_=/[└┗├┣]/,re=/[─━]/,T=/^[\s│┃]+$/,V=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,$=/^\s*%%/,ne=" ";function S(r){return r.some(t=>L.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` +import{I as X}from"./chunk-2Q5K7J3B-DR5XPUmF.js";import{p as z}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{n as O,b as G,s as Y,o as P,g as F,a as Z,_ as g,A,l as E,D as j,d as q,y as D,p as U,i as J,aj as K,B as Q,ak as ee}from"./mermaid.core-BQ5lTCZr.js";import{p as te}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var L=/[─━│┃└┗├┣]/,_=/[└┗├┣]/,re=/[─━]/,T=/^[\s│┃]+$/,V=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,$=/^\s*%%/,ne=" ";function S(r){return r.some(t=>L.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` `),e=new Map;let i=-1;for(const[d,l]of t.entries())if(l.trim()==="treeView-beta"){i=d;break}if(i===-1)return{text:r,lineMap:e};const s=[];for(let d=i+1;d({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),U()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>A(ae,D().treeView),"getConfig"),le=g((r,t,e,i,s,o)=>{for(;r<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const n={id:x.records.cnt++,level:r,name:t,nodeType:e,icon:s,cssClass:i,description:o,children:[]};x.records.stack[x.records.stack.length-1].children.push(n),x.records.stack.push(n)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:F,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:O},I=de,he=g(r=>{z(r,I);for(const t of r.nodes){const e=typeof t.indent=="number"?t.indent:0;let i=t.name;const s=i.endsWith("/");s&&(i=i.slice(0,-1));const o=s?"directory":"file",n=t.classAnnotation||void 0,c=t.iconAnnotation,d=c!==void 0?c||"none":void 0,l=t.descAnnotation||void 0,u=l?J(l,D()):void 0;I.addNode(e,i,o,n,d,u)}},"populate"),pe={parse:g(async r=>{const{text:t,lineMap:e}=H(r);try{const i=await te("treeView",t);E.debug(i),he(i)}catch(i){throw e.size>0&&i instanceof Error&&(i.message=R(i.message,e)),i}},"parse")},C={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};function W(r,t){var s;const e=(s=t==null?void 0:t.filenameIcons)==null?void 0:s[r];if(e)return e;const i=r.lastIndexOf(".");if(i>0){const o=r.substring(i).toLowerCase(),n=t==null?void 0:t.extensionIcons;return(n==null?void 0:n[o])??(n==null?void 0:n[o.slice(1)])}}g(W,"detectIcon");function y(r,t){return r.includes(":")?r:r in C.icons||!t?`${C.prefix}:${r}`:`${t}:${r}`}g(y,"qualifyIcon");function k(r,t){if(r.icon!=="none"){if(r.icon)return y(r.icon,t.defaultIconPack);if(t.showIcons){if(r.nodeType==="file"){const e=W(r.name,t);if(e==="none")return;if(e)return y(e,t.defaultIconPack)}return`${C.prefix}:${r.nodeType==="directory"?"folder":"file"}`}}}g(k,"getNodeIcon");ee([{name:C.prefix,icons:C}]);var B=14,ge=4,fe=16,ue=g(async(r,t)=>{const e=[],i=g(o=>{const n=k(o,t);n&&e.push({icon:n,node:o}),o.children.forEach(i)},"collect");i(r);const s=await Promise.all(e.map(async({icon:o,node:n})=>({id:n.id,svg:await K(o,{height:B,width:B})})));return new Map(s.map(({id:o,svg:n})=>[o,n]))},"resolveNodeIcons"),we=g((r,t,e,i,s,o)=>{var b;const n=i.append("g");let c="treeView-node-label";e.nodeType==="directory"&&(c+=" treeView-node-dir"),e.cssClass&&(c+=` ${e.cssClass}`);const d=B+ge,l=k(e,s),u=l!==void 0;l&&n.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${r+s.paddingX}, ${t+s.paddingY})`).html(o.get(e.id)??"");const a=n.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",c),{height:p,width:h}=a.node().getBBox(),m=p+s.paddingY*2,w=r+s.paddingX+(u?d:0);a.attr("x",w),a.attr("y",t+m/2);const f=w+h,v=h+s.paddingX*2+(u?d:0);return e.BBox={x:r,y:t,width:v,height:m},(b=e.cssClass)!=null&&b.split(/\s+/).includes("highlight")&&n.insert("rect",":first-child").attr("x",r).attr("y",t+1).attr("width",0).attr("height",m-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:n,labelRightEdge:f,centerY:t+m/2}},"positionLabel"),N=g((r,t,e,i,s,o)=>r.append("line").attr("x1",t).attr("y1",e).attr("x2",i).attr("y2",s).attr("stroke-width",o).attr("class","treeView-node-line"),"positionLine"),me=g((r,t,e,i)=>{var u;let s=0,o=0;const n=[],c=g((a,p,h,m)=>{const w=m*(h.rowIndent+h.paddingX),f=we(w,s,p,a,h,i);n.push(f);const{height:v,width:b}=p.BBox;N(a,w-h.rowIndent,s+v/2,w,s+v/2,h.lineThickness),o=Math.max(o,w+b),s+=v},"drawNode"),d=g((a,p=0)=>{c(r,a,e,p),a.children.forEach(f=>{d(f,p+1)});const{x:h,y:m,height:w}=a.BBox;if(a.children.length){const{y:f,height:v}=a.children[a.children.length-1].BBox;N(r,h+e.paddingX,m+w,h+e.paddingX,f+v/2+e.lineThickness/2,e.lineThickness)}},"processNode");d(t);const l=n.filter(a=>a.node.description);if(l.length>0){const p=Math.max(...n.map(h=>h.labelRightEdge))+fe;for(const h of l){const w=h.nodeGroup.append("text").text(h.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",h.centerY).node().getBBox();o=Math.max(o,p+w.width+e.paddingX)}}for(const a of n)if((u=a.node.cssClass)!=null&&u.split(/\s+/).includes("highlight")){const p=a.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const h=o-a.node.BBox.x+8;p.attr("width",h),o=Math.max(o,a.node.BBox.x+h+2)}}return{totalHeight:s,totalWidth:o}},"drawTree"),ve=g(async(r,t,e,i)=>{E.debug(`Rendering treeView diagram `+r);const s=i.db,o=s.getRoot(),n=s.getConfig(),c=j(t),d=c.append("g");d.attr("class","tree-view");const l=await ue(o,n),{totalHeight:u,totalWidth:a}=me(d,o,n,l);c.attr("viewBox",`-${n.lineThickness/2} 0 ${a} ${u}`),q(c,u,a,n.useMaxWidth)},"draw"),xe={draw:ve},be=xe,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ie=g(({treeView:r})=>{const{labelFontSize:t,labelColor:e,lineColor:i,iconColor:s,descriptionColor:o,highlightBg:n,highlightStroke:c}=A(Ce,r);return` diff --git a/amplifier_web/static/assets/diagram-UQ7AKVKN-C84fy4x0.js b/amplifier_web/static/assets/diagram-UQ7AKVKN-CsDpBRwj.js similarity index 95% rename from amplifier_web/static/assets/diagram-UQ7AKVKN-C84fy4x0.js rename to amplifier_web/static/assets/diagram-UQ7AKVKN-CsDpBRwj.js index db87ec9d7..878c01487 100644 --- a/amplifier_web/static/assets/diagram-UQ7AKVKN-C84fy4x0.js +++ b/amplifier_web/static/assets/diagram-UQ7AKVKN-CsDpBRwj.js @@ -1,4 +1,4 @@ -import{p as I}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{s as _,g as E,o as D,n as F,a as P,b as z,_ as c,D as G,p as B,A as w,y as C,B as W,l as b,E as V,d as H}from"./mermaid.core-CDlaSEyP.js";import{p as j}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),U=W.radar,X=c(()=>w({...U,...C().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:z,getAccTitle:P,setDiagramTitle:F,getDiagramTitle:D,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),p=G(t),u=rt(p,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(u,n,v,o.ticks,o.graticule),nt(u,n,v,i),L(u,n,l,h,g,o.graticule,i),k(u,l,o.showLegend,i),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const u=2*p*Math.PI/n-Math.PI/2,g=o*Math.cos(u),h=o*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(u,l.curveTension)).attr("class",`radarCurve-${p}`):n==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rw({...U,...C().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:z,getAccTitle:P,setDiagramTitle:F,getDiagramTitle:D,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),p=G(t),u=rt(p,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(u,n,v,o.ticks,o.graticule),nt(u,n,v,i),L(u,n,l,h,g,o.graticule,i),k(u,l,o.showLegend,i),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const u=2*p*Math.PI/n-Math.PI/2,g=o*Math.cos(u),h=o*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(u,l.curveTension)).attr("class",`radarCurve-${p}`):n==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rhe({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let l;q(i)?(g.debug("source frame",i.sourceFrames),l=n.frames.filter(d=>i.sourceFrames.some(c=>c.$refText===d.name)),l.forEach(d=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:d})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const l={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,l)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,l),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ +import{p as oe}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{o as se,n as le,s as de,g as ce,a as me,b as ue,_ as o,l as g,c as T,j as xe,z as fe,p as ge,A as he,y as E,B as pe,i as P,w as S,al as be}from"./mermaid.core-BQ5lTCZr.js";import{p as ve,i as we}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var D="position frame",N="frame positioned",M="position relation",C="relation positioned",ye=o(function(e){g.debug("options str",e)},"setOptions"),Pe=o(function(){return{}},"getOptions"),Se=o(function(){O(),ge()},"clear");function O(){A={}}o(O,"reset");var ke=pe.eventmodeling,Me=o(()=>he({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let l;q(i)?(g.debug("source frame",i.sourceFrames),l=n.frames.filter(d=>i.sourceFrames.some(c=>c.$refText===d.name)),l.forEach(d=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:d})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const l={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,l)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,l),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,l),r=r.replaceAll(" "," "),r+="
")}const m=r!==void 0;m&&(c+=`

${r}`);const x={fontSize:l.fontSize,fontWeight:l.fontWeight,fontFamily:l.fontFamily},u=be(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(X,"calculateTextProps");function j(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:N,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(j,"decidePositionFrame");function G(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(G,"calculateX");function Y(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(Y,"calculateMaxRight");function $(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o($,"sortedSwimlanesArray");function z(e,n){const t=n,i=V(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,l=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,d={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=G(a,l,r),m=c+d.width+s.boxPadding,x=Y(Object.values(e.swimlanes),m);a.r=c+d.width,a.maxHeight=Math.max(a.maxHeight,d.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:d,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=$(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p0}o(q,"hasSourceFrame");function B(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(B,"findBoxByFrame");function J(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(J,"findBoxByLineIndex");function Q(e,n){const t=n;if(we(t.frame)||K(t.index,t.frame))return[];const i=B(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=B(e.boxes,t.sourceFrame):a=J(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:C,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(Q,"decidePositionRelation");function Z(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Z,"evolveRelationPositioned");var Fe={[D]:j,[M]:Q},Ee={[N]:z,[C]:Z};function ee(e,n){const t=Fe[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(ee,"decide");function te(e,n){const t=n.reduce((i,a)=>{const r=Ee[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(te,"evolve");function w(e,n){const t=ee(e,n);return te(e,t)}o(w,"dispatch");var F={getConfig:Me,setOptions:ye,getOptions:Pe,clear:Se,setAccTitle:ue,getAccTitle:me,getAccDescription:ce,setAccDescription:de,setDiagramTitle:le,getDiagramTitle:se,setAst:I,getDiagramProps:R,getState:W},Ae={parse:o(async e=>{const n=await ve("eventmodeling",e);g.debug(n),F.setAst(n),oe(n,F)},"parse")},k=T(),Re=k==null?void 0:k.eventmodeling;function ne(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(ne,"renderD3Box");function ie(e,n){return e>n}o(ie,"dirUpwards");function ae(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,l=a.targetBox.swimlane.y+n.swimlanePadding,d=ie(r,l),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${d} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),d?(x=r,u=l+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=l);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ae,"renderD3Relation");function re(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),l=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",d=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",l).attr("stroke",d),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(re,"renderD3Swimlane");var $e=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+` `,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:l}=T(),d=xe(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(re(d,m.maxR,c,r)),m.boxes.forEach(ne(d,c)),m.relations.forEach(ae(d,c,x,r)),d.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),fe(void 0,d,(l==null?void 0:l.padding)??30,l==null?void 0:l.useMaxWidth)},"draw"),Te={draw:$e},De=o(e=>"","getStyles"),Ne=De,Ue={parser:Ae,db:F,renderer:Te,styles:Ne};export{Ue as diagram}; diff --git a/amplifier_web/static/assets/diagram-VX7I27RA-DnjjslPi.js b/amplifier_web/static/assets/diagram-VX7I27RA-DYKyI2lv.js similarity index 98% rename from amplifier_web/static/assets/diagram-VX7I27RA-DnjjslPi.js rename to amplifier_web/static/assets/diagram-VX7I27RA-DYKyI2lv.js index 4cb9727b7..9bc947d61 100644 --- a/amplifier_web/static/assets/diagram-VX7I27RA-DnjjslPi.js +++ b/amplifier_web/static/assets/diagram-VX7I27RA-DYKyI2lv.js @@ -1,4 +1,4 @@ -import{p as ge}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{_ as w,E as ye,y as ae,A as ee,D as Se,d as ve,l as te,bc as B,j as U,b as xe,a as be,n as we,o as Ce,g as Te,s as Le,B as $e,bd as Ae,p as Fe}from"./mermaid.core-CDlaSEyP.js";import{s as Ne}from"./chunk-POPQ4Y6H-fljvmLmW.js";import{p as Me}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import{b as O}from"./defaultLocale-DX6XiGOO.js";import{o as Q}from"./ordinal-Cboi1Yqb.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function je(t){return t.children}function Ye(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=u*u*W,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function p(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,u=i.x1-x,y=i.y1-x;u{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const p=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let u;try{const e=s.valueFormat||",";if(e==="$0,0")u=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";u=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);u=w(f=>"$"+O(o||"")(f),"valueFormat")}else u=O(e)}catch(e){te.error("Error creating format function:",e),u=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?u(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,pe=A?16:38,j=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);Y.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${pe}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(j,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(j,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${j}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?u(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(j,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` +import{p as ge}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as w,E as ye,y as ae,A as ee,D as Se,d as ve,l as te,bc as B,j as U,b as xe,a as be,n as we,o as Ce,g as Te,s as Le,B as $e,bd as Ae,p as Fe}from"./mermaid.core-BQ5lTCZr.js";import{s as Ne}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{p as Me}from"./cynefin-OW5HDTMX-C5aohCXI.js";import{b as O}from"./defaultLocale-DX6XiGOO.js";import{o as Q}from"./ordinal-Cboi1Yqb.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function je(t){return t.children}function Ye(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=u*u*W,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function p(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,u=i.x1-x,y=i.y1-x;u{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const p=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let u;try{const e=s.valueFormat||",";if(e==="$0,0")u=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";u=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);u=w(f=>"$"+O(o||"")(f),"valueFormat")}else u=O(e)}catch(e){te.error("Error creating format function:",e),u=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?u(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,pe=A?16:38,j=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);Y.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${pe}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(j,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(j,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${j}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?u(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(j,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` .treemapNode.section { stroke: ${r.sectionStrokeColor}; stroke-width: ${r.sectionStrokeWidth}; diff --git a/amplifier_web/static/assets/diagram-Z3DM3KII-CCO8xWsb.js b/amplifier_web/static/assets/diagram-Z3DM3KII-C7wRZKVi.js similarity index 94% rename from amplifier_web/static/assets/diagram-Z3DM3KII-CCO8xWsb.js rename to amplifier_web/static/assets/diagram-Z3DM3KII-C7wRZKVi.js index 095f01806..759549afd 100644 --- a/amplifier_web/static/assets/diagram-Z3DM3KII-CCO8xWsb.js +++ b/amplifier_web/static/assets/diagram-Z3DM3KII-C7wRZKVi.js @@ -1,4 +1,4 @@ -import{p as $}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{_ as b,A as m,D as C,d as S,l as w,b as D,a as T,n as P,o as z,g as A,s as E,y as F,B as W,p as _}from"./mermaid.core-CDlaSEyP.js";import{p as N}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var L=W.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=P,this.getDiagramTitle=z,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=m({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,Y=b((e,t)=>{$(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,B]of p.entries())j(f,B,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=m(H,e);return` +import{p as $}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as b,A as m,D as C,d as S,l as w,b as D,a as T,n as P,o as z,g as A,s as E,y as F,B as W,p as _}from"./mermaid.core-BQ5lTCZr.js";import{p as N}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var L=W.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=P,this.getDiagramTitle=z,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=m({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,Y=b((e,t)=>{$(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,B]of p.entries())j(f,B,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=m(H,e);return` .packetByte { font-size: ${t.byteFontSize}; } diff --git a/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-HFPcjqY1.js b/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-CsupTakH.js similarity index 87% rename from amplifier_web/static/assets/ebnfDiagram-PWID7BFC-HFPcjqY1.js rename to amplifier_web/static/assets/ebnfDiagram-PWID7BFC-CsupTakH.js index 516ecf2c4..31f96d2ee 100644 --- a/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-HFPcjqY1.js +++ b/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-CsupTakH.js @@ -1 +1 @@ -import{g as l,r as m,d as n}from"./chunk-SVP7TREG-BBG-Pp77.js";import{p}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{_ as t,l as o}from"./mermaid.core-CDlaSEyP.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; +import{g as l,r as m,d as n}from"./chunk-SVP7TREG-DegBQCYH.js";import{p}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as t,l as o}from"./mermaid.core-BQ5lTCZr.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; diff --git a/amplifier_web/static/assets/erDiagram-RLTQ6QDP-D5xxq6f8.js b/amplifier_web/static/assets/erDiagram-RLTQ6QDP-DV4h776D.js similarity index 99% rename from amplifier_web/static/assets/erDiagram-RLTQ6QDP-D5xxq6f8.js rename to amplifier_web/static/assets/erDiagram-RLTQ6QDP-DV4h776D.js index e4425c9b6..6fcca5dc0 100644 --- a/amplifier_web/static/assets/erDiagram-RLTQ6QDP-D5xxq6f8.js +++ b/amplifier_web/static/assets/erDiagram-RLTQ6QDP-DV4h776D.js @@ -1,4 +1,4 @@ -import{g as Ut}from"./chunk-XXDRQBXY-BvgnYF8f.js";import{s as Kt}from"./chunk-POPQ4Y6H-fljvmLmW.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,n as Ht,o as Qt,c as tt,l as F,k as Xt,p as Jt,q as $t,r as te,t as ee,u as se,v as ie,j as re,x as ne}from"./mermaid.core-CDlaSEyP.js";import{c as ae}from"./channel-BqsL4B4X.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: +import{g as Ut}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as Kt}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,n as Ht,o as Qt,c as tt,l as F,k as Xt,p as Jt,q as $t,r as te,t as ee,u as se,v as ie,j as re,x as ne}from"./mermaid.core-BQ5lTCZr.js";import{c as ae}from"./channel-CSv1n6Zd.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: `+m.showPosition()+` Expecting `+ut.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Tt="Parse error on line "+(lt+1)+": Unexpected "+(E==Lt?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Tt,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:Et,expected:ut})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(O[0]){case 1:d.push(E),_.push(m.yytext),t.push(m.yylloc),d.push(O[1]),E=null,Dt=m.yyleng,e=m.yytext,lt=m.yylineno,Et=m.yylloc;break;case 2:if(A=this.productions_[O[1]][1],U.$=_[_.length-A],U._$={first_line:t[t.length-(A||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(A||1)].first_column,last_column:t[t.length-1].last_column},Pt&&(U._$.range=[t[t.length-(A||1)].range[0],t[t.length-1].range[1]]),St=this.performAction.apply(U,[e,Dt,lt,Y.yy,O[1],_,t].concat(Yt)),typeof St<"u")return St;A&&(d=d.slice(0,-1*A*2),_=_.slice(0,-1*A),t=t.slice(0,-1*A)),d.push(this.productions_[O[1]][0]),_.push(U.$),t.push(U._$),Vt=$[d[d.length-2]][d[d.length-1]],d.push(Vt);break;case 3:return!0}}return!0},"parse")},Gt=(function(){var G={EOF:1,parseError:f(function(h,d){if(this.yy.parser)this.yy.parser.parseError(h,d);else throw new Error(h)},"parseError"),setInput:f(function(a,h){return this.yy=h||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var h=a.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:f(function(a){var h=a.length,d=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===i.length?this.yylloc.first_column:0)+i[i.length-d.length].length-d[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(a){this.unput(this.match.slice(a))},"less"),pastInput:f(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var a=this.pastInput(),h=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/flowDiagram-HODETNUW-DrKzI2V6.js b/amplifier_web/static/assets/flowDiagram-HODETNUW-Bfis7KwQ.js similarity index 99% rename from amplifier_web/static/assets/flowDiagram-HODETNUW-DrKzI2V6.js rename to amplifier_web/static/assets/flowDiagram-HODETNUW-Bfis7KwQ.js index f49ffc1bf..e5833b168 100644 --- a/amplifier_web/static/assets/flowDiagram-HODETNUW-DrKzI2V6.js +++ b/amplifier_web/static/assets/flowDiagram-HODETNUW-Bfis7KwQ.js @@ -1,4 +1,4 @@ -import{g as Xt}from"./chunk-5VM5RSS4-DlVFuaV7.js";import{g as Qt}from"./chunk-XXDRQBXY-BvgnYF8f.js";import{s as Jt}from"./chunk-POPQ4Y6H-fljvmLmW.js";import{_ as k,b3 as Zt,F as Mt,l as $,c as ke,u as $t,v as e1,x as rt,b as t1,s as s1,n as i1,a as r1,g as a1,o as n1,k as u1,H as o1,J as l1,c9 as c1,q as st,j as it,p as h1,b6 as d1,r as p1}from"./mermaid.core-CDlaSEyP.js";import{f as f1}from"./chunk-F27PBJKO-D9qW0VD2.js";import{p as g1}from"./app-W22-ExtL.js";import{c as b1}from"./channel-BqsL4B4X.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` +import{g as Xt}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{g as Qt}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as Jt}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as k,b3 as Zt,F as Mt,l as $,c as ke,u as $t,v as e1,x as rt,b as t1,s as s1,n as i1,a as r1,g as a1,o as n1,k as u1,H as o1,J as l1,c9 as c1,q as st,j as it,p as h1,b6 as d1,r as p1}from"./mermaid.core-BQ5lTCZr.js";import{f as f1}from"./chunk-F27PBJKO-35QGDevQ.js";import{p as g1}from"./app-zsnl1T1T.js";import{c as b1}from"./channel-CSv1n6Zd.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` `)?d=m+` `:d=`{ `+m+` diff --git a/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-Djl_xd9d.js b/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js similarity index 99% rename from amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-Djl_xd9d.js rename to amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js index 690294ce8..531df1385 100644 --- a/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-Djl_xd9d.js +++ b/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js @@ -1,4 +1,4 @@ -import{be as on,bf as On,bg as cn,bh as un,bi as ln,bj as ue,bk as Hn,g as Nn,s as Pn,o as Vn,n as Rn,a as zn,b as qn,_ as d,c as Yt,j as Zt,d as Bn,bl as it,l as Tt,k as Zn,G as Xn,p as Gn,x as jn}from"./mermaid.core-CDlaSEyP.js";import{g as oe}from"./client-BPXDbY79.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-DE4AveAz.js";import{i as er}from"./init-Gi6I4Gst.js";import"./app-W22-ExtL.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: +import{be as on,bf as On,bg as cn,bh as un,bi as ln,bj as ue,bk as Hn,g as Nn,s as Pn,o as Vn,n as Rn,a as zn,b as qn,_ as d,c as Yt,j as Zt,d as Bn,bl as it,l as Tt,k as Zn,G as Xn,p as Gn,x as jn}from"./mermaid.core-BQ5lTCZr.js";import{g as oe}from"./client-BPXDbY79.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-BcEdwvr4.js";import{i as er}from"./init-Gi6I4Gst.js";import"./app-zsnl1T1T.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: `+H.showPosition()+` Expecting `+Bt.join(", ")+", got '"+(this.terminals_[A]||A)+"'":ce="Parse error on line "+(K+1)+": Unexpected "+(A==O?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(ce,{text:H.match,token:this.terminals_[A]||A,line:H.yylineno,loc:N,expected:Bt})}if(Z[0]instanceof Array&&Z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+A);switch(Z[0]){case 1:b.push(A),I.push(H.yytext),o.push(H.yylloc),b.push(Z[1]),A=null,l=H.yyleng,u=H.yytext,K=H.yylineno,N=H.yylloc;break;case 2:if(ut=this.productions_[Z[1]][1],at.$=I[I.length-ut],at._$={first_line:o[o.length-(ut||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(ut||1)].first_column,last_column:o[o.length-1].last_column},V&&(at._$.range=[o[o.length-(ut||1)].range[0],o[o.length-1].range[1]]),st=this.performAction.apply(at,[u,l,K,J.yy,Z[1],I,o].concat(j)),typeof st<"u")return st;ut&&(b=b.slice(0,-1*ut*2),I=I.slice(0,-1*ut),o=o.slice(0,-1*ut)),b.push(this.productions_[Z[1]][0]),I.push(at.$),o.push(at._$),He=W[b[b.length-2]][b[b.length-1]],b.push(He);break;case 3:return!0}}return!0},"parse")},C=(function(){var D={EOF:1,parseError:d(function(g,b){if(this.yy.parser)this.yy.parser.parseError(g,b);else throw new Error(g)},"parseError"),setInput:d(function(c,g){return this.yy=g||this.yy||{},this._input=c,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var g=c.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},"input"),unput:d(function(c){var g=c.length,b=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),b.length-1&&(this.yylineno-=b.length-1);var I=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:b?(b.length===m.length?this.yylloc.first_column:0)+m[m.length-b.length].length-b[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[I[0],I[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(c){this.unput(this.match.slice(c))},"less"),pastInput:d(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var c=this.pastInput(),g=new Array(c.length+1).join("-");return c+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-Bl_uVKdO.js b/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js similarity index 99% rename from amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-Bl_uVKdO.js rename to amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js index 007341900..93103df06 100644 --- a/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-Bl_uVKdO.js +++ b/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js @@ -1,4 +1,4 @@ -import{I as he}from"./chunk-2Q5K7J3B-CLX5dmV-.js";import{p as $e}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{o as fe,n as ge,s as ue,g as ye,a as xe,b as me,_ as $,y as Q,l as k,j as pe,c as z,x as be,z as we,p as ke,k as L,A as ve,B as Ce,C as Ee}from"./mermaid.core-CDlaSEyP.js";import{p as Be}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=Ce.gitGraph,D=$(()=>ve({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),ke()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),B=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{B.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=B.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=B.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=B.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` +import{I as he}from"./chunk-2Q5K7J3B-DR5XPUmF.js";import{p as $e}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{o as fe,n as ge,s as ue,g as ye,a as xe,b as me,_ as $,y as Q,l as k,j as pe,c as z,x as be,z as we,p as ke,k as L,A as ve,B as Ce,C as Ee}from"./mermaid.core-BQ5lTCZr.js";import{p as Be}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=Ce.gitGraph,D=$(()=>ve({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),ke()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),B=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{B.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=B.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=B.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=B.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` ${o-n/2-M/2},${u+I} ${o-n/2-M/2},${u-I} ${t.posWithOffset-n/2-M},${u-x-I} diff --git a/amplifier_web/static/assets/infoDiagram-27XIBGKW-B2QKprgt.js b/amplifier_web/static/assets/infoDiagram-27XIBGKW-D1rVSJoO.js similarity index 68% rename from amplifier_web/static/assets/infoDiagram-27XIBGKW-B2QKprgt.js rename to amplifier_web/static/assets/infoDiagram-27XIBGKW-D1rVSJoO.js index 18d60a145..8f11a928c 100644 --- a/amplifier_web/static/assets/infoDiagram-27XIBGKW-B2QKprgt.js +++ b/amplifier_web/static/assets/infoDiagram-27XIBGKW-D1rVSJoO.js @@ -1,2 +1,2 @@ -import{_ as e,l as s,D as n,d as i}from"./mermaid.core-CDlaSEyP.js";import{p}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var g={parse:e(async r=>{const a=await p("info",r);s.debug(a)},"parse")},d={version:"11.17.2"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,o)=>{s.debug(`rendering info diagram +import{_ as e,l as s,D as n,d as i}from"./mermaid.core-BQ5lTCZr.js";import{p}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var g={parse:e(async r=>{const a=await p("info",r);s.debug(a)},"parse")},d={version:"11.17.2"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,o)=>{s.debug(`rendering info diagram `+r);const t=n(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),l={draw:c},w={parser:g,db:m,renderer:l};export{w as diagram}; diff --git a/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-RV6LF1dl.js b/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-B42RhGud.js similarity index 99% rename from amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-RV6LF1dl.js rename to amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-B42RhGud.js index e8520d1d4..2efb07d5a 100644 --- a/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-RV6LF1dl.js +++ b/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-B42RhGud.js @@ -1,4 +1,4 @@ -import{_ as o,c as ot,L as ut,D as dt,am as yt,p as ft,k as pt,n as it,a as gt,b as kt,g as mt,s as wt,o as _t,d as bt}from"./mermaid.core-CDlaSEyP.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(j,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,q,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`: +import{_ as o,c as ot,L as ut,D as dt,am as yt,p as ft,k as pt,n as it,a as gt,b as kt,g as mt,s as wt,o as _t,d as bt}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(j,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,q,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`: `+b.showPosition()+` Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),q=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof q<"u")return q;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-DmXdNqni.js b/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-CkgASPQL.js similarity index 98% rename from amplifier_web/static/assets/journeyDiagram-3NMN7TZE-DmXdNqni.js rename to amplifier_web/static/assets/journeyDiagram-3NMN7TZE-CkgASPQL.js index 3e09da0f0..ed92d0bba 100644 --- a/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-DmXdNqni.js +++ b/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-CkgASPQL.js @@ -1,4 +1,4 @@ -import{g as gt}from"./chunk-5VM5RSS4-DlVFuaV7.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-F27PBJKO-D9qW0VD2.js";import{g as _t,s as vt,a as bt,b as wt,o as Tt,n as St,_ as s,c as R,j as X,d as $t,p as Mt}from"./mermaid.core-CDlaSEyP.js";import{d as it}from"./arc-DXFEdbiI.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: +import{g as gt}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-F27PBJKO-35QGDevQ.js";import{g as _t,s as vt,a as bt,b as wt,o as Tt,n as St,_ as s,c as R,j as X,d as $t,p as Mt}from"./mermaid.core-BQ5lTCZr.js";import{d as it}from"./arc-CxD3pp7w.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: `+_.showPosition()+` Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/kanban-definition-UXKFOSKX-CPNlmuSu.js b/amplifier_web/static/assets/kanban-definition-UXKFOSKX-C_T9GYcq.js similarity index 99% rename from amplifier_web/static/assets/kanban-definition-UXKFOSKX-CPNlmuSu.js rename to amplifier_web/static/assets/kanban-definition-UXKFOSKX-C_T9GYcq.js index b8a0d9609..f21e51a92 100644 --- a/amplifier_web/static/assets/kanban-definition-UXKFOSKX-CPNlmuSu.js +++ b/amplifier_web/static/assets/kanban-definition-UXKFOSKX-C_T9GYcq.js @@ -1,4 +1,4 @@ -import{_ as c,l as te,c as W,D as fe,ae as ye,af as be,ag as me,X as _e,B as Y,i as G,H as ke,J as Ee,U as Se,V as le,W as ce}from"./mermaid.core-CDlaSEyP.js";import{g as Ne}from"./chunk-5VM5RSS4-DlVFuaV7.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],U=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],H=[1,35],M=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:U}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:H,11:M}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:U}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:H,11:M}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`: +import{_ as c,l as te,c as W,D as fe,ae as ye,af as be,ag as me,X as _e,B as Y,i as G,H as ke,J as Ee,U as Se,V as le,W as ce}from"./mermaid.core-BQ5lTCZr.js";import{g as Ne}from"./chunk-5VM5RSS4-XkKVGNmc.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],U=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],H=[1,35],M=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:U}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:H,11:M}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:U}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:H,11:M}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`: `+m.showPosition()+` Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/layout-KwbWDr7K.js b/amplifier_web/static/assets/layout-xx7K6ykp.js similarity index 99% rename from amplifier_web/static/assets/layout-KwbWDr7K.js rename to amplifier_web/static/assets/layout-xx7K6ykp.js index e0552d5ea..09fa1bfb3 100644 --- a/amplifier_web/static/assets/layout-KwbWDr7K.js +++ b/amplifier_web/static/assets/layout-xx7K6ykp.js @@ -1 +1 @@ -import{bm as B,bn as y,bo as ye,bp as V,bq as U,br as Ue,bs as oe,bt as We,bu as In,bv as qe,bw as _n,bx as kn,by as jn,bz as ue,bA as An,bB as Mn,bC as xe,bD as Oe,bE as fe,bF as de,bG as G,bH as Xe,bI as He,bJ as Rn,bK as T,bL as Sn,bM as $n,bN as Fn,bO as Ee,bP as Bn,bQ as Ke,bR as N,bS as Gn,bT as Dn,bU as Yn,bV as S,bW as ze,bX as Je,bY as Vn,bZ as se,b_ as Ze,b$ as Un,c0 as Qe,c1 as Wn,c2 as qn,P as x,c3 as c,c4 as Xn,c5 as m,c6 as M,c7 as P,c8 as W}from"./mermaid.core-CDlaSEyP.js";var Hn=/\s/;function Kn(e){for(var n=e.length;n--&&Hn.test(e.charAt(n)););return n}var zn=/^\s+/;function Jn(e){return e&&e.slice(0,Kn(e)+1).replace(zn,"")}var Te=NaN,Zn=/^[-+]0x[0-9a-f]+$/i,Qn=/^0b[01]+$/i,er=/^0o[0-7]+$/i,nr=parseInt;function rr(e){if(typeof e=="number")return e;if(B(e))return Te;if(y(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=y(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Jn(e);var r=Qn.test(e);return r||er.test(e)?nr(e.slice(2),r?2:8):Zn.test(e)?Te:+e}var Pe=1/0,tr=17976931348623157e292;function $(e){if(!e)return e===0?e:0;if(e=rr(e),e===Pe||e===-Pe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ir(e){var n=$(e),r=n%1;return n===n?r?n-r:n:0}var Le=Object.create,ar=(function(){function e(){}return function(n){if(!y(n))return{};if(Le)return Le(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function or(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&k(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),n=Object(n);++t2?n[2]:void 0;for(i&&k(n[0],n[1],i)&&(t=1);++r-1?i[o?n[a]:a]:void 0}}var Mt=Math.max;function Rt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var i=r==null?0:ir(r);return i<0&&(i=Mt(t+i,0)),Dn(e,N(n),i)}var le=At(Rt);function ln(e,n){var r=-1,t=U(e)?Array(e.length):[];return Yn(e,function(i,o,a){t[++r]=n(i,o,a)}),t}function g(e,n){var r=T(e)?S:ln;return r(e,N(n))}function St(e,n){return e==null?e:Ke(e,ze(n),H)}function $t(e,n){return e&&Je(e,ze(n))}function Ft(e,n){return e>n}var Bt=Object.prototype,Gt=Bt.hasOwnProperty;function Dt(e,n){return e!=null&&Gt.call(e,n)}function hn(e,n){return e!=null&&Vn(e,n,Dt)}function vn(e,n){return en||o&&a&&f&&!u&&!d||t&&a&&f||!r&&f||!i)return 1;if(!t&&!o&&!d&&e=u)return f;var d=r[t];return f*(d=="desc"?-1:1)}}return e.index-n.index}function Xt(e,n,r){n.length?n=S(n,function(o){return T(o)?function(a){return Qe(a,o.length===1?o[0]:o)}:o}):n=[se];var t=-1;n=S(n,de(N));var i=ln(e,function(o,a,u){var f=S(n,function(d){return d(o)});return{criteria:f,index:++t,value:o}});return Ut(i,function(o,a){return qt(o,a,r)})}function Ht(e,n){return Vt(e,n,function(r,t){return Wn(e,t)})}var Y=pr(function(e,n){return e==null?{}:Ht(e,n)}),Kt=Math.ceil,zt=Math.max;function Jt(e,n,r,t){for(var i=-1,o=zt(Kt((n-e)/(r||1)),0),a=Array(o);o--;)a[++i]=e,e+=r;return a}function Zt(e){return function(n,r,t){return t&&typeof t!="number"&&k(n,r,t)&&(r=t=void 0),n=$(n),r===void 0?(r=n,n=0):r=$(r),t=t===void 0?n1&&k(e,n[0],n[1])?n=[]:r>2&&k(n[0],n[1],n[2])&&(n=[n[0]]),Xt(e,qe(n),[])}),Qt=0;function pe(e){var n=++Qt;return qn(e)+n}function ei(e,n,r){for(var t=-1,i=e.length,o=n.length,a={};++t0;--u)if(a=n[u].dequeue(),a){t=t.concat(J(e,n,r,a,!0));break}}}return t}function J(e,n,r,t,i){var o=i?[]:void 0;return c(e.inEdges(t.v),function(a){var u=e.edge(a),f=e.node(a.v);i&&o.push({v:a.v,w:a.w}),f.out-=u,ae(n,r,f)}),c(e.outEdges(t.v),function(a){var u=e.edge(a),f=a.w,d=e.node(f);d.in-=u,ae(n,r,d)}),e.removeNode(t.v),o}function ui(e,n){var r=new x,t=0,i=0;c(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(e.edges(),function(u){var f=r.edge(u.v,u.w)||0,d=n(u),s=f+d;r.setEdge(u.v,u.w,s),i=Math.max(i,r.node(u.v).out+=d),t=Math.max(t,r.node(u.w).in+=d)});var o=L(i+t+3).map(function(){return new ri}),a=t+1;return c(r.nodes(),function(u){ae(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function ae(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function fi(e){var n=e.graph().acyclicer==="greedy"?ai(e,r(e)):di(e);c(n,function(t){var i=e.edge(t);e.removeEdge(t),i.forwardName=t.name,i.reversed=!0,e.setEdge(t.w,t.v,i,pe("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function di(e){var n=[],r={},t={};function i(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(e.outEdges(o),function(a){Object.prototype.hasOwnProperty.call(r,a.w)?n.push(a):i(a.w)}),delete r[o])}return c(e.nodes(),i),n}function si(e){c(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function I(e,n,r,t){var i;do i=pe(t);while(e.hasNode(i));return r.dummy=n,e.setNode(i,r),i}function ci(e){var n=new x().setGraph(e.graph());return c(e.nodes(),function(r){n.setNode(r,e.node(r))}),c(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),n}function pn(e){var n=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return c(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),c(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Re(e,n){var r=e.x,t=e.y,i=n.x-r,o=n.y-t,a=e.width/2,u=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var f,d;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),f=u*i/o,d=u):(i<0&&(a=-a),f=a,d=a*o/i),{x:r+f,y:t+d}}function z(e){var n=g(L(bn(e)+1),function(){return[]});return c(e.nodes(),function(r){var t=e.node(r),i=t.rank;m(i)||(n[i][t.order]=r)}),n}function li(e){var n=j(g(e.nodes(),function(r){return e.node(r).rank}));c(e.nodes(),function(r){var t=e.node(r);hn(t,"rank")&&(t.rank-=n)})}function hi(e){var n=j(g(e.nodes(),function(o){return e.node(o).rank})),r=[];c(e.nodes(),function(o){var a=e.node(o).rank-n;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=e.graph().nodeRankFactor;c(r,function(o,a){m(o)&&a%i!==0?--t:t&&c(o,function(u){e.node(u).rank+=t})})}function Se(e,n,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),I(e,"border",i,n)}function bn(e){return O(g(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function vi(e,n){var r={lhs:[],rhs:[]};return c(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function pi(e,n){return n()}function bi(e){function n(r){var t=e.children(r),i=e.node(r);if(t.length&&c(t,n),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;oa.lim&&(u=a,f=!0);var d=M(n.edges(),function(s){return f===Be(e,e.node(s.v),u)&&f!==Be(e,e.node(s.w),u)});return ve(d,function(s){return A(n,s)})}function Pn(e,n,r,t){var i=r.v,o=r.w;e.removeEdge(i,o),e.setEdge(t.v,t.w,{}),ge(e),we(e,n),ki(e,n)}function ki(e,n){var r=le(e.nodes(),function(i){return!n.node(i).parent}),t=Ii(e,r);t=t.slice(1),c(t,function(i){var o=e.node(i).parent,a=n.edge(i,o),u=!1;a||(a=n.edge(o,i),u=!0),n.node(i).rank=n.node(o).rank+(u?a.minlen:-a.minlen)})}function ji(e,n,r){return e.hasEdge(n,r)}function Be(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Ai(e){switch(e.graph().ranker){case"network-simplex":Ge(e);break;case"tight-tree":Ri(e);break;case"longest-path":Mi(e);break;default:Ge(e)}}var Mi=be;function Ri(e){be(e),gn(e)}function Ge(e){E(e)}function Si(e){var n=I(e,"root",{},"_root"),r=$i(e),t=O(P(r))-1,i=2*t+1;e.graph().nestingRoot=n,c(e.edges(),function(a){e.edge(a).minlen*=i});var o=Fi(e)+1;c(e.children(),function(a){Ln(e,n,i,o,t,r,a)}),e.graph().nodeRankFactor=i}function Ln(e,n,r,t,i,o,a){var u=e.children(a);if(!u.length){a!==n&&e.setEdge(n,a,{weight:0,minlen:r});return}var f=Se(e,"_bt"),d=Se(e,"_bb"),s=e.node(a);e.setParent(f,a),s.borderTop=f,e.setParent(d,a),s.borderBottom=d,c(u,function(l){Ln(e,n,r,t,i,o,l);var h=e.node(l),p=h.borderTop?h.borderTop:l,v=h.borderBottom?h.borderBottom:l,w=h.borderTop?t:2*t,_=p!==v?1:i-o[a]+1;e.setEdge(f,p,{weight:w,minlen:_,nestingEdge:!0}),e.setEdge(v,d,{weight:w,minlen:_,nestingEdge:!0})}),e.parent(a)||e.setEdge(n,f,{weight:0,minlen:i+o[a]})}function $i(e){var n={};function r(t,i){var o=e.children(t);o&&o.length&&c(o,function(a){r(a,i+1)}),n[t]=i}return c(e.children(),function(t){r(t,1)}),n}function Fi(e){return W(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Bi(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,c(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Gi(e,n,r){var t={},i;c(r,function(o){for(var a=e.parent(o),u,f;a;){if(u=e.parent(a),u?(f=t[u],t[u]=a):(f=i,i=a),f&&f!==a){n.setEdge(f,a);return}a=u}})}function Di(e,n,r){var t=Yi(e),i=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return c(e.nodes(),function(o){var a=e.node(o),u=e.parent(o);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),c(e[r](o),function(f){var d=f.v===o?f.w:f.v,s=i.edge(d,o),l=m(s)?0:s.weight;i.setEdge(d,o,{weight:e.edge(f).weight+l})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),i}function Yi(e){for(var n;e.hasNode(n=pe("_root")););return n}function Vi(e,n){for(var r=0,t=1;t0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=d.weight;f+=d.weight*l})),f}function Wi(e){var n={},r=M(e.nodes(),function(u){return!e.children(u).length}),t=O(g(r,function(u){return e.node(u).rank})),i=g(L(t+1),function(){return[]});function o(u){if(!hn(n,u)){n[u]=!0;var f=e.node(u);i[f.rank].push(u),c(e.successors(u),o)}}var a=R(r,function(u){return e.node(u).rank});return c(a,o),i}function qi(e,n){return g(n,function(r){var t=e.inEdges(r);if(t.length){var i=W(t,function(o,a){var u=e.edge(a),f=e.node(a.v);return{sum:o.sum+u.weight*f.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Xi(e,n){var r={};c(e,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};m(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),c(n.edges(),function(i){var o=r[i.v],a=r[i.w];!m(o)&&!m(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=M(r,function(i){return!i.indegree});return Hi(t)}function Hi(e){var n=[];function r(o){return function(a){a.merged||(m(a.barycenter)||m(o.barycenter)||a.barycenter>=o.barycenter)&&Ki(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&e.push(a)}}for(;e.length;){var i=e.pop();n.push(i),c(i.in.reverse(),r(i)),c(i.out,t(i))}return g(M(n,function(o){return!o.merged}),function(o){return Y(o,["vs","i","barycenter","weight"])})}function Ki(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function zi(e,n){var r=vi(e,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,i=R(r.rhs,function(s){return-s.i}),o=[],a=0,u=0,f=0;t.sort(Ji(!!n)),f=De(o,i,f),c(t,function(s){f+=s.vs.length,o.push(s.vs),a+=s.barycenter*s.weight,u+=s.weight,f=De(o,i,f)});var d={vs:C(o)};return u&&(d.barycenter=a/u,d.weight=u),d}function De(e,n,r){for(var t;n.length&&(t=D(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ji(e){return function(n,r){return n.barycenterr.barycenter?1:e?r.i-n.i:n.i-r.i}}function Nn(e,n,r,t){var i=e.children(n),o=e.node(n),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};a&&(i=M(i,function(v){return v!==a&&v!==u}));var d=qi(e,i);c(d,function(v){if(e.children(v.v).length){var w=Nn(e,v.v,r,t);f[v.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&Qi(v,w)}});var s=Xi(d,r);Zi(s,f);var l=zi(s,t);if(a&&(l.vs=C([a,l.vs,u]),e.predecessors(a).length)){var h=e.node(e.predecessors(a)[0]),p=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+p.order)/(l.weight+2),l.weight+=2}return l}function Zi(e,n){c(e,function(r){r.vs=C(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Qi(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function ea(e){var n=bn(e),r=Ye(e,L(1,n+1),"inEdges"),t=Ye(e,L(n-1,-1,-1),"outEdges"),i=Wi(e);Ve(e,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,f=0;f<4;++u,++f){na(u%2?r:t,u%4>=2),i=z(e);var d=Vi(e,i);da||u>n[f].lim));for(d=f,f=t;(f=e.parent(f))!==d;)o.push(f);return{path:i.concat(o.reverse()),lca:d}}function ia(e){var n={},r=0;function t(i){var o=r;c(e.children(i),t),n[i]={low:o,lim:r++}}return c(e.children(),t),n}function aa(e,n){var r={};function t(i,o){var a=0,u=0,f=i.length,d=D(o);return c(o,function(s,l){var h=ua(e,s),p=h?e.node(h).order:f;(h||s===d)&&(c(o.slice(u,l+1),function(v){c(e.predecessors(v),function(w){var _=e.node(w),me=_.order;(med)&&Cn(r,h,s)})})}function i(o,a){var u=-1,f,d=0;return c(a,function(s,l){if(e.node(s).dummy==="border"){var h=e.predecessors(s);h.length&&(f=e.node(h[0]).order,t(a,d,l,u,f),d=l,u=f)}t(a,d,a.length,f,o.length)}),a}return W(n,i),r}function ua(e,n){if(e.node(n).dummy)return le(e.predecessors(n),function(r){return e.node(r).dummy})}function Cn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[n];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function fa(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function da(e,n,r,t){var i={},o={},a={};return c(n,function(u){c(u,function(f,d){i[f]=f,o[f]=f,a[f]=d})}),c(n,function(u){var f=-1;c(u,function(d){var s=t(d);if(s.length){s=R(s,function(w){return a[w]});for(var l=(s.length-1)/2,h=Math.floor(l),p=Math.ceil(l);h<=p;++h){var v=s[h];o[d]===d&&f{var t=r(" buildLayoutGraph",()=>_a(e));r(" runLayout",()=>ya(t,r)),r(" updateInputGraph",()=>xa(e,t))})}function ya(e,n){n(" makeSpaceForEdgeLabels",()=>ka(e)),n(" removeSelfEdges",()=>Ga(e)),n(" acyclic",()=>fi(e)),n(" nestingGraph.run",()=>Si(e)),n(" rank",()=>Ai(pn(e))),n(" injectEdgeLabelProxies",()=>ja(e)),n(" removeEmptyRanks",()=>hi(e)),n(" nestingGraph.cleanup",()=>Bi(e)),n(" normalizeRanks",()=>li(e)),n(" assignRankMinMax",()=>Aa(e)),n(" removeEdgeLabelProxies",()=>Ma(e)),n(" normalize.run",()=>xi(e)),n(" parentDummyChains",()=>ra(e)),n(" addBorderSegments",()=>bi(e)),n(" order",()=>ea(e)),n(" insertSelfEdges",()=>Da(e)),n(" adjustCoordinateSystem",()=>wi(e)),n(" position",()=>ga(e)),n(" positionSelfEdges",()=>Ya(e)),n(" removeBorderNodes",()=>Ba(e)),n(" normalize.undo",()=>Ei(e)),n(" fixupEdgeLabelCoords",()=>$a(e)),n(" undoCoordinateSystem",()=>gi(e)),n(" translateGraph",()=>Ra(e)),n(" assignNodeIntersects",()=>Sa(e)),n(" reversePoints",()=>Fa(e)),n(" acyclic.undo",()=>si(e))}function xa(e,n){c(e.nodes(),function(r){var t=e.node(r),i=n.node(r);t&&(t.x=i.x,t.y=i.y,n.children(r).length&&(t.width=i.width,t.height=i.height))}),c(e.edges(),function(r){var t=e.edge(r),i=n.edge(r);t.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(t.x=i.x,t.y=i.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Oa=["nodesep","edgesep","ranksep","marginx","marginy"],Ea={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ta=["acyclicer","ranker","rankdir","align"],Pa=["width","height"],La={width:0,height:0},Na=["minlen","weight","width","height","labeloffset"],Ca={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ia=["labelpos"];function _a(e){var n=new x({multigraph:!0,compound:!0}),r=ne(e.graph());return n.setGraph(ie({},Ea,ee(r,Oa),Y(r,Ta))),c(e.nodes(),function(t){var i=ne(e.node(t));n.setNode(t,_t(ee(i,Pa),La)),n.setParent(t,e.parent(t))}),c(e.edges(),function(t){var i=ne(e.edge(t));n.setEdge(t,ie({},Ca,ee(i,Na),Y(i,Ia)))}),n}function ka(e){var n=e.graph();n.ranksep/=2,c(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function ja(e){c(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),i=e.node(n.w),o={rank:(i.rank-t.rank)/2+t.rank,e:n};I(e,"edge-proxy",o,"_ep")}})}function Aa(e){var n=0;c(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=O(n,t.maxRank))}),e.graph().maxRank=n}function Ma(e){c(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Ra(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=e.graph(),a=o.marginx||0,u=o.marginy||0;function f(d){var s=d.x,l=d.y,h=d.width,p=d.height;n=Math.min(n,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-p/2),i=Math.max(i,l+p/2)}c(e.nodes(),function(d){f(e.node(d))}),c(e.edges(),function(d){var s=e.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&f(s)}),n-=a,t-=u,c(e.nodes(),function(d){var s=e.node(d);s.x-=n,s.y-=t}),c(e.edges(),function(d){var s=e.edge(d);c(s.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=n),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-n+a,o.height=i-t+u}function Sa(e){c(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),i=e.node(n.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(Re(t,o)),r.points.push(Re(i,a))})}function $a(e){c(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Fa(e){c(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Ba(e){c(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),i=e.node(r.borderBottom),o=e.node(D(r.borderLeft)),a=e.node(D(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Ga(e){c(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Da(e){var n=z(e);c(n,function(r){var t=0;c(r,function(i,o){var a=e.node(i);a.order=o+t,c(a.selfEdges,function(u){I(e,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function Ya(e){c(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function ee(e,n){return K(Y(e,n),Number)}function ne(e){var n={};return c(e,function(r,t){n[t.toLowerCase()]=r}),n}export{Ua as l}; +import{bm as B,bn as y,bo as ye,bp as V,bq as U,br as Ue,bs as oe,bt as We,bu as In,bv as qe,bw as _n,bx as kn,by as jn,bz as ue,bA as An,bB as Mn,bC as xe,bD as Oe,bE as fe,bF as de,bG as G,bH as Xe,bI as He,bJ as Rn,bK as T,bL as Sn,bM as $n,bN as Fn,bO as Ee,bP as Bn,bQ as Ke,bR as N,bS as Gn,bT as Dn,bU as Yn,bV as S,bW as ze,bX as Je,bY as Vn,bZ as se,b_ as Ze,b$ as Un,c0 as Qe,c1 as Wn,c2 as qn,P as x,c3 as c,c4 as Xn,c5 as m,c6 as M,c7 as P,c8 as W}from"./mermaid.core-BQ5lTCZr.js";var Hn=/\s/;function Kn(e){for(var n=e.length;n--&&Hn.test(e.charAt(n)););return n}var zn=/^\s+/;function Jn(e){return e&&e.slice(0,Kn(e)+1).replace(zn,"")}var Te=NaN,Zn=/^[-+]0x[0-9a-f]+$/i,Qn=/^0b[01]+$/i,er=/^0o[0-7]+$/i,nr=parseInt;function rr(e){if(typeof e=="number")return e;if(B(e))return Te;if(y(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=y(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Jn(e);var r=Qn.test(e);return r||er.test(e)?nr(e.slice(2),r?2:8):Zn.test(e)?Te:+e}var Pe=1/0,tr=17976931348623157e292;function $(e){if(!e)return e===0?e:0;if(e=rr(e),e===Pe||e===-Pe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ir(e){var n=$(e),r=n%1;return n===n?r?n-r:n:0}var Le=Object.create,ar=(function(){function e(){}return function(n){if(!y(n))return{};if(Le)return Le(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function or(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&k(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),n=Object(n);++t2?n[2]:void 0;for(i&&k(n[0],n[1],i)&&(t=1);++r-1?i[o?n[a]:a]:void 0}}var Mt=Math.max;function Rt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var i=r==null?0:ir(r);return i<0&&(i=Mt(t+i,0)),Dn(e,N(n),i)}var le=At(Rt);function ln(e,n){var r=-1,t=U(e)?Array(e.length):[];return Yn(e,function(i,o,a){t[++r]=n(i,o,a)}),t}function g(e,n){var r=T(e)?S:ln;return r(e,N(n))}function St(e,n){return e==null?e:Ke(e,ze(n),H)}function $t(e,n){return e&&Je(e,ze(n))}function Ft(e,n){return e>n}var Bt=Object.prototype,Gt=Bt.hasOwnProperty;function Dt(e,n){return e!=null&&Gt.call(e,n)}function hn(e,n){return e!=null&&Vn(e,n,Dt)}function vn(e,n){return en||o&&a&&f&&!u&&!d||t&&a&&f||!r&&f||!i)return 1;if(!t&&!o&&!d&&e=u)return f;var d=r[t];return f*(d=="desc"?-1:1)}}return e.index-n.index}function Xt(e,n,r){n.length?n=S(n,function(o){return T(o)?function(a){return Qe(a,o.length===1?o[0]:o)}:o}):n=[se];var t=-1;n=S(n,de(N));var i=ln(e,function(o,a,u){var f=S(n,function(d){return d(o)});return{criteria:f,index:++t,value:o}});return Ut(i,function(o,a){return qt(o,a,r)})}function Ht(e,n){return Vt(e,n,function(r,t){return Wn(e,t)})}var Y=pr(function(e,n){return e==null?{}:Ht(e,n)}),Kt=Math.ceil,zt=Math.max;function Jt(e,n,r,t){for(var i=-1,o=zt(Kt((n-e)/(r||1)),0),a=Array(o);o--;)a[++i]=e,e+=r;return a}function Zt(e){return function(n,r,t){return t&&typeof t!="number"&&k(n,r,t)&&(r=t=void 0),n=$(n),r===void 0?(r=n,n=0):r=$(r),t=t===void 0?n1&&k(e,n[0],n[1])?n=[]:r>2&&k(n[0],n[1],n[2])&&(n=[n[0]]),Xt(e,qe(n),[])}),Qt=0;function pe(e){var n=++Qt;return qn(e)+n}function ei(e,n,r){for(var t=-1,i=e.length,o=n.length,a={};++t0;--u)if(a=n[u].dequeue(),a){t=t.concat(J(e,n,r,a,!0));break}}}return t}function J(e,n,r,t,i){var o=i?[]:void 0;return c(e.inEdges(t.v),function(a){var u=e.edge(a),f=e.node(a.v);i&&o.push({v:a.v,w:a.w}),f.out-=u,ae(n,r,f)}),c(e.outEdges(t.v),function(a){var u=e.edge(a),f=a.w,d=e.node(f);d.in-=u,ae(n,r,d)}),e.removeNode(t.v),o}function ui(e,n){var r=new x,t=0,i=0;c(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(e.edges(),function(u){var f=r.edge(u.v,u.w)||0,d=n(u),s=f+d;r.setEdge(u.v,u.w,s),i=Math.max(i,r.node(u.v).out+=d),t=Math.max(t,r.node(u.w).in+=d)});var o=L(i+t+3).map(function(){return new ri}),a=t+1;return c(r.nodes(),function(u){ae(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function ae(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function fi(e){var n=e.graph().acyclicer==="greedy"?ai(e,r(e)):di(e);c(n,function(t){var i=e.edge(t);e.removeEdge(t),i.forwardName=t.name,i.reversed=!0,e.setEdge(t.w,t.v,i,pe("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function di(e){var n=[],r={},t={};function i(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(e.outEdges(o),function(a){Object.prototype.hasOwnProperty.call(r,a.w)?n.push(a):i(a.w)}),delete r[o])}return c(e.nodes(),i),n}function si(e){c(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function I(e,n,r,t){var i;do i=pe(t);while(e.hasNode(i));return r.dummy=n,e.setNode(i,r),i}function ci(e){var n=new x().setGraph(e.graph());return c(e.nodes(),function(r){n.setNode(r,e.node(r))}),c(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),n}function pn(e){var n=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return c(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),c(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Re(e,n){var r=e.x,t=e.y,i=n.x-r,o=n.y-t,a=e.width/2,u=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var f,d;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),f=u*i/o,d=u):(i<0&&(a=-a),f=a,d=a*o/i),{x:r+f,y:t+d}}function z(e){var n=g(L(bn(e)+1),function(){return[]});return c(e.nodes(),function(r){var t=e.node(r),i=t.rank;m(i)||(n[i][t.order]=r)}),n}function li(e){var n=j(g(e.nodes(),function(r){return e.node(r).rank}));c(e.nodes(),function(r){var t=e.node(r);hn(t,"rank")&&(t.rank-=n)})}function hi(e){var n=j(g(e.nodes(),function(o){return e.node(o).rank})),r=[];c(e.nodes(),function(o){var a=e.node(o).rank-n;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=e.graph().nodeRankFactor;c(r,function(o,a){m(o)&&a%i!==0?--t:t&&c(o,function(u){e.node(u).rank+=t})})}function Se(e,n,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),I(e,"border",i,n)}function bn(e){return O(g(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function vi(e,n){var r={lhs:[],rhs:[]};return c(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function pi(e,n){return n()}function bi(e){function n(r){var t=e.children(r),i=e.node(r);if(t.length&&c(t,n),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;oa.lim&&(u=a,f=!0);var d=M(n.edges(),function(s){return f===Be(e,e.node(s.v),u)&&f!==Be(e,e.node(s.w),u)});return ve(d,function(s){return A(n,s)})}function Pn(e,n,r,t){var i=r.v,o=r.w;e.removeEdge(i,o),e.setEdge(t.v,t.w,{}),ge(e),we(e,n),ki(e,n)}function ki(e,n){var r=le(e.nodes(),function(i){return!n.node(i).parent}),t=Ii(e,r);t=t.slice(1),c(t,function(i){var o=e.node(i).parent,a=n.edge(i,o),u=!1;a||(a=n.edge(o,i),u=!0),n.node(i).rank=n.node(o).rank+(u?a.minlen:-a.minlen)})}function ji(e,n,r){return e.hasEdge(n,r)}function Be(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Ai(e){switch(e.graph().ranker){case"network-simplex":Ge(e);break;case"tight-tree":Ri(e);break;case"longest-path":Mi(e);break;default:Ge(e)}}var Mi=be;function Ri(e){be(e),gn(e)}function Ge(e){E(e)}function Si(e){var n=I(e,"root",{},"_root"),r=$i(e),t=O(P(r))-1,i=2*t+1;e.graph().nestingRoot=n,c(e.edges(),function(a){e.edge(a).minlen*=i});var o=Fi(e)+1;c(e.children(),function(a){Ln(e,n,i,o,t,r,a)}),e.graph().nodeRankFactor=i}function Ln(e,n,r,t,i,o,a){var u=e.children(a);if(!u.length){a!==n&&e.setEdge(n,a,{weight:0,minlen:r});return}var f=Se(e,"_bt"),d=Se(e,"_bb"),s=e.node(a);e.setParent(f,a),s.borderTop=f,e.setParent(d,a),s.borderBottom=d,c(u,function(l){Ln(e,n,r,t,i,o,l);var h=e.node(l),p=h.borderTop?h.borderTop:l,v=h.borderBottom?h.borderBottom:l,w=h.borderTop?t:2*t,_=p!==v?1:i-o[a]+1;e.setEdge(f,p,{weight:w,minlen:_,nestingEdge:!0}),e.setEdge(v,d,{weight:w,minlen:_,nestingEdge:!0})}),e.parent(a)||e.setEdge(n,f,{weight:0,minlen:i+o[a]})}function $i(e){var n={};function r(t,i){var o=e.children(t);o&&o.length&&c(o,function(a){r(a,i+1)}),n[t]=i}return c(e.children(),function(t){r(t,1)}),n}function Fi(e){return W(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Bi(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,c(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Gi(e,n,r){var t={},i;c(r,function(o){for(var a=e.parent(o),u,f;a;){if(u=e.parent(a),u?(f=t[u],t[u]=a):(f=i,i=a),f&&f!==a){n.setEdge(f,a);return}a=u}})}function Di(e,n,r){var t=Yi(e),i=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return c(e.nodes(),function(o){var a=e.node(o),u=e.parent(o);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),c(e[r](o),function(f){var d=f.v===o?f.w:f.v,s=i.edge(d,o),l=m(s)?0:s.weight;i.setEdge(d,o,{weight:e.edge(f).weight+l})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),i}function Yi(e){for(var n;e.hasNode(n=pe("_root")););return n}function Vi(e,n){for(var r=0,t=1;t0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=d.weight;f+=d.weight*l})),f}function Wi(e){var n={},r=M(e.nodes(),function(u){return!e.children(u).length}),t=O(g(r,function(u){return e.node(u).rank})),i=g(L(t+1),function(){return[]});function o(u){if(!hn(n,u)){n[u]=!0;var f=e.node(u);i[f.rank].push(u),c(e.successors(u),o)}}var a=R(r,function(u){return e.node(u).rank});return c(a,o),i}function qi(e,n){return g(n,function(r){var t=e.inEdges(r);if(t.length){var i=W(t,function(o,a){var u=e.edge(a),f=e.node(a.v);return{sum:o.sum+u.weight*f.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Xi(e,n){var r={};c(e,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};m(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),c(n.edges(),function(i){var o=r[i.v],a=r[i.w];!m(o)&&!m(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=M(r,function(i){return!i.indegree});return Hi(t)}function Hi(e){var n=[];function r(o){return function(a){a.merged||(m(a.barycenter)||m(o.barycenter)||a.barycenter>=o.barycenter)&&Ki(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&e.push(a)}}for(;e.length;){var i=e.pop();n.push(i),c(i.in.reverse(),r(i)),c(i.out,t(i))}return g(M(n,function(o){return!o.merged}),function(o){return Y(o,["vs","i","barycenter","weight"])})}function Ki(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function zi(e,n){var r=vi(e,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,i=R(r.rhs,function(s){return-s.i}),o=[],a=0,u=0,f=0;t.sort(Ji(!!n)),f=De(o,i,f),c(t,function(s){f+=s.vs.length,o.push(s.vs),a+=s.barycenter*s.weight,u+=s.weight,f=De(o,i,f)});var d={vs:C(o)};return u&&(d.barycenter=a/u,d.weight=u),d}function De(e,n,r){for(var t;n.length&&(t=D(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ji(e){return function(n,r){return n.barycenterr.barycenter?1:e?r.i-n.i:n.i-r.i}}function Nn(e,n,r,t){var i=e.children(n),o=e.node(n),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};a&&(i=M(i,function(v){return v!==a&&v!==u}));var d=qi(e,i);c(d,function(v){if(e.children(v.v).length){var w=Nn(e,v.v,r,t);f[v.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&Qi(v,w)}});var s=Xi(d,r);Zi(s,f);var l=zi(s,t);if(a&&(l.vs=C([a,l.vs,u]),e.predecessors(a).length)){var h=e.node(e.predecessors(a)[0]),p=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+p.order)/(l.weight+2),l.weight+=2}return l}function Zi(e,n){c(e,function(r){r.vs=C(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Qi(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function ea(e){var n=bn(e),r=Ye(e,L(1,n+1),"inEdges"),t=Ye(e,L(n-1,-1,-1),"outEdges"),i=Wi(e);Ve(e,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,f=0;f<4;++u,++f){na(u%2?r:t,u%4>=2),i=z(e);var d=Vi(e,i);da||u>n[f].lim));for(d=f,f=t;(f=e.parent(f))!==d;)o.push(f);return{path:i.concat(o.reverse()),lca:d}}function ia(e){var n={},r=0;function t(i){var o=r;c(e.children(i),t),n[i]={low:o,lim:r++}}return c(e.children(),t),n}function aa(e,n){var r={};function t(i,o){var a=0,u=0,f=i.length,d=D(o);return c(o,function(s,l){var h=ua(e,s),p=h?e.node(h).order:f;(h||s===d)&&(c(o.slice(u,l+1),function(v){c(e.predecessors(v),function(w){var _=e.node(w),me=_.order;(med)&&Cn(r,h,s)})})}function i(o,a){var u=-1,f,d=0;return c(a,function(s,l){if(e.node(s).dummy==="border"){var h=e.predecessors(s);h.length&&(f=e.node(h[0]).order,t(a,d,l,u,f),d=l,u=f)}t(a,d,a.length,f,o.length)}),a}return W(n,i),r}function ua(e,n){if(e.node(n).dummy)return le(e.predecessors(n),function(r){return e.node(r).dummy})}function Cn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[n];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function fa(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function da(e,n,r,t){var i={},o={},a={};return c(n,function(u){c(u,function(f,d){i[f]=f,o[f]=f,a[f]=d})}),c(n,function(u){var f=-1;c(u,function(d){var s=t(d);if(s.length){s=R(s,function(w){return a[w]});for(var l=(s.length-1)/2,h=Math.floor(l),p=Math.ceil(l);h<=p;++h){var v=s[h];o[d]===d&&f{var t=r(" buildLayoutGraph",()=>_a(e));r(" runLayout",()=>ya(t,r)),r(" updateInputGraph",()=>xa(e,t))})}function ya(e,n){n(" makeSpaceForEdgeLabels",()=>ka(e)),n(" removeSelfEdges",()=>Ga(e)),n(" acyclic",()=>fi(e)),n(" nestingGraph.run",()=>Si(e)),n(" rank",()=>Ai(pn(e))),n(" injectEdgeLabelProxies",()=>ja(e)),n(" removeEmptyRanks",()=>hi(e)),n(" nestingGraph.cleanup",()=>Bi(e)),n(" normalizeRanks",()=>li(e)),n(" assignRankMinMax",()=>Aa(e)),n(" removeEdgeLabelProxies",()=>Ma(e)),n(" normalize.run",()=>xi(e)),n(" parentDummyChains",()=>ra(e)),n(" addBorderSegments",()=>bi(e)),n(" order",()=>ea(e)),n(" insertSelfEdges",()=>Da(e)),n(" adjustCoordinateSystem",()=>wi(e)),n(" position",()=>ga(e)),n(" positionSelfEdges",()=>Ya(e)),n(" removeBorderNodes",()=>Ba(e)),n(" normalize.undo",()=>Ei(e)),n(" fixupEdgeLabelCoords",()=>$a(e)),n(" undoCoordinateSystem",()=>gi(e)),n(" translateGraph",()=>Ra(e)),n(" assignNodeIntersects",()=>Sa(e)),n(" reversePoints",()=>Fa(e)),n(" acyclic.undo",()=>si(e))}function xa(e,n){c(e.nodes(),function(r){var t=e.node(r),i=n.node(r);t&&(t.x=i.x,t.y=i.y,n.children(r).length&&(t.width=i.width,t.height=i.height))}),c(e.edges(),function(r){var t=e.edge(r),i=n.edge(r);t.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(t.x=i.x,t.y=i.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Oa=["nodesep","edgesep","ranksep","marginx","marginy"],Ea={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ta=["acyclicer","ranker","rankdir","align"],Pa=["width","height"],La={width:0,height:0},Na=["minlen","weight","width","height","labeloffset"],Ca={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ia=["labelpos"];function _a(e){var n=new x({multigraph:!0,compound:!0}),r=ne(e.graph());return n.setGraph(ie({},Ea,ee(r,Oa),Y(r,Ta))),c(e.nodes(),function(t){var i=ne(e.node(t));n.setNode(t,_t(ee(i,Pa),La)),n.setParent(t,e.parent(t))}),c(e.edges(),function(t){var i=ne(e.edge(t));n.setEdge(t,ie({},Ca,ee(i,Na),Y(i,Ia)))}),n}function ka(e){var n=e.graph();n.ranksep/=2,c(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function ja(e){c(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),i=e.node(n.w),o={rank:(i.rank-t.rank)/2+t.rank,e:n};I(e,"edge-proxy",o,"_ep")}})}function Aa(e){var n=0;c(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=O(n,t.maxRank))}),e.graph().maxRank=n}function Ma(e){c(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Ra(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=e.graph(),a=o.marginx||0,u=o.marginy||0;function f(d){var s=d.x,l=d.y,h=d.width,p=d.height;n=Math.min(n,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-p/2),i=Math.max(i,l+p/2)}c(e.nodes(),function(d){f(e.node(d))}),c(e.edges(),function(d){var s=e.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&f(s)}),n-=a,t-=u,c(e.nodes(),function(d){var s=e.node(d);s.x-=n,s.y-=t}),c(e.edges(),function(d){var s=e.edge(d);c(s.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=n),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-n+a,o.height=i-t+u}function Sa(e){c(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),i=e.node(n.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(Re(t,o)),r.points.push(Re(i,a))})}function $a(e){c(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Fa(e){c(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Ba(e){c(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),i=e.node(r.borderBottom),o=e.node(D(r.borderLeft)),a=e.node(D(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Ga(e){c(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Da(e){var n=z(e);c(n,function(r){var t=0;c(r,function(i,o){var a=e.node(i);a.order=o+t,c(a.selfEdges,function(u){I(e,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function Ya(e){c(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function ee(e,n){return K(Y(e,n),Number)}function ne(e){var n={};return c(e,function(r,t){n[t.toLowerCase()]=r}),n}export{Ua as l}; diff --git a/amplifier_web/static/assets/linear-DE4AveAz.js b/amplifier_web/static/assets/linear-BcEdwvr4.js similarity index 98% rename from amplifier_web/static/assets/linear-DE4AveAz.js rename to amplifier_web/static/assets/linear-BcEdwvr4.js index ae064c27f..6fdf46e82 100644 --- a/amplifier_web/static/assets/linear-DE4AveAz.js +++ b/amplifier_web/static/assets/linear-BcEdwvr4.js @@ -1 +1 @@ -import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-CDlaSEyP.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; +import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-BQ5lTCZr.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; diff --git a/amplifier_web/static/assets/mermaid.core-CDlaSEyP.js b/amplifier_web/static/assets/mermaid.core-BQ5lTCZr.js similarity index 99% rename from amplifier_web/static/assets/mermaid.core-CDlaSEyP.js rename to amplifier_web/static/assets/mermaid.core-BQ5lTCZr.js index 5aad42f17..d114714f8 100644 --- a/amplifier_web/static/assets/mermaid.core-CDlaSEyP.js +++ b/amplifier_web/static/assets/mermaid.core-BQ5lTCZr.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-INFHLROL-tpuKIw98.js","assets/app-W22-ExtL.js","assets/client-BPXDbY79.js","assets/app-Dnczv4y8.css","assets/dagre-GXQ25YYZ-BPre4f4O.js","assets/layout-KwbWDr7K.js","assets/swimlanes-42K2YHIH-Ef_o-11t.js","assets/cose-bilkent-JH36ORCC-C7XBKZ-1.js","assets/cytoscape.esm-Ix0LnXOy.js","assets/c4Diagram-7LVT6UL2-Q9nf5Gsa.js","assets/chunk-F27PBJKO-D9qW0VD2.js","assets/flowDiagram-HODETNUW-DrKzI2V6.js","assets/chunk-5VM5RSS4-DlVFuaV7.js","assets/chunk-XXDRQBXY-BvgnYF8f.js","assets/chunk-POPQ4Y6H-fljvmLmW.js","assets/channel-BqsL4B4X.js","assets/swimlanesDiagram-VR7AAH4N-DNn1qeTZ.js","assets/erDiagram-RLTQ6QDP-D5xxq6f8.js","assets/gitGraphDiagram-WWUBYQGX-Bl_uVKdO.js","assets/chunk-2Q5K7J3B-CLX5dmV-.js","assets/chunk-JWPE2WC7-DxHQQjxU.js","assets/cynefin-OW5HDTMX-BZuqA1Xc.js","assets/ganttDiagram-EL5Y4UJY-Djl_xd9d.js","assets/linear-DE4AveAz.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-27XIBGKW-B2QKprgt.js","assets/pieDiagram-E7YTZNPT-nq59ZEFW.js","assets/arc-DXFEdbiI.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AXDQQJYC-CApaH6GE.js","assets/xychartDiagram-S5SC5T6Z-DgwC-FOX.js","assets/requirementDiagram-BXWQKSXE-DZ6X4Hg-.js","assets/sequenceDiagram-WJ2MYXX4-DZbP_JPP.js","assets/classDiagram-ZZMXUADV-Deegt-EK.js","assets/chunk-TICWLB2K-DG6NUFQe.js","assets/classDiagram-v2-VYDZK3BY-Deegt-EK.js","assets/stateDiagram-D77RDMKH-DYtq5BDk.js","assets/chunk-IMKFNOWR-CF8hlUB5.js","assets/stateDiagram-v2-MP3YSRHH-CFM38Jht.js","assets/journeyDiagram-3NMN7TZE-DmXdNqni.js","assets/timeline-definition-24CTP7MA-CD71W6Ad.js","assets/mindmap-definition-YA3MSWOX-Doia6bAL.js","assets/kanban-definition-UXKFOSKX-CPNlmuSu.js","assets/sankeyDiagram-P5KCCOFB-KPy6Sszp.js","assets/diagram-Z3DM3KII-CCO8xWsb.js","assets/diagram-UQ7AKVKN-C84fy4x0.js","assets/blockDiagram-I7D4REHJ-BfemG4eq.js","assets/diagram-S7CK7UJ4-BS8K541U.js","assets/architectureDiagram-5GKGNRK7-Bn5yUOBZ.js","assets/diagram-VSXAHHWV-BrT7N-mF.js","assets/ishikawaDiagram-5VMMS53U-RV6LF1dl.js","assets/vennDiagram-4TSXK5OY-BWkGFFy0.js","assets/diagram-VX7I27RA-DnjjslPi.js","assets/wardleyDiagram-VM6X3IG4-DixAstWQ.js","assets/cynefinDiagram-5FMLGOSQ-Bc7uv2gD.js","assets/railroadDiagram-O6MQD6OU-CmYfgBi1.js","assets/chunk-SVP7TREG-BBG-Pp77.js","assets/ebnfDiagram-PWID7BFC-HFPcjqY1.js","assets/abnfDiagram-VCTEODGH-IIquwGZo.js","assets/pegDiagram-XKGWAZYB-DCHkihPF.js"])))=>i.map(i=>d[i]); -var pm=Object.defineProperty;var ym=(e,t,r)=>t in e?pm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Nt=(e,t,r)=>ym(e,typeof t!="symbol"?t+"":t,r);import{p as li,_ as Mt}from"./app-W22-ExtL.js";import{g as Tn}from"./client-BPXDbY79.js";var Lu=Object.defineProperty,g=(e,t)=>Lu(e,"name",{value:t,configurable:!0}),mm=(e,t)=>{for(var r in t)Lu(e,r,{get:t[r],enumerable:!0})},$s={exports:{}},xm=$s.exports,Jl;function Cm(){return Jl||(Jl=1,(function(e,t){(function(r,i){e.exports=i()})(xm,(function(){var r=1e3,i=6e4,s=36e5,a="millisecond",o="second",n="minute",l="hour",c="day",h="week",u="month",d="quarter",f="year",y="date",m="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var E=["th","st","nd","rd"],B=A%100;return"["+A+(E[(B-20)%10]||E[B]||E[0])+"]"}},w=function(A,E,B){var D=String(A);return!D||D.length>=E?A:""+Array(E+1-D.length).join(B)+A},T={s:w,z:function(A){var E=-A.utcOffset(),B=Math.abs(E),D=Math.floor(B/60),$=B%60;return(E<=0?"+":"-")+w(D,2,"0")+":"+w($,2,"0")},m:function A(E,B){if(E.date()1)return A(V[0])}else{var at=E.name;v[at]=E,$=at}return!D&&$&&(_=$),$||!D&&_},W=function(A,E){if(L(A))return A.clone();var B=typeof E=="object"?E:{};return B.date=A,B.args=arguments,new rt(B)},q=T;q.l=U,q.i=L,q.w=function(A,E){return W(A,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var rt=(function(){function A(B){this.$L=U(B.locale,null,!0),this.parse(B),this.$x=this.$x||B.x||{},this[F]=!0}var E=A.prototype;return E.parse=function(B){this.$d=(function(D){var $=D.date,N=D.utc;if($===null)return new Date(NaN);if(q.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var V=$.match(C);if(V){var at=V[2]-1||0,ht=(V[7]||"0").substring(0,3);return N?new Date(Date.UTC(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)):new Date(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)}}return new Date($)})(B),this.init()},E.init=function(){var B=this.$d;this.$y=B.getFullYear(),this.$M=B.getMonth(),this.$D=B.getDate(),this.$W=B.getDay(),this.$H=B.getHours(),this.$m=B.getMinutes(),this.$s=B.getSeconds(),this.$ms=B.getMilliseconds()},E.$utils=function(){return q},E.isValid=function(){return this.$d.toString()!==m},E.isSame=function(B,D){var $=W(B);return this.startOf(D)<=$&&$<=this.endOf(D)},E.isAfter=function(B,D){return W(B){},"trace"),debug:g((...e)=>{},"debug"),info:g((...e)=>{},"info"),warn:g((...e)=>{},"warn"),error:g((...e)=>{},"error"),fatal:g((...e)=>{},"fatal")},_n=g(function(e="fatal"){let t=We.fatal;typeof e=="string"?e.toLowerCase()in We&&(t=We[e]):typeof e=="number"&&(t=e),I.trace=()=>{},I.debug=()=>{},I.info=()=>{},I.warn=()=>{},I.error=()=>{},I.fatal=()=>{},t<=We.fatal&&(I.fatal=console.error?console.error.bind(console,fe("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",fe("FATAL"))),t<=We.error&&(I.error=console.error?console.error.bind(console,fe("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",fe("ERROR"))),t<=We.warn&&(I.warn=console.warn?console.warn.bind(console,fe("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",fe("WARN"))),t<=We.info&&(I.info=console.info?console.info.bind(console,fe("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",fe("INFO"))),t<=We.debug&&(I.debug=console.debug?console.debug.bind(console,fe("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("DEBUG"))),t<=We.trace&&(I.trace=console.debug?console.debug.bind(console,fe("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("TRACE")))},"setLogLevel"),fe=g(e=>`%c${km().format("ss.SSS")} : ${e} : `,"format");const Os={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,a=2*r-s;switch(i){case"r":return Os.hue2rgb(a,s,e+1/3)*255;case"g":return Os.hue2rgb(a,s,e)*255;case"b":return Os.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),a=Math.min(e,t,r),o=(s+a)/2;if(i==="l")return o*100;if(s===a)return 0;const n=s-a,l=o>.5?n/(2-s-a):n/(s+a);if(i==="s")return l*100;switch(s){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},Sm={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},Lt={channel:Os,lang:wm,unit:Sm},tr={};for(let e=0;e<=255;e++)tr[e]=Lt.unit.dec2hex(e);const te={ALL:0,RGB:1,HSL:2};let Tm=class{constructor(){this.type=te.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=te.ALL}is(t){return this.type===t}};class _m{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Tm}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=te.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:s}=t;r===void 0&&(t.h=Lt.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=Lt.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=Lt.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:s}=t;r===void 0&&(t.r=Lt.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=Lt.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=Lt.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(te.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(te.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(te.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(te.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(te.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(te.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Ca=new _m({r:0,g:0,b:0,a:0},"transparent"),Hr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Hr.re);if(!t)return;const r=t[1],i=parseInt(r,16),s=r.length,a=s%4===0,o=s>4,n=o?1:17,l=o?8:4,c=a?0:-1,h=o?255:15;return Ca.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:a?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}${tr[Math.round(s*255)]}`:`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}`}},gr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(gr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return Lt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Lt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Lt.channel.clamp.h(parseFloat(r)*360)}}return Lt.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(gr.re);if(!r)return;const[,i,s,a,o,n]=r;return Ca.set({h:gr._hue2deg(i),s:Lt.channel.clamp.s(parseFloat(s)),l:Lt.channel.clamp.l(parseFloat(a)),a:o?Lt.channel.clamp.a(n?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:s}=e;return s<1?`hsla(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%, ${s})`:`hsl(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%)`}},ji={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ji.colors[e];if(t)return Hr.parse(t)},stringify:e=>{const t=Hr.stringify(e);for(const r in ji.colors)if(ji.colors[r]===t)return r}},Di={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Di.re);if(!r)return;const[,i,s,a,o,n,l,c,h]=r;return Ca.set({r:Lt.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:Lt.channel.clamp.g(o?parseFloat(a)*2.55:parseFloat(a)),b:Lt.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?Lt.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`rgba(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)}, ${Lt.lang.round(s)})`:`rgb(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)})`}},Oe={format:{keyword:ji,hex:Hr,rgb:Di,rgba:Di,hsl:gr,hsla:gr},parse:e=>{if(typeof e!="string")return e;const t=Hr.parse(e)||Di.parse(e)||gr.parse(e)||ji.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(te.HSL)||e.data.r===void 0?gr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Di.stringify(e):Hr.stringify(e)},Fu=(e,t)=>{const r=Oe.parse(e);for(const i in t)r[i]=Lt.channel.clamp[i](t[i]);return Oe.stringify(r)},sr=(e,t,r=0,i=1)=>{if(typeof e!="number")return Fu(e,{a:t});const s=Ca.set({r:Lt.channel.clamp.r(e),g:Lt.channel.clamp.g(t),b:Lt.channel.clamp.b(r),a:Lt.channel.clamp.a(i)});return Oe.stringify(s)},Bm=e=>{const{r:t,g:r,b:i}=Oe.parse(e),s=.2126*Lt.channel.toLinear(t)+.7152*Lt.channel.toLinear(r)+.0722*Lt.channel.toLinear(i);return Lt.lang.round(s)},vm=e=>Bm(e)>=.5,Te=e=>!vm(e),Mu=(e,t,r)=>{const i=Oe.parse(e),s=i[t],a=Lt.channel.clamp[t](s+r);return s!==a&&(i[t]=a),Oe.stringify(i)},z=(e,t)=>Mu(e,"l",t),H=(e,t)=>Mu(e,"l",-t),b=(e,t)=>{const r=Oe.parse(e),i={};for(const s in t)t[s]&&(i[s]=r[s]+t[s]);return Fu(e,i)},Lm=(e,t,r=50)=>{const{r:i,g:s,b:a,a:o}=Oe.parse(e),{r:n,g:l,b:c,a:h}=Oe.parse(t),u=r/100,d=u*2-1,f=o-h,m=((d*f===-1?d:(d+f)/(1+d*f))+1)/2,C=1-m,x=i*m+n*C,k=s*m+l*C,w=a*m+c*C,T=o*u+h*(1-u);return sr(x,k,w,T)},M=(e,t=100)=>{const r=Oe.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,Lm(r,e,t)};var Do=g((e,t,{depth:r=2}={})=>{const i={depth:r};if(Array.isArray(t)&&!Array.isArray(e))return t.forEach(s=>Do(e,s,i)),e;if(Array.isArray(t)&&Array.isArray(e))return t.forEach(s=>{e.includes(s)||e.push(s)}),e;if(e==null||r<=0)return e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t;if(t!=null&&typeof e=="object"&&typeof t=="object"){const s=e;Object.entries(t).forEach(([a,o])=>{if(typeof o=="object"){if(o===null)return;Object.hasOwn(e,a)||Object.defineProperty(e,a,{value:void 0,writable:!0,enumerable:!0,configurable:!0}),s[a]===void 0&&(s[a]=Array.isArray(o)?[]:{}),typeof s[a]=="object"&&(s[a]=Do(s[a],o,{depth:r-1}))}else typeof s[a]!="object"&&(Object.hasOwn(e,a)?s[a]=o:Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}))})}return e},"assignWithDepth"),Zt=Do,Pe="#ffffff",Ie="#f2f2f2",Tt=g((e,t)=>t?b(e,{s:-40,l:10}):b(e,{s:-40,l:-10}),"mkBorder"),Gr,Fm=(Gr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt,R;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||H(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10)):(this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||z(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let vt=0;vt{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Gr,"Theme"),Gr),Mm=g(e=>{const t=new Fm;return t.calculate(e),t},"getThemeVariables"),Xr,Am=(Xr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=H("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=H(this.sectionBkgColor,10),this.taskBorderColor=sr(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=sr(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||z(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=z(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=z(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=M(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=b(this.primaryColor,{h:64}),this.fillType3=b(this.secondaryColor,{h:64}),this.fillType4=b(this.primaryColor,{h:-64}),this.fillType5=b(this.secondaryColor,{h:-64}),this.fillType6=b(this.primaryColor,{h:128}),this.fillType7=b(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330});for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Xr,"Theme"),Xr),Em=g(e=>{const t=new Am;return t.calculate(e),t},"getThemeVariables"),Vr,$m=(Vr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=b(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=sr(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]==="calculated"&&(this[i]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Vr,"Theme"),Vr),Om=g(e=>{const t=new $m;return t.calculate(e),t},"getThemeVariables"),Zr,Dm=(Zr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=z("#cde498",10),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.primaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.actorBorder=H(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Zr,"Theme"),Zr),Pm=g(e=>{const t=new Dm;return t.calculate(e),t},"getThemeVariables"),Kr,Im=(Kr=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=z(this.contrast,55),this.background="#ffffff",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.contrast,55),this.border2=this.contrast,this.actorBorder=z(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Kr,"Theme"),Kr),Rm=g(e=>{const t=new Im;return t.calculate(e),t},"getThemeVariables"),Qr,qm=(Qr=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||t,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||i,this.cScale3=this.cScale3||b(t,{h:30}),this.cScale4=this.cScale4||b(t,{h:60}),this.cScale5=this.cScale5||b(t,{h:90}),this.cScale6=this.cScale6||b(t,{h:120}),this.cScale7=this.cScale7||b(t,{h:150}),this.cScale8=this.cScale8||b(t,{h:210,l:150}),this.cScale9=this.cScale9||b(t,{h:270}),this.cScale10=this.cScale10||b(t,{h:300}),this.cScale11=this.cScale11||b(t,{h:330}),this.darkMode)for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Qr,"Theme"),Qr),Nm=g(e=>{const t=new qm;return t.calculate(e),t},"getThemeVariables"),Jr,Wm=(Jr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Jr,"Theme"),Jr),zm=g(e=>{const t=new Wm;return t.calculate(e),t},"getThemeVariables"),ti,Hm=(ti=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ti,"Theme"),ti),Ym=g(e=>{const t=new Hm;return t.calculate(e),t},"getThemeVariables"),ei,jm=(ei=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ei,"Theme"),ei),Um=g(e=>{const t=new jm;return t.calculate(e),t},"getThemeVariables"),ri,Gm=(ri=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ri,"Theme"),ri),Xm=g(e=>{const t=new Gm;return t.calculate(e),t},"getThemeVariables"),ii,Vm=(ii=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ii,"Theme"),ii),Zm=g(e=>{const t=new Vm;return t.calculate(e),t},"getThemeVariables"),Ue={base:{getThemeVariables:Mm},dark:{getThemeVariables:Em},default:{getThemeVariables:Om},forest:{getThemeVariables:Pm},neutral:{getThemeVariables:Rm},neo:{getThemeVariables:Nm},"neo-dark":{getThemeVariables:zm},redux:{getThemeVariables:Ym},"redux-dark":{getThemeVariables:Um},"redux-color":{getThemeVariables:Xm},"redux-dark-color":{getThemeVariables:Zm}},Kt={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,showLegend:!0,legendFontSize:14,legendPadding:10,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Au={...Kt,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",nodePlacementAlignment:"NONE",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES",keepEntryNodeOnTop:!1},themeCSS:void 0,themeVariables:Ue.default.getThemeVariables(),sequence:{...Kt.sequence,messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:g(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:g(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{defaultRenderer:"dagre-wrapper",hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Kt.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Kt.c4,useWidth:void 0,personFont:g(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Kt.flowchart,inheritDir:!1},external_personFont:g(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:g(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:g(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:g(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:g(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:g(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:g(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:g(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:g(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:g(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:g(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:g(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:g(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:g(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:g(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:g(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:g(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:g(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:g(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:g(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Kt.pie,useWidth:984},xyChart:{...Kt.xyChart,useWidth:void 0},requirement:{...Kt.requirement,useWidth:void 0},packet:{...Kt.packet},eventmodeling:{...Kt.eventmodeling},treeView:{...Kt.treeView,useWidth:void 0},radar:{...Kt.radar},railroad:{...Kt.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...Kt.ishikawa},sankey:{...Kt.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Kt.venn},cynefin:{...Kt.cynefin}},Eu=g((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...Eu(e[i],"")]:[...r,t+i],[]),"keyify"),Km=new Set(Eu(Au,"")),$u=Au,Qm={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},Jm=g((e,t)=>{for(const r of Object.keys(e)){const i=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof i!="string"||!t.test(i))&&(I.debug("sanitize deleting dictionary entry:",r,i),delete e[r])}},"sanitizeDictionaryConfig"),Us=g(e=>{if(I.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Us(t));return}for(const t of Object.keys(e)){if(I.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Km.has(t)||e[t]==null){I.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){const i=Qm[t];i?Jm(e[t],i):(I.debug("sanitizing object",t),Us(e[t]));continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(I.debug("sanitizing css option",t),e[t]=Ou(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}I.debug("After sanitization",e)}},"sanitizeDirective"),Ou=g(e=>{let t=0,r=0;for(const i of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),ne=Zt({},hi),Gs,Cr=[],Ui=Zt({},hi),hs=g((e,t)=>{let r=Zt({},e),i={};for(const s of t)Iu(s),i=Zt(i,s);if(r=Zt(r,i),i.theme&&i.theme in Ue){const s=Zt({},Gs),a=Zt(s.themeVariables||{},i.themeVariables);r.theme&&r.theme in Ue&&(r.themeVariables=Ue[r.theme].getThemeVariables(a))}return Ui=r,a0(Ui),Ui},"updateCurrentConfig"),t0=g(e=>(ne=Zt({},hi),ne=Zt(ne,e),e.theme&&Ue[e.theme]&&(ne.themeVariables=Ue[e.theme].getThemeVariables(e.themeVariables)),hs(ne,Cr),ne),"setSiteConfig"),e0=g(e=>{Gs=Zt({},e)},"saveConfigFromInitialize"),r0=g(e=>(ne=Zt(ne,e),hs(ne,Cr),ne),"updateSiteConfig"),Du=g(()=>Zt({},ne),"getSiteConfig"),Pu=g(e=>(hs(Ui,[e]),Yt()),"setConfig"),Yt=g(()=>Zt({},Ui),"getConfig"),Iu=g(e=>{e&&(["secure",...ne.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(I.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&Iu(e[t])}))},"sanitize"),i0=g(e=>{var t;Us(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Cr.push(e),hs(ne,Cr)},"addDirective"),Xs=g((e=ne)=>{Cr=[],hs(e,Cr)},"reset"),s0={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},th={},Ru=g(e=>{th[e]||(I.warn(s0[e]),th[e]=!0)},"issueWarning"),a0=g(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&Ru("LAZY_LOAD_DEPRECATED")},"checkConfig"),tM=g(()=>{let e={};Gs&&(e=Zt(e,Gs));for(const t of Cr)e=Zt(e,t);return e},"getUserDefinedConfig"),ie=g(e=>{var t,r;return((t=e.flowchart)==null?void 0:t.htmlLabels)!=null&&Ru("FLOWCHART_HTML_LABELS_DEPRECATED"),Re(e.htmlLabels??((r=e.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),qu=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,Gi=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,o0=/\s*%%.*\n/gm,si,Nu=(si=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},g(si,"UnknownDiagramError"),si),br={},Bn=g(function(e,t){e=e.replace(qu,"").replace(Gi,"").replace(o0,` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-INFHLROL-CKc8uScH.js","assets/app-zsnl1T1T.js","assets/client-BPXDbY79.js","assets/app-Dnczv4y8.css","assets/dagre-GXQ25YYZ-DqSq41IB.js","assets/layout-xx7K6ykp.js","assets/swimlanes-42K2YHIH-1QzInuS-.js","assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js","assets/cytoscape.esm-Ix0LnXOy.js","assets/c4Diagram-7LVT6UL2-DdetwEv8.js","assets/chunk-F27PBJKO-35QGDevQ.js","assets/flowDiagram-HODETNUW-Bfis7KwQ.js","assets/chunk-5VM5RSS4-XkKVGNmc.js","assets/chunk-XXDRQBXY-DdE0HtLo.js","assets/chunk-POPQ4Y6H-C_hQ_kWj.js","assets/channel-CSv1n6Zd.js","assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js","assets/erDiagram-RLTQ6QDP-DV4h776D.js","assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js","assets/chunk-2Q5K7J3B-DR5XPUmF.js","assets/chunk-JWPE2WC7-wq4F1yC9.js","assets/cynefin-OW5HDTMX-C5aohCXI.js","assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js","assets/linear-BcEdwvr4.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-27XIBGKW-D1rVSJoO.js","assets/pieDiagram-E7YTZNPT-DYkXhOYb.js","assets/arc-CxD3pp7w.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js","assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js","assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js","assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js","assets/classDiagram-ZZMXUADV-D0wKCQxK.js","assets/chunk-TICWLB2K--YXzYqRv.js","assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js","assets/stateDiagram-D77RDMKH-sy7Rfo0f.js","assets/chunk-IMKFNOWR-D_IoXv7y.js","assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js","assets/journeyDiagram-3NMN7TZE-CkgASPQL.js","assets/timeline-definition-24CTP7MA-Ck5GR00U.js","assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js","assets/kanban-definition-UXKFOSKX-C_T9GYcq.js","assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js","assets/diagram-Z3DM3KII-C7wRZKVi.js","assets/diagram-UQ7AKVKN-CsDpBRwj.js","assets/blockDiagram-I7D4REHJ-JIRyk-UT.js","assets/diagram-S7CK7UJ4-Bhn2u9og.js","assets/architectureDiagram-5GKGNRK7-BMtIY0MM.js","assets/diagram-VSXAHHWV-BPFQwR9c.js","assets/ishikawaDiagram-5VMMS53U-B42RhGud.js","assets/vennDiagram-4TSXK5OY-kVi8iDPL.js","assets/diagram-VX7I27RA-DYKyI2lv.js","assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js","assets/cynefinDiagram-5FMLGOSQ-T6cXmRvG.js","assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js","assets/chunk-SVP7TREG-DegBQCYH.js","assets/ebnfDiagram-PWID7BFC-CsupTakH.js","assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js","assets/pegDiagram-XKGWAZYB-C77gkBP1.js"])))=>i.map(i=>d[i]); +var pm=Object.defineProperty;var ym=(e,t,r)=>t in e?pm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Nt=(e,t,r)=>ym(e,typeof t!="symbol"?t+"":t,r);import{p as li,_ as Mt}from"./app-zsnl1T1T.js";import{g as Tn}from"./client-BPXDbY79.js";var Lu=Object.defineProperty,g=(e,t)=>Lu(e,"name",{value:t,configurable:!0}),mm=(e,t)=>{for(var r in t)Lu(e,r,{get:t[r],enumerable:!0})},$s={exports:{}},xm=$s.exports,Jl;function Cm(){return Jl||(Jl=1,(function(e,t){(function(r,i){e.exports=i()})(xm,(function(){var r=1e3,i=6e4,s=36e5,a="millisecond",o="second",n="minute",l="hour",c="day",h="week",u="month",d="quarter",f="year",y="date",m="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var E=["th","st","nd","rd"],B=A%100;return"["+A+(E[(B-20)%10]||E[B]||E[0])+"]"}},w=function(A,E,B){var D=String(A);return!D||D.length>=E?A:""+Array(E+1-D.length).join(B)+A},T={s:w,z:function(A){var E=-A.utcOffset(),B=Math.abs(E),D=Math.floor(B/60),$=B%60;return(E<=0?"+":"-")+w(D,2,"0")+":"+w($,2,"0")},m:function A(E,B){if(E.date()1)return A(V[0])}else{var at=E.name;v[at]=E,$=at}return!D&&$&&(_=$),$||!D&&_},W=function(A,E){if(L(A))return A.clone();var B=typeof E=="object"?E:{};return B.date=A,B.args=arguments,new rt(B)},q=T;q.l=U,q.i=L,q.w=function(A,E){return W(A,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var rt=(function(){function A(B){this.$L=U(B.locale,null,!0),this.parse(B),this.$x=this.$x||B.x||{},this[F]=!0}var E=A.prototype;return E.parse=function(B){this.$d=(function(D){var $=D.date,N=D.utc;if($===null)return new Date(NaN);if(q.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var V=$.match(C);if(V){var at=V[2]-1||0,ht=(V[7]||"0").substring(0,3);return N?new Date(Date.UTC(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)):new Date(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)}}return new Date($)})(B),this.init()},E.init=function(){var B=this.$d;this.$y=B.getFullYear(),this.$M=B.getMonth(),this.$D=B.getDate(),this.$W=B.getDay(),this.$H=B.getHours(),this.$m=B.getMinutes(),this.$s=B.getSeconds(),this.$ms=B.getMilliseconds()},E.$utils=function(){return q},E.isValid=function(){return this.$d.toString()!==m},E.isSame=function(B,D){var $=W(B);return this.startOf(D)<=$&&$<=this.endOf(D)},E.isAfter=function(B,D){return W(B){},"trace"),debug:g((...e)=>{},"debug"),info:g((...e)=>{},"info"),warn:g((...e)=>{},"warn"),error:g((...e)=>{},"error"),fatal:g((...e)=>{},"fatal")},_n=g(function(e="fatal"){let t=We.fatal;typeof e=="string"?e.toLowerCase()in We&&(t=We[e]):typeof e=="number"&&(t=e),I.trace=()=>{},I.debug=()=>{},I.info=()=>{},I.warn=()=>{},I.error=()=>{},I.fatal=()=>{},t<=We.fatal&&(I.fatal=console.error?console.error.bind(console,fe("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",fe("FATAL"))),t<=We.error&&(I.error=console.error?console.error.bind(console,fe("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",fe("ERROR"))),t<=We.warn&&(I.warn=console.warn?console.warn.bind(console,fe("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",fe("WARN"))),t<=We.info&&(I.info=console.info?console.info.bind(console,fe("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",fe("INFO"))),t<=We.debug&&(I.debug=console.debug?console.debug.bind(console,fe("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("DEBUG"))),t<=We.trace&&(I.trace=console.debug?console.debug.bind(console,fe("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("TRACE")))},"setLogLevel"),fe=g(e=>`%c${km().format("ss.SSS")} : ${e} : `,"format");const Os={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,a=2*r-s;switch(i){case"r":return Os.hue2rgb(a,s,e+1/3)*255;case"g":return Os.hue2rgb(a,s,e)*255;case"b":return Os.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),a=Math.min(e,t,r),o=(s+a)/2;if(i==="l")return o*100;if(s===a)return 0;const n=s-a,l=o>.5?n/(2-s-a):n/(s+a);if(i==="s")return l*100;switch(s){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},Sm={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},Lt={channel:Os,lang:wm,unit:Sm},tr={};for(let e=0;e<=255;e++)tr[e]=Lt.unit.dec2hex(e);const te={ALL:0,RGB:1,HSL:2};let Tm=class{constructor(){this.type=te.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=te.ALL}is(t){return this.type===t}};class _m{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Tm}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=te.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:s}=t;r===void 0&&(t.h=Lt.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=Lt.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=Lt.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:s}=t;r===void 0&&(t.r=Lt.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=Lt.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=Lt.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(te.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(te.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(te.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(te.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(te.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(te.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Ca=new _m({r:0,g:0,b:0,a:0},"transparent"),Hr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Hr.re);if(!t)return;const r=t[1],i=parseInt(r,16),s=r.length,a=s%4===0,o=s>4,n=o?1:17,l=o?8:4,c=a?0:-1,h=o?255:15;return Ca.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:a?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}${tr[Math.round(s*255)]}`:`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}`}},gr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(gr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return Lt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Lt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Lt.channel.clamp.h(parseFloat(r)*360)}}return Lt.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(gr.re);if(!r)return;const[,i,s,a,o,n]=r;return Ca.set({h:gr._hue2deg(i),s:Lt.channel.clamp.s(parseFloat(s)),l:Lt.channel.clamp.l(parseFloat(a)),a:o?Lt.channel.clamp.a(n?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:s}=e;return s<1?`hsla(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%, ${s})`:`hsl(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%)`}},ji={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ji.colors[e];if(t)return Hr.parse(t)},stringify:e=>{const t=Hr.stringify(e);for(const r in ji.colors)if(ji.colors[r]===t)return r}},Di={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Di.re);if(!r)return;const[,i,s,a,o,n,l,c,h]=r;return Ca.set({r:Lt.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:Lt.channel.clamp.g(o?parseFloat(a)*2.55:parseFloat(a)),b:Lt.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?Lt.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`rgba(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)}, ${Lt.lang.round(s)})`:`rgb(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)})`}},Oe={format:{keyword:ji,hex:Hr,rgb:Di,rgba:Di,hsl:gr,hsla:gr},parse:e=>{if(typeof e!="string")return e;const t=Hr.parse(e)||Di.parse(e)||gr.parse(e)||ji.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(te.HSL)||e.data.r===void 0?gr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Di.stringify(e):Hr.stringify(e)},Fu=(e,t)=>{const r=Oe.parse(e);for(const i in t)r[i]=Lt.channel.clamp[i](t[i]);return Oe.stringify(r)},sr=(e,t,r=0,i=1)=>{if(typeof e!="number")return Fu(e,{a:t});const s=Ca.set({r:Lt.channel.clamp.r(e),g:Lt.channel.clamp.g(t),b:Lt.channel.clamp.b(r),a:Lt.channel.clamp.a(i)});return Oe.stringify(s)},Bm=e=>{const{r:t,g:r,b:i}=Oe.parse(e),s=.2126*Lt.channel.toLinear(t)+.7152*Lt.channel.toLinear(r)+.0722*Lt.channel.toLinear(i);return Lt.lang.round(s)},vm=e=>Bm(e)>=.5,Te=e=>!vm(e),Mu=(e,t,r)=>{const i=Oe.parse(e),s=i[t],a=Lt.channel.clamp[t](s+r);return s!==a&&(i[t]=a),Oe.stringify(i)},z=(e,t)=>Mu(e,"l",t),H=(e,t)=>Mu(e,"l",-t),b=(e,t)=>{const r=Oe.parse(e),i={};for(const s in t)t[s]&&(i[s]=r[s]+t[s]);return Fu(e,i)},Lm=(e,t,r=50)=>{const{r:i,g:s,b:a,a:o}=Oe.parse(e),{r:n,g:l,b:c,a:h}=Oe.parse(t),u=r/100,d=u*2-1,f=o-h,m=((d*f===-1?d:(d+f)/(1+d*f))+1)/2,C=1-m,x=i*m+n*C,k=s*m+l*C,w=a*m+c*C,T=o*u+h*(1-u);return sr(x,k,w,T)},M=(e,t=100)=>{const r=Oe.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,Lm(r,e,t)};var Do=g((e,t,{depth:r=2}={})=>{const i={depth:r};if(Array.isArray(t)&&!Array.isArray(e))return t.forEach(s=>Do(e,s,i)),e;if(Array.isArray(t)&&Array.isArray(e))return t.forEach(s=>{e.includes(s)||e.push(s)}),e;if(e==null||r<=0)return e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t;if(t!=null&&typeof e=="object"&&typeof t=="object"){const s=e;Object.entries(t).forEach(([a,o])=>{if(typeof o=="object"){if(o===null)return;Object.hasOwn(e,a)||Object.defineProperty(e,a,{value:void 0,writable:!0,enumerable:!0,configurable:!0}),s[a]===void 0&&(s[a]=Array.isArray(o)?[]:{}),typeof s[a]=="object"&&(s[a]=Do(s[a],o,{depth:r-1}))}else typeof s[a]!="object"&&(Object.hasOwn(e,a)?s[a]=o:Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}))})}return e},"assignWithDepth"),Zt=Do,Pe="#ffffff",Ie="#f2f2f2",Tt=g((e,t)=>t?b(e,{s:-40,l:10}):b(e,{s:-40,l:-10}),"mkBorder"),Gr,Fm=(Gr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt,R;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||H(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10)):(this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||z(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let vt=0;vt{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Gr,"Theme"),Gr),Mm=g(e=>{const t=new Fm;return t.calculate(e),t},"getThemeVariables"),Xr,Am=(Xr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=H("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=H(this.sectionBkgColor,10),this.taskBorderColor=sr(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=sr(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||z(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=z(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=z(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=M(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=b(this.primaryColor,{h:64}),this.fillType3=b(this.secondaryColor,{h:64}),this.fillType4=b(this.primaryColor,{h:-64}),this.fillType5=b(this.secondaryColor,{h:-64}),this.fillType6=b(this.primaryColor,{h:128}),this.fillType7=b(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330});for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Xr,"Theme"),Xr),Em=g(e=>{const t=new Am;return t.calculate(e),t},"getThemeVariables"),Vr,$m=(Vr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=b(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=sr(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]==="calculated"&&(this[i]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Vr,"Theme"),Vr),Om=g(e=>{const t=new $m;return t.calculate(e),t},"getThemeVariables"),Zr,Dm=(Zr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=z("#cde498",10),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.primaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.actorBorder=H(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Zr,"Theme"),Zr),Pm=g(e=>{const t=new Dm;return t.calculate(e),t},"getThemeVariables"),Kr,Im=(Kr=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=z(this.contrast,55),this.background="#ffffff",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.contrast,55),this.border2=this.contrast,this.actorBorder=z(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Kr,"Theme"),Kr),Rm=g(e=>{const t=new Im;return t.calculate(e),t},"getThemeVariables"),Qr,qm=(Qr=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||t,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||i,this.cScale3=this.cScale3||b(t,{h:30}),this.cScale4=this.cScale4||b(t,{h:60}),this.cScale5=this.cScale5||b(t,{h:90}),this.cScale6=this.cScale6||b(t,{h:120}),this.cScale7=this.cScale7||b(t,{h:150}),this.cScale8=this.cScale8||b(t,{h:210,l:150}),this.cScale9=this.cScale9||b(t,{h:270}),this.cScale10=this.cScale10||b(t,{h:300}),this.cScale11=this.cScale11||b(t,{h:330}),this.darkMode)for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Qr,"Theme"),Qr),Nm=g(e=>{const t=new qm;return t.calculate(e),t},"getThemeVariables"),Jr,Wm=(Jr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Jr,"Theme"),Jr),zm=g(e=>{const t=new Wm;return t.calculate(e),t},"getThemeVariables"),ti,Hm=(ti=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ti,"Theme"),ti),Ym=g(e=>{const t=new Hm;return t.calculate(e),t},"getThemeVariables"),ei,jm=(ei=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ei,"Theme"),ei),Um=g(e=>{const t=new jm;return t.calculate(e),t},"getThemeVariables"),ri,Gm=(ri=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ri,"Theme"),ri),Xm=g(e=>{const t=new Gm;return t.calculate(e),t},"getThemeVariables"),ii,Vm=(ii=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ii,"Theme"),ii),Zm=g(e=>{const t=new Vm;return t.calculate(e),t},"getThemeVariables"),Ue={base:{getThemeVariables:Mm},dark:{getThemeVariables:Em},default:{getThemeVariables:Om},forest:{getThemeVariables:Pm},neutral:{getThemeVariables:Rm},neo:{getThemeVariables:Nm},"neo-dark":{getThemeVariables:zm},redux:{getThemeVariables:Ym},"redux-dark":{getThemeVariables:Um},"redux-color":{getThemeVariables:Xm},"redux-dark-color":{getThemeVariables:Zm}},Kt={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,showLegend:!0,legendFontSize:14,legendPadding:10,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Au={...Kt,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",nodePlacementAlignment:"NONE",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES",keepEntryNodeOnTop:!1},themeCSS:void 0,themeVariables:Ue.default.getThemeVariables(),sequence:{...Kt.sequence,messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:g(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:g(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{defaultRenderer:"dagre-wrapper",hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Kt.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Kt.c4,useWidth:void 0,personFont:g(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Kt.flowchart,inheritDir:!1},external_personFont:g(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:g(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:g(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:g(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:g(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:g(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:g(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:g(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:g(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:g(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:g(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:g(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:g(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:g(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:g(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:g(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:g(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:g(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:g(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:g(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Kt.pie,useWidth:984},xyChart:{...Kt.xyChart,useWidth:void 0},requirement:{...Kt.requirement,useWidth:void 0},packet:{...Kt.packet},eventmodeling:{...Kt.eventmodeling},treeView:{...Kt.treeView,useWidth:void 0},radar:{...Kt.radar},railroad:{...Kt.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...Kt.ishikawa},sankey:{...Kt.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Kt.venn},cynefin:{...Kt.cynefin}},Eu=g((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...Eu(e[i],"")]:[...r,t+i],[]),"keyify"),Km=new Set(Eu(Au,"")),$u=Au,Qm={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},Jm=g((e,t)=>{for(const r of Object.keys(e)){const i=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof i!="string"||!t.test(i))&&(I.debug("sanitize deleting dictionary entry:",r,i),delete e[r])}},"sanitizeDictionaryConfig"),Us=g(e=>{if(I.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Us(t));return}for(const t of Object.keys(e)){if(I.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Km.has(t)||e[t]==null){I.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){const i=Qm[t];i?Jm(e[t],i):(I.debug("sanitizing object",t),Us(e[t]));continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(I.debug("sanitizing css option",t),e[t]=Ou(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}I.debug("After sanitization",e)}},"sanitizeDirective"),Ou=g(e=>{let t=0,r=0;for(const i of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),ne=Zt({},hi),Gs,Cr=[],Ui=Zt({},hi),hs=g((e,t)=>{let r=Zt({},e),i={};for(const s of t)Iu(s),i=Zt(i,s);if(r=Zt(r,i),i.theme&&i.theme in Ue){const s=Zt({},Gs),a=Zt(s.themeVariables||{},i.themeVariables);r.theme&&r.theme in Ue&&(r.themeVariables=Ue[r.theme].getThemeVariables(a))}return Ui=r,a0(Ui),Ui},"updateCurrentConfig"),t0=g(e=>(ne=Zt({},hi),ne=Zt(ne,e),e.theme&&Ue[e.theme]&&(ne.themeVariables=Ue[e.theme].getThemeVariables(e.themeVariables)),hs(ne,Cr),ne),"setSiteConfig"),e0=g(e=>{Gs=Zt({},e)},"saveConfigFromInitialize"),r0=g(e=>(ne=Zt(ne,e),hs(ne,Cr),ne),"updateSiteConfig"),Du=g(()=>Zt({},ne),"getSiteConfig"),Pu=g(e=>(hs(Ui,[e]),Yt()),"setConfig"),Yt=g(()=>Zt({},Ui),"getConfig"),Iu=g(e=>{e&&(["secure",...ne.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(I.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&Iu(e[t])}))},"sanitize"),i0=g(e=>{var t;Us(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Cr.push(e),hs(ne,Cr)},"addDirective"),Xs=g((e=ne)=>{Cr=[],hs(e,Cr)},"reset"),s0={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},th={},Ru=g(e=>{th[e]||(I.warn(s0[e]),th[e]=!0)},"issueWarning"),a0=g(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&Ru("LAZY_LOAD_DEPRECATED")},"checkConfig"),tM=g(()=>{let e={};Gs&&(e=Zt(e,Gs));for(const t of Cr)e=Zt(e,t);return e},"getUserDefinedConfig"),ie=g(e=>{var t,r;return((t=e.flowchart)==null?void 0:t.htmlLabels)!=null&&Ru("FLOWCHART_HTML_LABELS_DEPRECATED"),Re(e.htmlLabels??((r=e.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),qu=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,Gi=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,o0=/\s*%%.*\n/gm,si,Nu=(si=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},g(si,"UnknownDiagramError"),si),br={},Bn=g(function(e,t){e=e.replace(qu,"").replace(Gi,"").replace(o0,` `);for(const[r,{detector:i}]of Object.entries(br))if(i(e,t))return r;throw new Nu(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),Po=g((...e)=>{for(const{id:t,detector:r,loader:i}of e)Wu(t,r,i)},"registerLazyLoadedDiagrams"),Wu=g((e,t,r)=>{br[e]&&I.warn(`Detector with key ${e} already exists. Overwriting.`),br[e]={detector:t,loader:r},I.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),n0=g(e=>br[e].loader,"getDiagramLoader"),cs=//gi,l0=g(e=>e?Yu(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),h0=(()=>{let e=!1;return()=>{e||(zu(),e=!0)}})();function zu(){const e="data-temp-href-target";li.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),li.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}g(zu,"setupDompurifyHooks");var Hu=g(e=>(h0(),li.sanitize(e)),"removeScript"),eh=g((e,t)=>{if(ie(t)){const r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=Hu(e):r!=="loose"&&(e=Yu(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=f0(e))}return e},"sanitizeMore"),ge=g((e,t)=>e&&(t.dompurifyConfig?e=li.sanitize(eh(e,t),t.dompurifyConfig).toString():e=li.sanitize(eh(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),c0=g((e,t)=>typeof e=="string"?ge(e,t):e.flat().map(r=>ge(r,t)),"sanitizeTextOrArray"),u0=g(e=>cs.test(e),"hasBreaks"),d0=g(e=>e.split(cs),"splitBreaks"),f0=g(e=>e.replace(/#br#/g,"
"),"placeholderToBreak"),Yu=g(e=>e.replace(cs,"#br#"),"breakToPlaceholder"),g0=g(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),p0=g(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),y0=g(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),rh=g(function(e){const t=e.split(/(,)/),r=[];for(let i=0;i0&&i+1Math.max(0,e.split(t).length-1),"countOccurrence"),m0=g((e,t)=>{const r=Io(e,"~"),i=Io(t,"~");return r===1&&i===1},"shouldCombineSets"),x0=g(e=>{const t=Io(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const i=[...e];let s=i.indexOf("~"),a=i.lastIndexOf("~");for(;s!==-1&&a!==-1&&s!==a;)i[s]="<",i[a]=">",s=i.indexOf("~"),a=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),ih=g(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Ro=/\$\$(.*?)\$\$/g,Qi=g(e=>{var t;return(((t=e.match(Ro))==null?void 0:t.length)??0)>0},"hasKatex"),eM=g(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await ju(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0";const i=document.querySelector("body");i==null||i.insertAdjacentElement("beforeend",r);const s={width:r.clientWidth,height:r.clientHeight};return r.remove(),s},"calculateMathMLDimensions"),C0=g(async(e,t)=>{if(!Qi(e))return e;if(!(ih()||t.legacyMathML||t.forceLegacyMathML))return e.replace(Ro,"MathML is unsupported in this environment.");{const{default:r}=await Mt(async()=>{const{default:s}=await import("./katex-C5jXJg4s.js");return{default:s}},[]),i=t.forceLegacyMathML||!ih()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(cs).map(s=>Qi(s)?`
${s}
`:`
${s}
`).join("").replace(Ro,(s,a)=>r.renderToString(a,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(//g,""))}},"renderKatexUnsanitized"),ju=g(async(e,t)=>ge(await C0(e,t),t),"renderKatexSanitized"),us={getRows:l0,sanitizeText:ge,sanitizeTextOrArray:c0,hasBreaks:u0,splitBreaks:d0,lineBreakRegex:cs,removeScript:Hu,getUrl:g0,evaluate:Re,getMax:p0,getMin:y0},b0=g(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),k0=g(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),Uu=g(function(e,t,r,i){const s=k0(t,r,i);b0(e,s)},"configureSvgSize"),w0=g(function(e,t,r,i){const s=t.node().getBBox(),a=s.width,o=s.height;I.info(`SVG bounds: ${a}x${o}`,s);let n=0,l=0;I.info(`Graph bounds: ${n}x${l}`,e),n=a+r*2,l=o+r*2,I.info(`Calculated bounds: ${n}x${l}`),Uu(t,l,n,i);const c=`${s.x-r} ${s.y-r} ${s.width+2*r} ${s.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),Ds={};function qo(e){return[...e.cssRules].map(t=>t.cssText).join(` `)}g(qo,"cssStyleSheetToString");var S0=g((e,t,r,i)=>{let s="";return e in Ds&&Ds[e]?s=Ds[e]({...r,svgId:i}):I.warn(`No theme found for ${e}`),`& { font-family: ${r.fontFamily}; @@ -265,7 +265,7 @@ ${a.join(` L0,20`)},"requirement_arrow"),cS=g((e,t,r)=>{const i=Yt(),{themeVariables:s}=i,{strokeWidth:a}=s;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 L20,10 M20,10 - L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),uS=g((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),dS=g((e,t,r)=>{const i=Yt(),{themeVariables:s}=i,{strokeWidth:a}=s,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),fS={extension:jw,composition:Uw,aggregation:Gw,dependency:Xw,lollipop:Vw,point:Zw,circle:Kw,cross:Qw,barb:Jw,barbNeo:tS,only_one:eS,zero_or_one:rS,one_or_more:iS,zero_or_more:sS,only_one_neo:aS,zero_or_one_neo:oS,one_or_more_neo:nS,zero_or_more_neo:lS,requirement_arrow:hS,requirement_contains:uS,requirement_arrow_neo:cS,requirement_contains_neo:dS},bp=Yw,kp=typeof global=="object"&&global&&global.Object===Object&&global,gS=typeof self=="object"&&self&&self.Object===Object&&self,Ze=kp||gS||Function("return this")(),De=Ze.Symbol,wp=Object.prototype,pS=wp.hasOwnProperty,yS=wp.toString,Oi=De?De.toStringTag:void 0;function mS(e){var t=pS.call(e,Oi),r=e[Oi];try{e[Oi]=void 0;var i=!0}catch{}var s=yS.call(e);return i&&(t?e[Oi]=r:delete e[Oi]),s}var xS=Object.prototype,CS=xS.toString;function bS(e){return CS.call(e)}var kS="[object Null]",wS="[object Undefined]",wc=De?De.toStringTag:void 0;function mi(e){return e==null?e===void 0?wS:kS:wc&&wc in Object(e)?mS(e):bS(e)}function Tr(e){return e!=null&&typeof e=="object"}var SS="[object Symbol]";function Cl(e){return typeof e=="symbol"||Tr(e)&&mi(e)==SS}function Sp(e,t){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r0){if(++t>=zS)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Hi(e){return function(){return e}}var Bc=(function(){try{var e=Mr(Object,"defineProperty");return e({},"",{}),e}catch{}})(),US=Bc?function(e,t){return Bc(e,"toString",{configurable:!0,enumerable:!1,value:Hi(t),writable:!0})}:$a,GS=jS(US);function XS(e,t){for(var r=-1,i=e==null?0:e.length;++r-1}var tT=9007199254740991,eT=/^(?:0|[1-9]\d*)$/;function _p(e,t){var r=typeof e;return t=t??tT,!!t&&(r=="number"||r!="symbol"&&eT.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=sT}function Oa(e){return e!=null&&kl(e.length)&&!pa(e)}var aT=Object.prototype;function vp(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||aT;return e===r}function oT(e,t){for(var r=-1,i=Array(e);++r-1}function d_(e,t){var r=this.__data__,i=Pa(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function Ke(e){var t=-1,r=e==null?0:e.length;for(this.clear();++tn))return!1;var c=a.get(e),h=a.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,f=r&Q_?new as:void 0;for(a.set(e,t),a.set(t,e);++u=KB){var c=ZB(e);if(c)return _l(c);o=!1,s=Pp,l=new as}else l=n;t:for(;++i1?s.setNode(a,r):s.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=ur,this._children[t]={},this._children[ur][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],cr(this.children(t),i=>{this.setParent(i)}),delete this._children[t]),cr(Ae(this._in[t]),r),delete this._in[t],delete this._preds[t],cr(Ae(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Wr(r))r=ur;else{r+="";for(var i=r;!Wr(i);i=this.parent(i))if(i===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==ur)return r}}children(t){if(Wr(t)&&(t=ur),this._isCompound){var r=this._children[t];if(r)return Ae(r)}else{if(t===ur)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return Ae(r)}successors(t){var r=this._sucs[t];if(r)return Ae(r)}neighbors(t){var r=this.predecessors(t);if(r)return JB(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var i=this;cr(this._nodes,function(o,n){t(n)&&r.setNode(n,o)}),cr(this._edgeObjs,function(o){r.hasNode(o.v)&&r.hasNode(o.w)&&r.setEdge(o,i.edge(o))});var s={};function a(o){var n=i.parent(o);return n===void 0||r.hasNode(n)?(s[o]=n,n):n in s?s[n]:a(n)}return this._isCompound&&cr(r.nodes(),function(o){r.setParent(o,a(o))}),r}setDefaultEdgeLabel(t){return pa(t)||(t=Hi(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return lo(this._edgeObjs)}setPath(t,r){var i=this,s=arguments;return XB(t,function(a,o){return s.length>1?i.setEdge(a,o,r):i.setEdge(a,o),o}),this}setEdge(){var t,r,i,s,a=!1,o=arguments[0];typeof o=="object"&&o!==null&&"v"in o?(t=o.v,r=o.w,i=o.name,arguments.length===2&&(s=arguments[1],a=!0)):(t=o,r=arguments[1],i=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),t=""+t,r=""+r,Wr(i)||(i=""+i);var n=Yi(this._isDirected,t,r,i);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,n))return a&&(this._edgeLabels[n]=s),this;if(!Wr(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[n]=a?s:this._defaultEdgeLabelFn(t,r,i);var l=ev(this._isDirected,t,r,i);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[n]=l,Xc(this._preds[r],t),Xc(this._sucs[t],r),this._in[r][n]=l,this._out[t][n]=l,this._edgeCount++,this}edge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return this._edgeLabels[s]}hasEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return Object.prototype.hasOwnProperty.call(this._edgeLabels,s)}removeEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i),a=this._edgeObjs[s];return a&&(t=a.v,r=a.w,delete this._edgeLabels[s],delete this._edgeObjs[s],Vc(this._preds[r],t),Vc(this._sucs[t],r),delete this._in[r][s],delete this._out[t][s],this._edgeCount--),this}inEdges(t,r){var i=this._in[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.v===r}):s}}outEdges(t,r){var i=this._out[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.w===r}):s}}nodeEdges(t,r){var i=this.inEdges(t,r);if(i)return i.concat(this.outEdges(t,r))}}qa.prototype._nodeCount=0;qa.prototype._edgeCount=0;function Xc(e,t){e[t]?e[t]++:e[t]=1}function Vc(e,t){--e[t]||delete e[t]}function Yi(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}return s+Gc+a+Gc+(Wr(i)?tv:i)}function ev(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}var n={v:s,w:a};return i&&(n.name=i),n}function ho(e,t){return Yi(e,t.v,t.w,t.name)}function Wp(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),s=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),o=r.insert("g").attr("class","nodes");return{clusters:i,edgePaths:s,edgeLabels:a,nodes:o,rootGroups:r}}g(Wp,"createLayoutElementGroups");async function zp(e,t){if(t.label){const{shapeSvg:r,bbox:i}=await mt(e,t);t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}g(zp,"measureGroupLabel");async function Hp(e,t,r){var a;const i=await ml(e,t,r),s=((a=i.node())==null?void 0:a.getBBox())??{width:0,height:0};return t.width=s.width,t.height=s.height,i}g(Hp,"insertMeasuredNode");async function Yp(e,t){const r=new qa({multigraph:!0,compound:!0}),i=[...t.edges],s=Et(),a=Wp(e),{edgeLabels:o,nodes:n}=a,l=new Map,c=e.node()!=null;await Promise.all(t.nodes.map(async h=>{if(h.isGroup)c&&await zp(n,h),r.setNode(h.id,{...h});else{if(c){const u=await Hp(n,h,{config:s,dir:h.dir});l.set(h.id,u)}r.setNode(h.id,{...h})}}));for(const h of i)c&&pp(h)&&await xl(o,h),r.setEdge(h.start,h.end,{...h},h.id),t.edges.some(d=>d.id===h.id)||t.edges.push(h);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:h}=await Mt(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-INFHLROL-tpuKIw98.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3]));h(e,t)}return{graph:r,groups:a,nodeElements:l}}g(Yp,"createGraphWithElements");var Dt=new Map,yr=new Map,jp=new Map,rv=g(()=>{yr.clear(),jp.clear(),Dt.clear()},"clear"),os=g((e,t)=>{const r=yr.get(t)||[];return I.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),iv=g((e,t)=>{const r=yr.get(t)||[];return I.info("Descendants of ",t," is ",r),I.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||os(e.v,t)||os(e.w,t)||r.includes(e.w):(I.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),Up=g((e,t,r,i)=>{I.debug("Copying children of ",e,"root",i,"data",t.node(e),i);const s=t.children(e)||[];e!==i&&s.push(e),I.debug("Copying (nodes) clusterId",e,"nodes",s),s.forEach(a=>{if(t.children(a).length>0)Up(a,t,r,i);else{const o=t.node(a);I.info("cp ",a," to ",i," with parent ",e),r.setNode(a,o),i!==t.parent(a)&&(I.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(I.debug("Setting parent",a,e),r.setParent(a,e)):(I.info("In copy ",e,"root",i,"data",t.node(e),i),I.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==i,"node!==clusterId",a!==e));const n=t.edges(a);I.debug("Copying Edges",n),n.forEach(l=>{I.info("Edge",l);const c=t.edge(l.v,l.w,l.name);I.info("Edge data",c,i);try{iv(l,i)?(I.info("Copying as ",l.v,l.w,c,l.name),r.setEdge(l.v,l.w,c,l.name),I.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):I.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",i," clusterId:",e)}catch(h){I.error(h)}})}I.debug("Removing node",a),t.removeNode(a)})},"copy"),Gp=g((e,t)=>{const r=t.children(e);let i=[...r];for(const s of r)jp.set(s,e),i=[...i,...Gp(s,t)];return i},"extractDescendants"),sv=g((e,t,r)=>{const i=e.edges().filter(l=>l.v===t||l.w===t),s=e.edges().filter(l=>l.v===r||l.w===r),a=i.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),o=s.map(l=>({v:l.v,w:l.w}));return a.filter(l=>o.some(c=>l.v===c.v&&l.w===c.w))},"findCommonEdges"),ma=g((e,t,r)=>{const i=t.children(e);if(I.trace("Searching children of id ",e,i),i.length<1)return e;let s;for(const a of i){const o=ma(a,t,r),n=sv(t,r,o);if(o)if(n.length>0)s=o;else return o}return s},"findNonClusterChild"),Zc=g(e=>!Dt.has(e)||!Dt.get(e).externalConnections?e:Dt.has(e)?Dt.get(e).id:e,"getAnchorId"),wM=g((e,t)=>{var r;if(!e||t>10){I.debug("Opting out, no graph ");return}else I.debug("Opting in, graph ");e.nodes().forEach(function(i){e.children(i).length>0&&(I.debug("Cluster identified",i," Replacement id in edges: ",ma(i,e,i)),yr.set(i,Gp(i,e)),Dt.set(i,{id:ma(i,e,i),clusterData:e.node(i)}))}),e.nodes().forEach(function(i){const s=e.children(i),a=e.edges();s.length>0?(I.debug("Cluster identified",i,yr),a.forEach(o=>{const n=os(o.v,i),l=os(o.w,i);n^l&&(I.debug("Edge: ",o," leaves cluster ",i),I.debug("Descendants of XXX ",i,": ",yr.get(i)),Dt.get(i).externalConnections=!0)})):I.debug("Not a cluster ",i,yr)});for(let i of Dt.keys()){const s=Dt.get(i).id,a=e.parent(s);a!==i&&Dt.has(a)&&!Dt.get(a).externalConnections&&(Dt.get(i).id=a);const o=e.edges().some(n=>n.v===i);if(s&&((r=Dt.get(i))!=null&&r.externalConnections)&&o&&Zp(e,s,i)){const n=av(e,i,e.parent(s));n&&(Dt.get(i).id=n)}}e.edges().forEach(function(i){const s=e.edge(i);I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(i)),I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(e.edge(i)));let a=i.v,o=i.w;if(I.debug("Fix XXX",Dt,"ids:",i.v,i.w,"Translating: ",Dt.get(i.v)," --- ",Dt.get(i.w)),Dt.get(i.v)||Dt.get(i.w)){if(I.debug("Fixing and trying - removing XXX",i.v,i.w,i.name),a=Zc(i.v),o=Zc(i.w),e.removeEdge(i.v,i.w,i.name),a!==i.v){const n=e.parent(a);Dt.get(n).externalConnections=!0,s.fromCluster=i.v}if(o!==i.w){const n=e.parent(o);Dt.get(n).externalConnections=!0,s.toCluster=i.w}I.debug("Fix Replacing with XXX",a,o,i.name),e.setEdge(a,o,s,i.name)}}),Xp(e,0),I.trace(Dt)},"adjustClustersAndEdges"),Xp=g((e,t)=>{var s,a;if(t>10){I.error("Bailing out");return}let r=e.nodes(),i=!1;for(const o of r){const n=e.children(o);i=i||n.length>0}if(!i){I.debug("Done, no node has children",e.nodes());return}I.debug("Nodes = ",r,t);for(const o of r)if(I.debug("Extracting node",o,Dt,Dt.has(o)&&!Dt.get(o).externalConnections,!e.parent(o),e.node(o),e.children("D")," Depth ",t),!Dt.has(o))I.debug("Not a cluster",o,t);else if(!Dt.get(o).externalConnections&&e.children(o)&&e.children(o).length>0){I.debug("Cluster without external connections, without a parent and with children",o,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(s=Dt.get(o))==null?void 0:s.clusterData)!=null&&a.dir&&(l=Dt.get(o).clusterData.dir,I.debug("Fixing dir",Dt.get(o).clusterData.dir,l));const c=new qa({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});Up(o,e,c,o),e.setNode(o,{clusterNode:!0,id:o,clusterData:Dt.get(o).clusterData,label:Dt.get(o).label,graph:c})}else I.debug("Cluster ** ",o," **not meeting the criteria !externalConnections:",!Dt.get(o).externalConnections," no parent: ",!e.parent(o)," children ",e.children(o)&&e.children(o).length>0,e.children("D"),t),I.debug(Dt);r=e.nodes(),I.debug("New list of nodes",r);for(const o of r){const n=e.node(o);I.debug(" Now next level",o,n),n!=null&&n.clusterNode&&Xp(n.graph,t+1)}},"extractor"),Vp=g((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(i=>{const s=e.children(i),a=Vp(e,s);r=[...r,...a]}),r},"sorter"),SM=g(e=>Vp(e,e.children()),"sortNodesByHierarchy"),Zp=g((e,t,r)=>{let i=e.parent(t);for(;i&&i!==r;){const s=Dt.get(i);if(s&&!s.externalConnections)return!0;i=e.parent(i)}return!1},"isNodeInExtractableCluster"),av=g((e,t,r)=>{const i=e.children(t)??[];for(const s of i){if(s===r||os(s,r))continue;const a=ma(s,e,t);if(a&&!Zp(e,a,t))return a}return null},"findSafeAnchorNode");function Kp({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:i,afterPaint:s,paintOptions:a}){const o=t??Fl;return g(async function(l,c,h,u){const d=c.select("g");((h==null?void 0:h.insertMarkers)??bp)(d,l.markers,l.type,l.diagramId),Ll();const f={element:d,helpers:h,options:u};f.preparedLayout=await(e==null?void 0:e(l,f));const y=await o(l,f),m=await r(l,f),C={...f,measure:y};i?await i(l,C,m):await Ml(l,C,a),await(s==null?void 0:s(l,C,m))},"render")}g(Kp,"createCommonLayoutRenderer");function Ll(){Sw(),Iw(),Aw(),rv()}g(Ll,"clearLayoutRenderState");async function Fl(e,{element:t}){return await Yp(t,e)}g(Fl,"defaultMeasureLayout");async function Ml(e,t,r={}){var o,n;const{measure:i}=t,{groups:s}=i;for(const l of((o=r.getNodes)==null?void 0:o.call(r,e,t))??e.nodes)(n=r.skipNode)!=null&&n.call(r,l,t)||await Qp(s,l,t,r);const a=ty(e.nodes);for(const l of e.edges)ey(l,r)||await ry(s,l,a,e,r,t)}g(Ml,"paintLayoutData");async function Qp(e,t,r,i){t.clusterNode?mc(t):Jp(t,r,i)?await gp(e.clusters,t):mc(t)}g(Qp,"paintLayoutNode");function Jp(e,t,r){var i;return e.isGroup===!0&&(((i=r.isCluster)==null?void 0:i.call(r,e,t))??!0)}g(Jp,"shouldPaintAsCluster");function ty(e){const t=new Map;for(const r of e)r!=null&&r.id&&t.set(r.id,r);return t}g(ty,"buildNodeLookup");function ey(e,t){var r;return e.isLayoutOnly||!!((r=t.skipEdge)!=null&&r.call(t,e))}g(ey,"shouldSkipPaintEdge");async function ry(e,t,r,i,s,a){const o=mp(e.edgePaths,{...t},s.clusterDb??new Map,i.type,mn(t.start,t,r,a,s),mn(t.end,t,r,a,s),i.diagramId,iy(t,s));pp(t)&&(di.has(t.id)||await xl(e.edgeLabels,t),sy(t,o))}g(ry,"paintLayoutEdge");function mn(e,t,r,i,s){var a;return((a=s.getEdgeNode)==null?void 0:a.call(s,e,t,i))??(e?r.get(e)??{}:{})}g(mn,"getRenderedNode");function iy(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}g(iy,"shouldSkipIntersect");function sy(e,t){const r=(t==null?void 0:t.updatedPath)??(t==null?void 0:t.originalPath),i=Yt(),{subGraphTitleTotalMargin:s}=Aa({flowchart:i.flowchart??{}});if(e.label){const a=di.get(e.id);let o=e.x,n=e.y;if(r){const l=re.calcLabelPosition(r);I.debug("Moving label "+e.label+" from (",o,",",n,") to (",l.x,",",l.y,") abc88"),t!=null&&t.updatedPath&&(o=l.x,n=l.y)}a.attr("transform",`translate(${o}, ${n+s/2})`)}if(e!=null&&e.startLabelLeft){const a=Ut.get(e.id).startLeft;let o=e==null?void 0:e.x,n=e==null?void 0:e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.startLabelRight){const a=Ut.get(e.id).startRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelLeft){const a=Ut.get(e.id).endLeft;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelRight){const a=Ut.get(e.id).endRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}}g(sy,"positionRenderedEdgeLabel");function ay(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}g(ay,"getDefaultExportFromCjs");var Jt={},Ms={},Je={},Kc;function xi(){if(Kc)return Je;Kc=1;function e(o){return typeof o>"u"||o===null}g(e,"isNothing");function t(o){return typeof o=="object"&&o!==null}g(t,"isObject");function r(o){return Array.isArray(o)?o:e(o)?[]:[o]}g(r,"toArray");function i(o,n){if(n){const l=Object.keys(n);for(let c=0,h=l.length;c{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),dS=g((e,t,r)=>{const i=Yt(),{themeVariables:s}=i,{strokeWidth:a}=s,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),fS={extension:jw,composition:Uw,aggregation:Gw,dependency:Xw,lollipop:Vw,point:Zw,circle:Kw,cross:Qw,barb:Jw,barbNeo:tS,only_one:eS,zero_or_one:rS,one_or_more:iS,zero_or_more:sS,only_one_neo:aS,zero_or_one_neo:oS,one_or_more_neo:nS,zero_or_more_neo:lS,requirement_arrow:hS,requirement_contains:uS,requirement_arrow_neo:cS,requirement_contains_neo:dS},bp=Yw,kp=typeof global=="object"&&global&&global.Object===Object&&global,gS=typeof self=="object"&&self&&self.Object===Object&&self,Ze=kp||gS||Function("return this")(),De=Ze.Symbol,wp=Object.prototype,pS=wp.hasOwnProperty,yS=wp.toString,Oi=De?De.toStringTag:void 0;function mS(e){var t=pS.call(e,Oi),r=e[Oi];try{e[Oi]=void 0;var i=!0}catch{}var s=yS.call(e);return i&&(t?e[Oi]=r:delete e[Oi]),s}var xS=Object.prototype,CS=xS.toString;function bS(e){return CS.call(e)}var kS="[object Null]",wS="[object Undefined]",wc=De?De.toStringTag:void 0;function mi(e){return e==null?e===void 0?wS:kS:wc&&wc in Object(e)?mS(e):bS(e)}function Tr(e){return e!=null&&typeof e=="object"}var SS="[object Symbol]";function Cl(e){return typeof e=="symbol"||Tr(e)&&mi(e)==SS}function Sp(e,t){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r0){if(++t>=zS)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Hi(e){return function(){return e}}var Bc=(function(){try{var e=Mr(Object,"defineProperty");return e({},"",{}),e}catch{}})(),US=Bc?function(e,t){return Bc(e,"toString",{configurable:!0,enumerable:!1,value:Hi(t),writable:!0})}:$a,GS=jS(US);function XS(e,t){for(var r=-1,i=e==null?0:e.length;++r-1}var tT=9007199254740991,eT=/^(?:0|[1-9]\d*)$/;function _p(e,t){var r=typeof e;return t=t??tT,!!t&&(r=="number"||r!="symbol"&&eT.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=sT}function Oa(e){return e!=null&&kl(e.length)&&!pa(e)}var aT=Object.prototype;function vp(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||aT;return e===r}function oT(e,t){for(var r=-1,i=Array(e);++r-1}function d_(e,t){var r=this.__data__,i=Pa(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function Ke(e){var t=-1,r=e==null?0:e.length;for(this.clear();++tn))return!1;var c=a.get(e),h=a.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,f=r&Q_?new as:void 0;for(a.set(e,t),a.set(t,e);++u=KB){var c=ZB(e);if(c)return _l(c);o=!1,s=Pp,l=new as}else l=n;t:for(;++i1?s.setNode(a,r):s.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=ur,this._children[t]={},this._children[ur][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],cr(this.children(t),i=>{this.setParent(i)}),delete this._children[t]),cr(Ae(this._in[t]),r),delete this._in[t],delete this._preds[t],cr(Ae(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Wr(r))r=ur;else{r+="";for(var i=r;!Wr(i);i=this.parent(i))if(i===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==ur)return r}}children(t){if(Wr(t)&&(t=ur),this._isCompound){var r=this._children[t];if(r)return Ae(r)}else{if(t===ur)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return Ae(r)}successors(t){var r=this._sucs[t];if(r)return Ae(r)}neighbors(t){var r=this.predecessors(t);if(r)return JB(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var i=this;cr(this._nodes,function(o,n){t(n)&&r.setNode(n,o)}),cr(this._edgeObjs,function(o){r.hasNode(o.v)&&r.hasNode(o.w)&&r.setEdge(o,i.edge(o))});var s={};function a(o){var n=i.parent(o);return n===void 0||r.hasNode(n)?(s[o]=n,n):n in s?s[n]:a(n)}return this._isCompound&&cr(r.nodes(),function(o){r.setParent(o,a(o))}),r}setDefaultEdgeLabel(t){return pa(t)||(t=Hi(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return lo(this._edgeObjs)}setPath(t,r){var i=this,s=arguments;return XB(t,function(a,o){return s.length>1?i.setEdge(a,o,r):i.setEdge(a,o),o}),this}setEdge(){var t,r,i,s,a=!1,o=arguments[0];typeof o=="object"&&o!==null&&"v"in o?(t=o.v,r=o.w,i=o.name,arguments.length===2&&(s=arguments[1],a=!0)):(t=o,r=arguments[1],i=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),t=""+t,r=""+r,Wr(i)||(i=""+i);var n=Yi(this._isDirected,t,r,i);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,n))return a&&(this._edgeLabels[n]=s),this;if(!Wr(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[n]=a?s:this._defaultEdgeLabelFn(t,r,i);var l=ev(this._isDirected,t,r,i);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[n]=l,Xc(this._preds[r],t),Xc(this._sucs[t],r),this._in[r][n]=l,this._out[t][n]=l,this._edgeCount++,this}edge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return this._edgeLabels[s]}hasEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return Object.prototype.hasOwnProperty.call(this._edgeLabels,s)}removeEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i),a=this._edgeObjs[s];return a&&(t=a.v,r=a.w,delete this._edgeLabels[s],delete this._edgeObjs[s],Vc(this._preds[r],t),Vc(this._sucs[t],r),delete this._in[r][s],delete this._out[t][s],this._edgeCount--),this}inEdges(t,r){var i=this._in[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.v===r}):s}}outEdges(t,r){var i=this._out[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.w===r}):s}}nodeEdges(t,r){var i=this.inEdges(t,r);if(i)return i.concat(this.outEdges(t,r))}}qa.prototype._nodeCount=0;qa.prototype._edgeCount=0;function Xc(e,t){e[t]?e[t]++:e[t]=1}function Vc(e,t){--e[t]||delete e[t]}function Yi(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}return s+Gc+a+Gc+(Wr(i)?tv:i)}function ev(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}var n={v:s,w:a};return i&&(n.name=i),n}function ho(e,t){return Yi(e,t.v,t.w,t.name)}function Wp(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),s=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),o=r.insert("g").attr("class","nodes");return{clusters:i,edgePaths:s,edgeLabels:a,nodes:o,rootGroups:r}}g(Wp,"createLayoutElementGroups");async function zp(e,t){if(t.label){const{shapeSvg:r,bbox:i}=await mt(e,t);t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}g(zp,"measureGroupLabel");async function Hp(e,t,r){var a;const i=await ml(e,t,r),s=((a=i.node())==null?void 0:a.getBBox())??{width:0,height:0};return t.width=s.width,t.height=s.height,i}g(Hp,"insertMeasuredNode");async function Yp(e,t){const r=new qa({multigraph:!0,compound:!0}),i=[...t.edges],s=Et(),a=Wp(e),{edgeLabels:o,nodes:n}=a,l=new Map,c=e.node()!=null;await Promise.all(t.nodes.map(async h=>{if(h.isGroup)c&&await zp(n,h),r.setNode(h.id,{...h});else{if(c){const u=await Hp(n,h,{config:s,dir:h.dir});l.set(h.id,u)}r.setNode(h.id,{...h})}}));for(const h of i)c&&pp(h)&&await xl(o,h),r.setEdge(h.start,h.end,{...h},h.id),t.edges.some(d=>d.id===h.id)||t.edges.push(h);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:h}=await Mt(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-INFHLROL-CKc8uScH.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3]));h(e,t)}return{graph:r,groups:a,nodeElements:l}}g(Yp,"createGraphWithElements");var Dt=new Map,yr=new Map,jp=new Map,rv=g(()=>{yr.clear(),jp.clear(),Dt.clear()},"clear"),os=g((e,t)=>{const r=yr.get(t)||[];return I.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),iv=g((e,t)=>{const r=yr.get(t)||[];return I.info("Descendants of ",t," is ",r),I.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||os(e.v,t)||os(e.w,t)||r.includes(e.w):(I.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),Up=g((e,t,r,i)=>{I.debug("Copying children of ",e,"root",i,"data",t.node(e),i);const s=t.children(e)||[];e!==i&&s.push(e),I.debug("Copying (nodes) clusterId",e,"nodes",s),s.forEach(a=>{if(t.children(a).length>0)Up(a,t,r,i);else{const o=t.node(a);I.info("cp ",a," to ",i," with parent ",e),r.setNode(a,o),i!==t.parent(a)&&(I.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(I.debug("Setting parent",a,e),r.setParent(a,e)):(I.info("In copy ",e,"root",i,"data",t.node(e),i),I.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==i,"node!==clusterId",a!==e));const n=t.edges(a);I.debug("Copying Edges",n),n.forEach(l=>{I.info("Edge",l);const c=t.edge(l.v,l.w,l.name);I.info("Edge data",c,i);try{iv(l,i)?(I.info("Copying as ",l.v,l.w,c,l.name),r.setEdge(l.v,l.w,c,l.name),I.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):I.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",i," clusterId:",e)}catch(h){I.error(h)}})}I.debug("Removing node",a),t.removeNode(a)})},"copy"),Gp=g((e,t)=>{const r=t.children(e);let i=[...r];for(const s of r)jp.set(s,e),i=[...i,...Gp(s,t)];return i},"extractDescendants"),sv=g((e,t,r)=>{const i=e.edges().filter(l=>l.v===t||l.w===t),s=e.edges().filter(l=>l.v===r||l.w===r),a=i.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),o=s.map(l=>({v:l.v,w:l.w}));return a.filter(l=>o.some(c=>l.v===c.v&&l.w===c.w))},"findCommonEdges"),ma=g((e,t,r)=>{const i=t.children(e);if(I.trace("Searching children of id ",e,i),i.length<1)return e;let s;for(const a of i){const o=ma(a,t,r),n=sv(t,r,o);if(o)if(n.length>0)s=o;else return o}return s},"findNonClusterChild"),Zc=g(e=>!Dt.has(e)||!Dt.get(e).externalConnections?e:Dt.has(e)?Dt.get(e).id:e,"getAnchorId"),wM=g((e,t)=>{var r;if(!e||t>10){I.debug("Opting out, no graph ");return}else I.debug("Opting in, graph ");e.nodes().forEach(function(i){e.children(i).length>0&&(I.debug("Cluster identified",i," Replacement id in edges: ",ma(i,e,i)),yr.set(i,Gp(i,e)),Dt.set(i,{id:ma(i,e,i),clusterData:e.node(i)}))}),e.nodes().forEach(function(i){const s=e.children(i),a=e.edges();s.length>0?(I.debug("Cluster identified",i,yr),a.forEach(o=>{const n=os(o.v,i),l=os(o.w,i);n^l&&(I.debug("Edge: ",o," leaves cluster ",i),I.debug("Descendants of XXX ",i,": ",yr.get(i)),Dt.get(i).externalConnections=!0)})):I.debug("Not a cluster ",i,yr)});for(let i of Dt.keys()){const s=Dt.get(i).id,a=e.parent(s);a!==i&&Dt.has(a)&&!Dt.get(a).externalConnections&&(Dt.get(i).id=a);const o=e.edges().some(n=>n.v===i);if(s&&((r=Dt.get(i))!=null&&r.externalConnections)&&o&&Zp(e,s,i)){const n=av(e,i,e.parent(s));n&&(Dt.get(i).id=n)}}e.edges().forEach(function(i){const s=e.edge(i);I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(i)),I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(e.edge(i)));let a=i.v,o=i.w;if(I.debug("Fix XXX",Dt,"ids:",i.v,i.w,"Translating: ",Dt.get(i.v)," --- ",Dt.get(i.w)),Dt.get(i.v)||Dt.get(i.w)){if(I.debug("Fixing and trying - removing XXX",i.v,i.w,i.name),a=Zc(i.v),o=Zc(i.w),e.removeEdge(i.v,i.w,i.name),a!==i.v){const n=e.parent(a);Dt.get(n).externalConnections=!0,s.fromCluster=i.v}if(o!==i.w){const n=e.parent(o);Dt.get(n).externalConnections=!0,s.toCluster=i.w}I.debug("Fix Replacing with XXX",a,o,i.name),e.setEdge(a,o,s,i.name)}}),Xp(e,0),I.trace(Dt)},"adjustClustersAndEdges"),Xp=g((e,t)=>{var s,a;if(t>10){I.error("Bailing out");return}let r=e.nodes(),i=!1;for(const o of r){const n=e.children(o);i=i||n.length>0}if(!i){I.debug("Done, no node has children",e.nodes());return}I.debug("Nodes = ",r,t);for(const o of r)if(I.debug("Extracting node",o,Dt,Dt.has(o)&&!Dt.get(o).externalConnections,!e.parent(o),e.node(o),e.children("D")," Depth ",t),!Dt.has(o))I.debug("Not a cluster",o,t);else if(!Dt.get(o).externalConnections&&e.children(o)&&e.children(o).length>0){I.debug("Cluster without external connections, without a parent and with children",o,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(s=Dt.get(o))==null?void 0:s.clusterData)!=null&&a.dir&&(l=Dt.get(o).clusterData.dir,I.debug("Fixing dir",Dt.get(o).clusterData.dir,l));const c=new qa({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});Up(o,e,c,o),e.setNode(o,{clusterNode:!0,id:o,clusterData:Dt.get(o).clusterData,label:Dt.get(o).label,graph:c})}else I.debug("Cluster ** ",o," **not meeting the criteria !externalConnections:",!Dt.get(o).externalConnections," no parent: ",!e.parent(o)," children ",e.children(o)&&e.children(o).length>0,e.children("D"),t),I.debug(Dt);r=e.nodes(),I.debug("New list of nodes",r);for(const o of r){const n=e.node(o);I.debug(" Now next level",o,n),n!=null&&n.clusterNode&&Xp(n.graph,t+1)}},"extractor"),Vp=g((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(i=>{const s=e.children(i),a=Vp(e,s);r=[...r,...a]}),r},"sorter"),SM=g(e=>Vp(e,e.children()),"sortNodesByHierarchy"),Zp=g((e,t,r)=>{let i=e.parent(t);for(;i&&i!==r;){const s=Dt.get(i);if(s&&!s.externalConnections)return!0;i=e.parent(i)}return!1},"isNodeInExtractableCluster"),av=g((e,t,r)=>{const i=e.children(t)??[];for(const s of i){if(s===r||os(s,r))continue;const a=ma(s,e,t);if(a&&!Zp(e,a,t))return a}return null},"findSafeAnchorNode");function Kp({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:i,afterPaint:s,paintOptions:a}){const o=t??Fl;return g(async function(l,c,h,u){const d=c.select("g");((h==null?void 0:h.insertMarkers)??bp)(d,l.markers,l.type,l.diagramId),Ll();const f={element:d,helpers:h,options:u};f.preparedLayout=await(e==null?void 0:e(l,f));const y=await o(l,f),m=await r(l,f),C={...f,measure:y};i?await i(l,C,m):await Ml(l,C,a),await(s==null?void 0:s(l,C,m))},"render")}g(Kp,"createCommonLayoutRenderer");function Ll(){Sw(),Iw(),Aw(),rv()}g(Ll,"clearLayoutRenderState");async function Fl(e,{element:t}){return await Yp(t,e)}g(Fl,"defaultMeasureLayout");async function Ml(e,t,r={}){var o,n;const{measure:i}=t,{groups:s}=i;for(const l of((o=r.getNodes)==null?void 0:o.call(r,e,t))??e.nodes)(n=r.skipNode)!=null&&n.call(r,l,t)||await Qp(s,l,t,r);const a=ty(e.nodes);for(const l of e.edges)ey(l,r)||await ry(s,l,a,e,r,t)}g(Ml,"paintLayoutData");async function Qp(e,t,r,i){t.clusterNode?mc(t):Jp(t,r,i)?await gp(e.clusters,t):mc(t)}g(Qp,"paintLayoutNode");function Jp(e,t,r){var i;return e.isGroup===!0&&(((i=r.isCluster)==null?void 0:i.call(r,e,t))??!0)}g(Jp,"shouldPaintAsCluster");function ty(e){const t=new Map;for(const r of e)r!=null&&r.id&&t.set(r.id,r);return t}g(ty,"buildNodeLookup");function ey(e,t){var r;return e.isLayoutOnly||!!((r=t.skipEdge)!=null&&r.call(t,e))}g(ey,"shouldSkipPaintEdge");async function ry(e,t,r,i,s,a){const o=mp(e.edgePaths,{...t},s.clusterDb??new Map,i.type,mn(t.start,t,r,a,s),mn(t.end,t,r,a,s),i.diagramId,iy(t,s));pp(t)&&(di.has(t.id)||await xl(e.edgeLabels,t),sy(t,o))}g(ry,"paintLayoutEdge");function mn(e,t,r,i,s){var a;return((a=s.getEdgeNode)==null?void 0:a.call(s,e,t,i))??(e?r.get(e)??{}:{})}g(mn,"getRenderedNode");function iy(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}g(iy,"shouldSkipIntersect");function sy(e,t){const r=(t==null?void 0:t.updatedPath)??(t==null?void 0:t.originalPath),i=Yt(),{subGraphTitleTotalMargin:s}=Aa({flowchart:i.flowchart??{}});if(e.label){const a=di.get(e.id);let o=e.x,n=e.y;if(r){const l=re.calcLabelPosition(r);I.debug("Moving label "+e.label+" from (",o,",",n,") to (",l.x,",",l.y,") abc88"),t!=null&&t.updatedPath&&(o=l.x,n=l.y)}a.attr("transform",`translate(${o}, ${n+s/2})`)}if(e!=null&&e.startLabelLeft){const a=Ut.get(e.id).startLeft;let o=e==null?void 0:e.x,n=e==null?void 0:e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.startLabelRight){const a=Ut.get(e.id).startRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelLeft){const a=Ut.get(e.id).endLeft;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelRight){const a=Ut.get(e.id).endRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}}g(sy,"positionRenderedEdgeLabel");function ay(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}g(ay,"getDefaultExportFromCjs");var Jt={},Ms={},Je={},Kc;function xi(){if(Kc)return Je;Kc=1;function e(o){return typeof o>"u"||o===null}g(e,"isNothing");function t(o){return typeof o=="object"&&o!==null}g(t,"isObject");function r(o){return Array.isArray(o)?o:e(o)?[]:[o]}g(r,"toArray");function i(o,n){if(n){const l=Object.keys(n);for(let c=0,h=l.length;cu&&(c=" ... ",a=n-u+c.length),o-n>u&&(h=" ...",o=n+u-h.length),{str:c+s.slice(a,o).replace(/\t/g,"→")+h,pos:n-a+c.length}}g(t,"getLine");function r(s,a){return e.repeat(" ",a-s.length)+s}g(r,"padStart");function i(s,a){if(a=Object.create(a||null),!s.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);const o=/\r?\n|\r|\0/g,n=[0],l=[];let c,h=-1;for(;c=o.exec(s.buffer);)l.push(c.index),n.push(c.index+c[0].length),s.position<=c.index&&h<0&&(h=n.length-2);h<0&&(h=n.length-1);let u="";const d=Math.min(s.line+a.linesAfter,l.length).toString().length,f=a.maxLength-(a.indent+d+3);for(let m=1;m<=a.linesBefore&&!(h-m<0);m++){const C=t(s.buffer,n[h-m],l[h-m],s.position-(n[h]-n[h-m]),f);u=e.repeat(" ",a.indent)+r((s.line-m+1).toString(),d)+" | "+C.str+` `+u}const y=t(s.buffer,n[h],l[h],s.position,f);u+=e.repeat(" ",a.indent)+r((s.line+1).toString(),d)+" | "+y.str+` @@ -296,8 +296,8 @@ ${a.join(` `+S.slice(Z,tt),Z=tt+1),Q=ft;return lt+=` `,S.length-Z>P&&Q>Z?lt+=S.slice(Z,Q)+` `+S.slice(Q+1):lt+=S.slice(Z),lt.slice(1)}g(xe,"foldLine");function Si(S){let P="",J=0;for(let X=0;X=65536?X+=2:X++){J=ut(S,X);const Z=A[J];!Z&&_t(J)?(P+=S[X],J>=65536&&(P+=S[X+1])):P+=Z||$(J)}return P}g(Si,"escapeString");function $r(S,P,J){let X="";const Z=S.tag;for(let tt=0,Q=J.length;tt"u"&&G(S,P,null,!1,!1))&&(X!==""&&(X+=","+(S.condenseFlow?"":" ")),X+=S.dump)}S.tag=Z,S.dump="["+X+"]"}g($r,"writeFlowSequence");function Or(S,P,J,X){let Z="";const tt=S.tag;for(let Q=0,ft=J.length;Q"u"&&G(S,P+1,null,!0,!0,!1,!0))&&((!X||Z!=="")&&(Z+=gt(S,P)),S.dump&&n===S.dump.charCodeAt(0)?Z+="-":Z+="- ",Z+=S.dump)}S.tag=tt,S.dump=Z||"[]"}g(Or,"writeBlockSequence");function Ti(S,P,J){let X="";const Z=S.tag,tt=Object.keys(J);for(let Q=0,ft=tt.length;Q1024&&(lt+="? "),lt+=S.dump+(S.condenseFlow?'"':"")+":"+(S.condenseFlow?"":" "),G(S,P,kt,!1,!1)&&(lt+=S.dump,X+=lt))}S.tag=Z,S.dump="{"+X+"}"}g(Ti,"writeFlowMapping");function p(S,P,J,X){let Z="";const tt=S.tag,Q=Object.keys(J);if(S.sortKeys===!0)Q.sort();else if(typeof S.sortKeys=="function")Q.sort(S.sortKeys);else if(S.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let ft=0,lt=Q.length;ft1024;Wt&&(S.dump&&n===S.dump.charCodeAt(0)?Ct+="?":Ct+="? "),Ct+=S.dump,Wt&&(Ct+=gt(S,P)),G(S,P+1,Ot,!0,Wt)&&(S.dump&&n===S.dump.charCodeAt(0)?Ct+=":":Ct+=": ",Ct+=S.dump,Z+=Ct)}S.tag=tt,S.dump=Z||"{}"}g(p,"writeBlockMapping");function O(S,P,J){const X=J?S.explicitTypes:S.implicitTypes;for(let Z=0,tt=X.length;Z tag resolver accepts not "'+ft+'" style');S.dump=lt}return!0}}return!1}g(O,"detectType");function G(S,P,J,X,Z,tt,Q){S.tag=null,S.dump=J,O(S,J,!1)||O(S,J,!0);const ft=i.call(S.dump),lt=X;X&&(X=S.flowLevel<0||S.flowLevel>P);const Ct=ft==="[object Object]"||ft==="[object Array]";let kt,Ot;if(Ct&&(kt=S.duplicates.indexOf(J),Ot=kt!==-1),(S.tag!==null&&S.tag!=="?"||Ot||S.indent!==2&&P>0)&&(Z=!1),Ot&&S.usedDuplicates[kt])S.dump="*ref_"+kt;else{if(Ct&&Ot&&!S.usedDuplicates[kt]&&(S.usedDuplicates[kt]=!0),ft==="[object Object]")X&&Object.keys(S.dump).length!==0?(p(S,P,S.dump,Z),Ot&&(S.dump="&ref_"+kt+S.dump)):(Ti(S,P,S.dump),Ot&&(S.dump="&ref_"+kt+" "+S.dump));else if(ft==="[object Array]")X&&S.dump.length!==0?(S.noArrayIndent&&!Q&&P>0?Or(S,P-1,S.dump,Z):Or(S,P,S.dump,Z),Ot&&(S.dump="&ref_"+kt+S.dump)):($r(S,P,S.dump),Ot&&(S.dump="&ref_"+kt+" "+S.dump));else if(ft==="[object String]")S.tag!=="?"&&ki(S,S.dump,P,tt,lt);else{if(ft==="[object Undefined]")return!1;if(S.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+ft)}if(S.tag!==null&&S.tag!=="?"){let Wt=encodeURI(S.tag[0]==="!"?S.tag.slice(1):S.tag).replace(/!/g,"%21");S.tag[0]==="!"?Wt="!"+Wt:Wt.slice(0,18)==="tag:yaml.org,2002:"?Wt="!!"+Wt.slice(18):Wt="!<"+Wt+">",S.dump=Wt+" "+S.dump}}return!0}g(G,"writeNode");function K(S,P){const J=[],X=[];j(S,J,X);const Z=X.length;for(let tt=0;tt{for(const t of e)ns[t.name]=t},"registerLayoutLoaders"),uv=g(()=>{cy([{name:"dagre",loader:g(async()=>await Mt(()=>import("./dagre-GXQ25YYZ-BPre4f4O.js"),__vite__mapDeps([4,5,1,2,3])),"loader")},{name:"swimlane",loader:g(async()=>await Mt(()=>import("./swimlanes-42K2YHIH-Ef_o-11t.js"),__vite__mapDeps([6,1,2,3])),"loader")},{name:"cose-bilkent",loader:g(async()=>await Mt(()=>import("./cose-bilkent-JH36ORCC-C7XBKZ-1.js"),__vite__mapDeps([7,8,2,1,3])),"loader")}])},"registerDefaultLayoutLoaders");uv();var PM=g(async(e,t)=>{if(!(e.layoutAlgorithm in ns))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const h of e.nodes){const u=h.domId||h.id;h.domId=`${e.diagramId}-${u}`}const r=ns[e.layoutAlgorithm],i=await r.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:o,gradientStart:n,gradientStop:l}=a,c=t.attr("id");if(t.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),o){const h=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",n).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return i.render(e,t,cv,{algorithm:r.algorithm})},"render"),IM=g((e="",{fallback:t="dagre"}={})=>{if(e in ns)return e;if(t in ns)return I.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Xl="comm",uy="rule",dy="decl",dv="@media",fv="@import",gv="@supports",pv="@namespace",xn="@keyframes",fy="@layer",yv="@scope",mv=Math.abs,Ki=String.fromCharCode;function gy(e){return e.trim()}function Cn(e,t,r){return e.replace(t,r)}function Ur(e,t){return e.charCodeAt(t)|0}function fi(e,t,r){return e.slice(t,r)}function Me(e){return e.length}function py(e){return e.length}function As(e,t){return t.push(e),e}var Wa=1,gi=1,yy=0,pe=0,Gt=0,bi="";function Vl(e,t,r,i,s,a,o,n){return{value:e,root:t,parent:r,type:i,props:s,children:a,line:Wa,column:gi,length:o,return:"",siblings:n}}function xv(){return Gt}function Cv(){return Gt=pe>0?Ur(bi,--pe):0,gi--,Gt===10&&(gi=1,Wa--),Gt}function Se(){return Gt=pe2||ls(Gt)>3?"":" "}function Sv(e,t){for(;--t&&Se()&&!(Gt<48||Gt>102||Gt>57&&Gt<65||Gt>70&&Gt<97););return za(e,Ys()+(t<6&&ir()==32&&Se()==32))}function bn(e){for(;Se();)switch(Gt){case e:return pe;case 34:case 39:e!==34&&e!==39&&bn(Gt);break;case 40:e===41&&bn(e);break;case 92:Se();break}return pe}function Tv(e,t){for(;Se()&&e+Gt!==57;)if(e+Gt===84&&ir()===47)break;return"/*"+za(t,pe-1)+"*"+Ki(e===47?e:Se())}function _v(e){for(;!ls(ir());)Se();return za(e,pe)}function Bv(e){return kv(js("",null,null,null,[""],e=bv(e),0,[0],e))}function js(e,t,r,i,s,a,o,n,l){for(var c=0,h=0,u=o,d=0,f=0,y=0,m=1,C=1,x=1,k=0,w=0,T="",_=s,v=a,F=i,L=T;C;)switch(y=w,w=Se()){case 40:y!=108&&Ur(L,u-1)==58?(k++,L+="("):L+=$o(w);break;case 41:k--,L+=")";break;case 34:case 39:case 91:L+=$o(w);break;case 9:case 10:case 13:case 32:if(k>0){L+=Ki(w);break}L+=wv(y);break;case 92:L+=Sv(Ys()-1,7);continue;case 47:switch(ir()){case 42:case 47:As(vv(Tv(Se(),Ys()),t,r,l),l),(ls(y||1)==5||ls(ir()||1)==5)&&Me(L)&&fi(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*m:n[c++]=Me(L)*x;case 125*m:case 59:case 0:if(k>0&&w){L+=Ki(w);break}switch(w){case 0:case 125:C=0;case 59+h:x==-1&&(L=Cn(L,/\f/g,"")),f>0&&(Me(L)-u||m===0)&&As(f>32?Su(L+";",i,r,u-1,l):Su(Cn(L," ","")+";",i,r,u-2,l),l);break;case 59:L+=";";default:if(As(F=wu(L,t,r,c,h,s,n,T,_=[],v=[],u,a),a),w===123)if(h===0)js(L,t,F,F,_,a,u,n,v);else{switch(d){case 99:if(Ur(L,3)===110)break;case 108:if(Ur(L,2)===97)break;default:h=0;case 100:case 109:case 115:}h?js(e,F,F,i&&As(wu(e,F,F,0,0,s,n,T,s,_=[],u,v),v),s,v,u,n,i?_:v):js(L,F,F,F,[""],v,0,n,v)}}c=h=f=0,m=x=1,T=L="",u=o;break;case 58:u=1+Me(L),f=y;default:if(m<1){if(w==123)--m;else if(w==125&&m++==0&&Cv()==125)continue}switch(L+=Ki(w),w*m){case 38:x=h>0?1:(L+="\f",-1);break;case 44:if(k>0)break;n[c++]=(Me(L)-1)*x,x=1;break;case 64:ir()===45&&(L+=$o(Se())),d=ir(),h=u=Me(T=L+=_v(Ys())),w++;break;case 45:y===45&&Me(L)==2&&(m=0)}}return a}function wu(e,t,r,i,s,a,o,n,l,c,h,u){for(var d=s-1,f=s===0?a:[""],y=py(f),m=0,C=0,x=0;m0?f[k]+" "+w:Cn(w,/&\f/g,f[k])))&&(l[x++]=T);return Vl(e,t,r,s===0?uy:n,l,c,h,u)}function vv(e,t,r,i){return Vl(e,t,r,Xl,Ki(xv()),fi(e,2,-2),0,i)}function Su(e,t,r,i,s){return Vl(e,t,r,dy,fi(e,0,i),fi(e,i+1,-1),i,s)}function kn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Av=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-Q9nf5Gsa.js");return{diagram:t}},__vite__mapDeps([9,10,1,2,3]));return{id:my,diagram:e}},"loader"),Ev={id:my,detector:Mv,loader:Av},$v=Ev,xy="flowchart",Ov=g((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),Dv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-DrKzI2V6.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:xy,diagram:e}},"loader"),Pv={id:xy,detector:Ov,loader:Dv},Iv=Pv,Cy="flowchart-v2",Rv=g((e,t)=>{var r,i,s;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((s=t==null?void 0:t.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),qv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-DrKzI2V6.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Cy,diagram:e}},"loader"),Nv={id:Cy,detector:Rv,loader:qv},Wv=Nv,by="swimlane",zv=g(e=>/^\s*swimlane-beta\b/.test(e),"detector"),Hv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-DNn1qeTZ.js");return{diagram:t}},__vite__mapDeps([16,11,12,13,14,10,1,2,3,15]));return{id:by,diagram:e}},"loader"),Yv={id:by,detector:zv,loader:Hv},jv=Yv,ky="er",Uv=g(e=>/^\s*erDiagram/.test(e),"detector"),Gv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-D5xxq6f8.js");return{diagram:t}},__vite__mapDeps([17,13,14,15,1,2,3]));return{id:ky,diagram:e}},"loader"),Xv={id:ky,detector:Uv,loader:Gv},Vv=Xv,wy="gitGraph",Zv=g(e=>/^\s*gitGraph/.test(e),"detector"),Kv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-Bl_uVKdO.js");return{diagram:t}},__vite__mapDeps([18,19,20,21,1,2,3]));return{id:wy,diagram:e}},"loader"),Qv={id:wy,detector:Zv,loader:Kv},Jv=Qv,Sy="gantt",tL=g(e=>/^\s*gantt/.test(e),"detector"),eL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-Djl_xd9d.js");return{diagram:t}},__vite__mapDeps([22,2,23,24,25,1,3]));return{id:Sy,diagram:e}},"loader"),rL={id:Sy,detector:tL,loader:eL},iL=rL,Ty="info",sL=g(e=>/^\s*info/.test(e),"detector"),aL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-B2QKprgt.js");return{diagram:t}},__vite__mapDeps([26,21,1,2,3]));return{id:Ty,diagram:e}},"loader"),oL={id:Ty,detector:sL,loader:aL},_y="pie",nL=g(e=>/^\s*pie/.test(e),"detector"),lL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-nq59ZEFW.js");return{diagram:t}},__vite__mapDeps([27,20,21,1,2,3,28,29,24]));return{id:_y,diagram:e}},"loader"),hL={id:_y,detector:nL,loader:lL},By="quadrantChart",cL=g(e=>/^\s*quadrantChart/.test(e),"detector"),uL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-CApaH6GE.js");return{diagram:t}},__vite__mapDeps([30,23,24,25,1,2,3]));return{id:By,diagram:e}},"loader"),dL={id:By,detector:cL,loader:uL},fL=dL,vy="xychart",gL=g(e=>/^\s*xychart(-beta)?/.test(e),"detector"),pL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-DgwC-FOX.js");return{diagram:t}},__vite__mapDeps([31,24,29,23,25,1,2,3]));return{id:vy,diagram:e}},"loader"),yL={id:vy,detector:gL,loader:pL},mL=yL,Ly="requirement",xL=g(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),CL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-DZ6X4Hg-.js");return{diagram:t}},__vite__mapDeps([32,13,14,1,2,3]));return{id:Ly,diagram:e}},"loader"),bL={id:Ly,detector:xL,loader:CL},kL=bL,Fy="sequence",wL=g(e=>/^\s*sequenceDiagram/.test(e),"detector"),SL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-DZbP_JPP.js");return{diagram:t}},__vite__mapDeps([33,19,10,1,2,3]));return{id:Fy,diagram:e}},"loader"),TL={id:Fy,detector:wL,loader:SL},_L=TL,My="class",BL=g((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),vL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-Deegt-EK.js");return{diagram:t}},__vite__mapDeps([34,35,12,13,14,10,1,2,3]));return{id:My,diagram:e}},"loader"),LL={id:My,detector:BL,loader:vL},FL=LL,Ay="classDiagram",ML=g((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),AL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-Deegt-EK.js");return{diagram:t}},__vite__mapDeps([36,35,12,13,14,10,1,2,3]));return{id:Ay,diagram:e}},"loader"),EL={id:Ay,detector:ML,loader:AL},$L=EL,Ey="state",OL=g((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),DL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-DYtq5BDk.js");return{diagram:t}},__vite__mapDeps([37,38,13,14,10,1,2,3,5]));return{id:Ey,diagram:e}},"loader"),PL={id:Ey,detector:OL,loader:DL},IL=PL,$y="stateDiagram",RL=g((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),qL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-CFM38Jht.js");return{diagram:t}},__vite__mapDeps([39,38,13,14,10,1,2,3]));return{id:$y,diagram:e}},"loader"),NL={id:$y,detector:RL,loader:qL},WL=NL,Oy="journey",zL=g(e=>/^\s*journey/.test(e),"detector"),HL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-DmXdNqni.js");return{diagram:t}},__vite__mapDeps([40,12,10,28,1,2,3]));return{id:Oy,diagram:e}},"loader"),YL={id:Oy,detector:zL,loader:HL},jL=YL,UL=g((e,t,r)=>{I.debug(`rendering svg for syntax error -`);const i=f1(t),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Uu(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Dy={draw:UL},GL=Dy,XL={db:{},renderer:Dy,parser:{parse:g(()=>{},"parse")}},VL=XL,Py="flowchart-elk",ZL=g((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),KL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-DrKzI2V6.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Py,diagram:e}},"loader"),QL={id:Py,detector:ZL,loader:KL},JL=QL,Iy="timeline",tF=g(e=>/^\s*timeline/.test(e),"detector"),eF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-CD71W6Ad.js");return{diagram:t}},__vite__mapDeps([41,28,1,2,3]));return{id:Iy,diagram:e}},"loader"),rF={id:Iy,detector:tF,loader:eF},iF=rF,Ry="mindmap",sF=g(e=>/^\s*mindmap/.test(e),"detector"),aF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-Doia6bAL.js");return{diagram:t}},__vite__mapDeps([42,13,14,1,2,3]));return{id:Ry,diagram:e}},"loader"),oF={id:Ry,detector:sF,loader:aF},nF=oF,qy="kanban",lF=g(e=>/^\s*kanban/.test(e),"detector"),hF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-CPNlmuSu.js");return{diagram:t}},__vite__mapDeps([43,12,1,2,3]));return{id:qy,diagram:e}},"loader"),cF={id:qy,detector:lF,loader:hF},uF=cF,Ny="sankey",dF=g(e=>/^\s*sankey(-beta)?/.test(e),"detector"),fF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-KPy6Sszp.js");return{diagram:t}},__vite__mapDeps([44,29,24,1,2,3]));return{id:Ny,diagram:e}},"loader"),gF={id:Ny,detector:dF,loader:fF},pF=gF,Wy="packet",yF=g(e=>/^\s*packet(-beta)?/.test(e),"detector"),mF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-CCO8xWsb.js");return{diagram:t}},__vite__mapDeps([45,20,21,1,2,3]));return{id:Wy,diagram:e}},"loader"),xF={id:Wy,detector:yF,loader:mF},zy="radar",CF=g(e=>/^\s*radar-beta/.test(e),"detector"),bF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-C84fy4x0.js");return{diagram:t}},__vite__mapDeps([46,20,21,1,2,3]));return{id:zy,diagram:e}},"loader"),kF={id:zy,detector:CF,loader:bF},Hy="block",wF=g(e=>/^\s*block(-beta)?/.test(e),"detector"),SF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-BfemG4eq.js");return{diagram:t}},__vite__mapDeps([47,12,15,1,2,3]));return{id:Hy,diagram:e}},"loader"),TF={id:Hy,detector:wF,loader:SF},_F=TF,Yy="treeView",BF=g(e=>/^\s*treeView-beta/.test(e),"detector"),vF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-BS8K541U.js");return{diagram:t}},__vite__mapDeps([48,19,20,21,1,2,3]));return{id:Yy,diagram:e}},"loader"),LF={id:Yy,detector:BF,loader:vF},FF=LF,jy="architecture",MF=g(e=>/^\s*architecture/.test(e),"detector"),AF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-Bn5yUOBZ.js");return{diagram:t}},__vite__mapDeps([49,20,21,1,2,3,8]));return{id:jy,diagram:e}},"loader"),EF={id:jy,detector:MF,loader:AF},$F=EF,Uy="eventmodeling",OF=g(e=>/^\s*eventmodeling/.test(e),"detector"),DF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-BrT7N-mF.js");return{diagram:t}},__vite__mapDeps([50,20,21,1,2,3]));return{id:Uy,diagram:e}},"loader"),PF={id:Uy,detector:OF,loader:DF},IF=PF,Gy="ishikawa",RF=g(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),qF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-RV6LF1dl.js");return{diagram:t}},__vite__mapDeps([51,1,2,3]));return{id:Gy,diagram:e}},"loader"),NF={id:Gy,detector:RF,loader:qF},Xy="venn",WF=g(e=>/^\s*venn-beta/.test(e),"detector"),zF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-BWkGFFy0.js");return{diagram:t}},__vite__mapDeps([52,1,2,3]));return{id:Xy,diagram:e}},"loader"),HF={id:Xy,detector:WF,loader:zF},YF=HF,Vy="treemap",jF=g(e=>/^\s*treemap/.test(e),"detector"),UF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-DnjjslPi.js");return{diagram:t}},__vite__mapDeps([53,20,14,21,1,2,3,25,29,24]));return{id:Vy,diagram:e}},"loader"),GF={id:Vy,detector:jF,loader:UF},Zy="wardley",XF=g(e=>/^\s*wardley-beta/i.test(e),"detector"),VF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-DixAstWQ.js");return{diagram:t}},__vite__mapDeps([54,20,21,1,2,3]));return{id:Zy,diagram:e}},"loader"),ZF={id:Zy,detector:XF,loader:VF},KF=ZF,Ky="cynefin",QF=g(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),JF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-Bc7uv2gD.js");return{diagram:t}},__vite__mapDeps([55,20,21,1,2,3]));return{id:Ky,diagram:e}},"loader"),t5={id:Ky,detector:QF,loader:JF},Qy="railroad",e5=g(e=>/^\s*railroad-beta/i.test(e),"detector"),r5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-CmYfgBi1.js");return{diagram:t}},__vite__mapDeps([56,57,20,21,1,2,3]));return{id:Qy,diagram:e}},"loader"),i5={id:Qy,detector:e5,loader:r5},Jy="railroadEbnf",s5=g(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),a5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-HFPcjqY1.js");return{diagram:t}},__vite__mapDeps([58,57,20,21,1,2,3]));return{id:Jy,diagram:e}},"loader"),o5={id:Jy,detector:s5,loader:a5},tm="railroadAbnf",n5=g(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),l5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-IIquwGZo.js");return{diagram:t}},__vite__mapDeps([59,57,20,21,1,2,3]));return{id:tm,diagram:e}},"loader"),h5={id:tm,detector:n5,loader:l5},em="railroadPeg",c5=g(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),u5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-DCHkihPF.js");return{diagram:t}},__vite__mapDeps([60,57,20,21,1,2,3]));return{id:em,diagram:e}},"loader"),d5={id:em,detector:c5,loader:u5},Tu=!1,Ha=g(()=>{Tu||(Tu=!0,Zs("error",VL,e=>e.toLowerCase().trim()==="error"),Zs("---",{db:{clear:g(()=>{},"clear")},styles:{},renderer:{draw:g(()=>{},"draw")},parser:{parse:g(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:g(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Po(JL,nF,$F),Po($v,uF,$L,FL,Vv,iL,oL,hL,kL,_L,jv,Wv,Iv,iF,Jv,WL,IL,jL,fL,pF,xF,mL,_F,IF,FF,kF,NF,GF,i5,o5,h5,d5,YF,KF,t5))},"addDiagrams"),f5=g(async()=>{I.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(br).map(async([r,{detector:i,loader:s}])=>{if(s)try{No(r)}catch{try{const{diagram:a,id:o}=await s();Zs(o,a,i)}catch(a){throw I.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete br[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){I.error(`Failed to load ${t.length} external diagrams`);for(const r of t)I.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),g5="graphics-document document";function rm(e,t){e.attr("role",g5),t!==""&&e.attr("aria-roledescription",t)}g(rm,"setA11yDiagramInfo");function im(e,t,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}g(im,"addSVGa11yTitleDescription");var xr,wn=(xr=class{constructor(t,r,i,s,a){this.type=t,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(t,r={}){var c,h;const i=Yt(),s=Bn(t,i);t=Dk(t)+` +`:""}return g(et,"dump2"),Eo.dump=et,Eo}g(ly,"requireDumper");var ku;function hy(){if(ku)return Jt;ku=1;const e=ny(),t=ly();function r(i,s){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return g(r,"renamed"),Jt.Type=se(),Jt.Schema=Al(),Jt.FAILSAFE_SCHEMA=Dl(),Jt.JSON_SCHEMA=Nl(),Jt.CORE_SCHEMA=Wl(),Jt.DEFAULT_SCHEMA=Na(),Jt.load=e.load,Jt.loadAll=e.loadAll,Jt.dump=t.dump,Jt.YAMLException=Ci(),Jt.types={binary:Yl(),float:ql(),map:Ol(),null:Pl(),pairs:Ul(),set:Gl(),timestamp:zl(),bool:Il(),int:Rl(),merge:Hl(),omap:jl(),seq:$l(),str:El()},Jt.safeLoad=r("safeLoad","load"),Jt.safeLoadAll=r("safeLoadAll","loadAll"),Jt.safeDump=r("safeDump","dump"),Jt}g(hy,"requireJsYaml");var ov=hy(),nv=ay(ov),{Type:TM,Schema:_M,FAILSAFE_SCHEMA:BM,JSON_SCHEMA:lv,CORE_SCHEMA:vM,DEFAULT_SCHEMA:LM,load:hv,loadAll:FM,dump:MM,YAMLException:AM,types:EM,safeLoad:$M,safeLoadAll:OM,safeDump:DM}=nv,cv={common:us,getConfig:Yt,insertCluster:gp,insertEdge:mp,insertEdgeLabel:xl,insertMarkers:bp,insertNode:ml,interpolateToCurve:Xn,labelHelper:mt,log:I,positionEdgeLabel:Rw},ns={},cy=g(e=>{for(const t of e)ns[t.name]=t},"registerLayoutLoaders"),uv=g(()=>{cy([{name:"dagre",loader:g(async()=>await Mt(()=>import("./dagre-GXQ25YYZ-DqSq41IB.js"),__vite__mapDeps([4,5,1,2,3])),"loader")},{name:"swimlane",loader:g(async()=>await Mt(()=>import("./swimlanes-42K2YHIH-1QzInuS-.js"),__vite__mapDeps([6,1,2,3])),"loader")},{name:"cose-bilkent",loader:g(async()=>await Mt(()=>import("./cose-bilkent-JH36ORCC-BYWhn9Rv.js"),__vite__mapDeps([7,8,2,1,3])),"loader")}])},"registerDefaultLayoutLoaders");uv();var PM=g(async(e,t)=>{if(!(e.layoutAlgorithm in ns))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const h of e.nodes){const u=h.domId||h.id;h.domId=`${e.diagramId}-${u}`}const r=ns[e.layoutAlgorithm],i=await r.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:o,gradientStart:n,gradientStop:l}=a,c=t.attr("id");if(t.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),o){const h=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",n).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return i.render(e,t,cv,{algorithm:r.algorithm})},"render"),IM=g((e="",{fallback:t="dagre"}={})=>{if(e in ns)return e;if(t in ns)return I.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Xl="comm",uy="rule",dy="decl",dv="@media",fv="@import",gv="@supports",pv="@namespace",xn="@keyframes",fy="@layer",yv="@scope",mv=Math.abs,Ki=String.fromCharCode;function gy(e){return e.trim()}function Cn(e,t,r){return e.replace(t,r)}function Ur(e,t){return e.charCodeAt(t)|0}function fi(e,t,r){return e.slice(t,r)}function Me(e){return e.length}function py(e){return e.length}function As(e,t){return t.push(e),e}var Wa=1,gi=1,yy=0,pe=0,Gt=0,bi="";function Vl(e,t,r,i,s,a,o,n){return{value:e,root:t,parent:r,type:i,props:s,children:a,line:Wa,column:gi,length:o,return:"",siblings:n}}function xv(){return Gt}function Cv(){return Gt=pe>0?Ur(bi,--pe):0,gi--,Gt===10&&(gi=1,Wa--),Gt}function Se(){return Gt=pe2||ls(Gt)>3?"":" "}function Sv(e,t){for(;--t&&Se()&&!(Gt<48||Gt>102||Gt>57&&Gt<65||Gt>70&&Gt<97););return za(e,Ys()+(t<6&&ir()==32&&Se()==32))}function bn(e){for(;Se();)switch(Gt){case e:return pe;case 34:case 39:e!==34&&e!==39&&bn(Gt);break;case 40:e===41&&bn(e);break;case 92:Se();break}return pe}function Tv(e,t){for(;Se()&&e+Gt!==57;)if(e+Gt===84&&ir()===47)break;return"/*"+za(t,pe-1)+"*"+Ki(e===47?e:Se())}function _v(e){for(;!ls(ir());)Se();return za(e,pe)}function Bv(e){return kv(js("",null,null,null,[""],e=bv(e),0,[0],e))}function js(e,t,r,i,s,a,o,n,l){for(var c=0,h=0,u=o,d=0,f=0,y=0,m=1,C=1,x=1,k=0,w=0,T="",_=s,v=a,F=i,L=T;C;)switch(y=w,w=Se()){case 40:y!=108&&Ur(L,u-1)==58?(k++,L+="("):L+=$o(w);break;case 41:k--,L+=")";break;case 34:case 39:case 91:L+=$o(w);break;case 9:case 10:case 13:case 32:if(k>0){L+=Ki(w);break}L+=wv(y);break;case 92:L+=Sv(Ys()-1,7);continue;case 47:switch(ir()){case 42:case 47:As(vv(Tv(Se(),Ys()),t,r,l),l),(ls(y||1)==5||ls(ir()||1)==5)&&Me(L)&&fi(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*m:n[c++]=Me(L)*x;case 125*m:case 59:case 0:if(k>0&&w){L+=Ki(w);break}switch(w){case 0:case 125:C=0;case 59+h:x==-1&&(L=Cn(L,/\f/g,"")),f>0&&(Me(L)-u||m===0)&&As(f>32?Su(L+";",i,r,u-1,l):Su(Cn(L," ","")+";",i,r,u-2,l),l);break;case 59:L+=";";default:if(As(F=wu(L,t,r,c,h,s,n,T,_=[],v=[],u,a),a),w===123)if(h===0)js(L,t,F,F,_,a,u,n,v);else{switch(d){case 99:if(Ur(L,3)===110)break;case 108:if(Ur(L,2)===97)break;default:h=0;case 100:case 109:case 115:}h?js(e,F,F,i&&As(wu(e,F,F,0,0,s,n,T,s,_=[],u,v),v),s,v,u,n,i?_:v):js(L,F,F,F,[""],v,0,n,v)}}c=h=f=0,m=x=1,T=L="",u=o;break;case 58:u=1+Me(L),f=y;default:if(m<1){if(w==123)--m;else if(w==125&&m++==0&&Cv()==125)continue}switch(L+=Ki(w),w*m){case 38:x=h>0?1:(L+="\f",-1);break;case 44:if(k>0)break;n[c++]=(Me(L)-1)*x,x=1;break;case 64:ir()===45&&(L+=$o(Se())),d=ir(),h=u=Me(T=L+=_v(Ys())),w++;break;case 45:y===45&&Me(L)==2&&(m=0)}}return a}function wu(e,t,r,i,s,a,o,n,l,c,h,u){for(var d=s-1,f=s===0?a:[""],y=py(f),m=0,C=0,x=0;m0?f[k]+" "+w:Cn(w,/&\f/g,f[k])))&&(l[x++]=T);return Vl(e,t,r,s===0?uy:n,l,c,h,u)}function vv(e,t,r,i){return Vl(e,t,r,Xl,Ki(xv()),fi(e,2,-2),0,i)}function Su(e,t,r,i,s){return Vl(e,t,r,dy,fi(e,0,i),fi(e,i+1,-1),i,s)}function kn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Av=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-DdetwEv8.js");return{diagram:t}},__vite__mapDeps([9,10,1,2,3]));return{id:my,diagram:e}},"loader"),Ev={id:my,detector:Mv,loader:Av},$v=Ev,xy="flowchart",Ov=g((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),Dv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-Bfis7KwQ.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:xy,diagram:e}},"loader"),Pv={id:xy,detector:Ov,loader:Dv},Iv=Pv,Cy="flowchart-v2",Rv=g((e,t)=>{var r,i,s;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((s=t==null?void 0:t.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),qv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-Bfis7KwQ.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Cy,diagram:e}},"loader"),Nv={id:Cy,detector:Rv,loader:qv},Wv=Nv,by="swimlane",zv=g(e=>/^\s*swimlane-beta\b/.test(e),"detector"),Hv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-CLgWPzHj.js");return{diagram:t}},__vite__mapDeps([16,11,12,13,14,10,1,2,3,15]));return{id:by,diagram:e}},"loader"),Yv={id:by,detector:zv,loader:Hv},jv=Yv,ky="er",Uv=g(e=>/^\s*erDiagram/.test(e),"detector"),Gv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-DV4h776D.js");return{diagram:t}},__vite__mapDeps([17,13,14,15,1,2,3]));return{id:ky,diagram:e}},"loader"),Xv={id:ky,detector:Uv,loader:Gv},Vv=Xv,wy="gitGraph",Zv=g(e=>/^\s*gitGraph/.test(e),"detector"),Kv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-BkBjc4gg.js");return{diagram:t}},__vite__mapDeps([18,19,20,21,1,2,3]));return{id:wy,diagram:e}},"loader"),Qv={id:wy,detector:Zv,loader:Kv},Jv=Qv,Sy="gantt",tL=g(e=>/^\s*gantt/.test(e),"detector"),eL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-BU9eWm2s.js");return{diagram:t}},__vite__mapDeps([22,2,23,24,25,1,3]));return{id:Sy,diagram:e}},"loader"),rL={id:Sy,detector:tL,loader:eL},iL=rL,Ty="info",sL=g(e=>/^\s*info/.test(e),"detector"),aL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-D1rVSJoO.js");return{diagram:t}},__vite__mapDeps([26,21,1,2,3]));return{id:Ty,diagram:e}},"loader"),oL={id:Ty,detector:sL,loader:aL},_y="pie",nL=g(e=>/^\s*pie/.test(e),"detector"),lL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-DYkXhOYb.js");return{diagram:t}},__vite__mapDeps([27,20,21,1,2,3,28,29,24]));return{id:_y,diagram:e}},"loader"),hL={id:_y,detector:nL,loader:lL},By="quadrantChart",cL=g(e=>/^\s*quadrantChart/.test(e),"detector"),uL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-DHRSmvLk.js");return{diagram:t}},__vite__mapDeps([30,23,24,25,1,2,3]));return{id:By,diagram:e}},"loader"),dL={id:By,detector:cL,loader:uL},fL=dL,vy="xychart",gL=g(e=>/^\s*xychart(-beta)?/.test(e),"detector"),pL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-DF_x_q58.js");return{diagram:t}},__vite__mapDeps([31,24,29,23,25,1,2,3]));return{id:vy,diagram:e}},"loader"),yL={id:vy,detector:gL,loader:pL},mL=yL,Ly="requirement",xL=g(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),CL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-DEA-5bvx.js");return{diagram:t}},__vite__mapDeps([32,13,14,1,2,3]));return{id:Ly,diagram:e}},"loader"),bL={id:Ly,detector:xL,loader:CL},kL=bL,Fy="sequence",wL=g(e=>/^\s*sequenceDiagram/.test(e),"detector"),SL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js");return{diagram:t}},__vite__mapDeps([33,19,10,1,2,3]));return{id:Fy,diagram:e}},"loader"),TL={id:Fy,detector:wL,loader:SL},_L=TL,My="class",BL=g((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),vL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-D0wKCQxK.js");return{diagram:t}},__vite__mapDeps([34,35,12,13,14,10,1,2,3]));return{id:My,diagram:e}},"loader"),LL={id:My,detector:BL,loader:vL},FL=LL,Ay="classDiagram",ML=g((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),AL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-D0wKCQxK.js");return{diagram:t}},__vite__mapDeps([36,35,12,13,14,10,1,2,3]));return{id:Ay,diagram:e}},"loader"),EL={id:Ay,detector:ML,loader:AL},$L=EL,Ey="state",OL=g((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),DL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-sy7Rfo0f.js");return{diagram:t}},__vite__mapDeps([37,38,13,14,10,1,2,3,5]));return{id:Ey,diagram:e}},"loader"),PL={id:Ey,detector:OL,loader:DL},IL=PL,$y="stateDiagram",RL=g((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),qL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-BRTKjL6-.js");return{diagram:t}},__vite__mapDeps([39,38,13,14,10,1,2,3]));return{id:$y,diagram:e}},"loader"),NL={id:$y,detector:RL,loader:qL},WL=NL,Oy="journey",zL=g(e=>/^\s*journey/.test(e),"detector"),HL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-CkgASPQL.js");return{diagram:t}},__vite__mapDeps([40,12,10,28,1,2,3]));return{id:Oy,diagram:e}},"loader"),YL={id:Oy,detector:zL,loader:HL},jL=YL,UL=g((e,t,r)=>{I.debug(`rendering svg for syntax error +`);const i=f1(t),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Uu(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Dy={draw:UL},GL=Dy,XL={db:{},renderer:Dy,parser:{parse:g(()=>{},"parse")}},VL=XL,Py="flowchart-elk",ZL=g((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),KL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-Bfis7KwQ.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Py,diagram:e}},"loader"),QL={id:Py,detector:ZL,loader:KL},JL=QL,Iy="timeline",tF=g(e=>/^\s*timeline/.test(e),"detector"),eF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-Ck5GR00U.js");return{diagram:t}},__vite__mapDeps([41,28,1,2,3]));return{id:Iy,diagram:e}},"loader"),rF={id:Iy,detector:tF,loader:eF},iF=rF,Ry="mindmap",sF=g(e=>/^\s*mindmap/.test(e),"detector"),aF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-CnwxkU_o.js");return{diagram:t}},__vite__mapDeps([42,13,14,1,2,3]));return{id:Ry,diagram:e}},"loader"),oF={id:Ry,detector:sF,loader:aF},nF=oF,qy="kanban",lF=g(e=>/^\s*kanban/.test(e),"detector"),hF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-C_T9GYcq.js");return{diagram:t}},__vite__mapDeps([43,12,1,2,3]));return{id:qy,diagram:e}},"loader"),cF={id:qy,detector:lF,loader:hF},uF=cF,Ny="sankey",dF=g(e=>/^\s*sankey(-beta)?/.test(e),"detector"),fF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js");return{diagram:t}},__vite__mapDeps([44,29,24,1,2,3]));return{id:Ny,diagram:e}},"loader"),gF={id:Ny,detector:dF,loader:fF},pF=gF,Wy="packet",yF=g(e=>/^\s*packet(-beta)?/.test(e),"detector"),mF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-C7wRZKVi.js");return{diagram:t}},__vite__mapDeps([45,20,21,1,2,3]));return{id:Wy,diagram:e}},"loader"),xF={id:Wy,detector:yF,loader:mF},zy="radar",CF=g(e=>/^\s*radar-beta/.test(e),"detector"),bF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-CsDpBRwj.js");return{diagram:t}},__vite__mapDeps([46,20,21,1,2,3]));return{id:zy,diagram:e}},"loader"),kF={id:zy,detector:CF,loader:bF},Hy="block",wF=g(e=>/^\s*block(-beta)?/.test(e),"detector"),SF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-JIRyk-UT.js");return{diagram:t}},__vite__mapDeps([47,12,15,1,2,3]));return{id:Hy,diagram:e}},"loader"),TF={id:Hy,detector:wF,loader:SF},_F=TF,Yy="treeView",BF=g(e=>/^\s*treeView-beta/.test(e),"detector"),vF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-Bhn2u9og.js");return{diagram:t}},__vite__mapDeps([48,19,20,21,1,2,3]));return{id:Yy,diagram:e}},"loader"),LF={id:Yy,detector:BF,loader:vF},FF=LF,jy="architecture",MF=g(e=>/^\s*architecture/.test(e),"detector"),AF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-BMtIY0MM.js");return{diagram:t}},__vite__mapDeps([49,20,21,1,2,3,8]));return{id:jy,diagram:e}},"loader"),EF={id:jy,detector:MF,loader:AF},$F=EF,Uy="eventmodeling",OF=g(e=>/^\s*eventmodeling/.test(e),"detector"),DF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-BPFQwR9c.js");return{diagram:t}},__vite__mapDeps([50,20,21,1,2,3]));return{id:Uy,diagram:e}},"loader"),PF={id:Uy,detector:OF,loader:DF},IF=PF,Gy="ishikawa",RF=g(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),qF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-B42RhGud.js");return{diagram:t}},__vite__mapDeps([51,1,2,3]));return{id:Gy,diagram:e}},"loader"),NF={id:Gy,detector:RF,loader:qF},Xy="venn",WF=g(e=>/^\s*venn-beta/.test(e),"detector"),zF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-kVi8iDPL.js");return{diagram:t}},__vite__mapDeps([52,1,2,3]));return{id:Xy,diagram:e}},"loader"),HF={id:Xy,detector:WF,loader:zF},YF=HF,Vy="treemap",jF=g(e=>/^\s*treemap/.test(e),"detector"),UF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-DYKyI2lv.js");return{diagram:t}},__vite__mapDeps([53,20,14,21,1,2,3,25,29,24]));return{id:Vy,diagram:e}},"loader"),GF={id:Vy,detector:jF,loader:UF},Zy="wardley",XF=g(e=>/^\s*wardley-beta/i.test(e),"detector"),VF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-xeAzTPpE.js");return{diagram:t}},__vite__mapDeps([54,20,21,1,2,3]));return{id:Zy,diagram:e}},"loader"),ZF={id:Zy,detector:XF,loader:VF},KF=ZF,Ky="cynefin",QF=g(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),JF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-T6cXmRvG.js");return{diagram:t}},__vite__mapDeps([55,20,21,1,2,3]));return{id:Ky,diagram:e}},"loader"),t5={id:Ky,detector:QF,loader:JF},Qy="railroad",e5=g(e=>/^\s*railroad-beta/i.test(e),"detector"),r5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-ByMdCyuE.js");return{diagram:t}},__vite__mapDeps([56,57,20,21,1,2,3]));return{id:Qy,diagram:e}},"loader"),i5={id:Qy,detector:e5,loader:r5},Jy="railroadEbnf",s5=g(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),a5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-CsupTakH.js");return{diagram:t}},__vite__mapDeps([58,57,20,21,1,2,3]));return{id:Jy,diagram:e}},"loader"),o5={id:Jy,detector:s5,loader:a5},tm="railroadAbnf",n5=g(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),l5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-Bfs8g8Bc.js");return{diagram:t}},__vite__mapDeps([59,57,20,21,1,2,3]));return{id:tm,diagram:e}},"loader"),h5={id:tm,detector:n5,loader:l5},em="railroadPeg",c5=g(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),u5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-C77gkBP1.js");return{diagram:t}},__vite__mapDeps([60,57,20,21,1,2,3]));return{id:em,diagram:e}},"loader"),d5={id:em,detector:c5,loader:u5},Tu=!1,Ha=g(()=>{Tu||(Tu=!0,Zs("error",VL,e=>e.toLowerCase().trim()==="error"),Zs("---",{db:{clear:g(()=>{},"clear")},styles:{},renderer:{draw:g(()=>{},"draw")},parser:{parse:g(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:g(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Po(JL,nF,$F),Po($v,uF,$L,FL,Vv,iL,oL,hL,kL,_L,jv,Wv,Iv,iF,Jv,WL,IL,jL,fL,pF,xF,mL,_F,IF,FF,kF,NF,GF,i5,o5,h5,d5,YF,KF,t5))},"addDiagrams"),f5=g(async()=>{I.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(br).map(async([r,{detector:i,loader:s}])=>{if(s)try{No(r)}catch{try{const{diagram:a,id:o}=await s();Zs(o,a,i)}catch(a){throw I.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete br[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){I.error(`Failed to load ${t.length} external diagrams`);for(const r of t)I.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),g5="graphics-document document";function rm(e,t){e.attr("role",g5),t!==""&&e.attr("aria-roledescription",t)}g(rm,"setA11yDiagramInfo");function im(e,t,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}g(im,"addSVGa11yTitleDescription");var xr,wn=(xr=class{constructor(t,r,i,s,a){this.type=t,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(t,r={}){var c,h;const i=Yt(),s=Bn(t,i);t=Dk(t)+` `;try{No(s)}catch{const u=n0(s);if(!u)throw new Nu(`Diagram ${s} not found.`);const{id:d,diagram:f}=await u();Zs(d,f)}const{db:a,parser:o,renderer:n,init:l}=No(s);return o.parser&&(o.parser.yy=a),(c=a.clear)==null||c.call(a),l==null||l(i),r.title&&((h=a.setDiagramTitle)==null||h.call(a,r.title)),await o.parse(t),new xr(s,t,a,o,n)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},g(xr,"Diagram"),xr),_u=[],p5=g(()=>{_u.forEach(e=>{e()}),_u=[]},"attachFunctions"),y5=g(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function sm(e){const t=e.match(qu);if(!t)return{text:e,metadata:{}};const r=t[1],i=r?t[2].split(` `).map(o=>o.startsWith(r)?o.slice(r.length):o).join(` `):t[2];let s=hv(i,{schema:lv})??{};s=typeof s=="object"&&!Array.isArray(s)?s:{};const a={};return s.displayMode&&(a.displayMode=s.displayMode.toString()),s.title&&(a.title=s.title.toString()),s.config&&(a.config=s.config),{text:e.slice(t[0].length),metadata:a}}g(sm,"extractFrontMatter");var m5=g(e=>e.replace(/\r\n?/g,` diff --git a/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-Doia6bAL.js b/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js similarity index 99% rename from amplifier_web/static/assets/mindmap-definition-YA3MSWOX-Doia6bAL.js rename to amplifier_web/static/assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js index e6bb42a8d..a2f49d367 100644 --- a/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-Doia6bAL.js +++ b/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js @@ -1,4 +1,4 @@ -import{g as oe}from"./chunk-XXDRQBXY-BvgnYF8f.js";import{s as ce}from"./chunk-POPQ4Y6H-fljvmLmW.js";import{_ as h,l as R,u as le,v as he,y as de,B as W,c as U,i as H,b3 as ge,U as ue,V as pe,W as fe}from"./mermaid.core-CDlaSEyP.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function me(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}const ye=new Uint8Array(16);function Ee(){return crypto.getRandomValues(ye)}function _e(t,e,o){return crypto.randomUUID?crypto.randomUUID():be(t)}function be(t,e,o){var n;t=t||{};const l=t.random??((n=t.rng)==null?void 0:n.call(t))??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,me(l)}var K=(function(){var t=h(function(O,s,i,a){for(i=i||{},a=O.length;a--;i[O[a]]=s);return i},"o"),e=[1,4],o=[1,13],l=[1,12],n=[1,15],d=[1,16],p=[1,20],y=[1,19],E=[6,7,8],k=[1,26],L=[1,24],D=[1,25],b=[6,7,11],$=[1,6,13,15,16,19,22],f=[1,33],B=[1,34],P=[1,6,7,11,13,15,16,19,22],z={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,i,a,c,u,r,M){var g=r.length-1;switch(u){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[g].id),c.addNode(r[g-1].length,r[g].id,r[g].descr,r[g].type);break;case 16:c.getLogger().trace("Icon: ",r[g]),c.decorateNode({icon:r[g]});break;case 17:case 21:c.decorateNode({class:r[g]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[g].id),c.addNode(0,r[g].id,r[g].descr,r[g].type);break;case 20:c.decorateNode({icon:r[g]});break;case 25:c.getLogger().trace("node found ..",r[g-2]),this.$={id:r[g-1],descr:r[g-1],type:c.getType(r[g-2],r[g])};break;case 26:this.$={id:r[g],descr:r[g],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[g-3]),this.$={id:r[g-3],descr:r[g-1],type:c.getType(r[g-2],r[g])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:o,7:[1,10],9:9,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:o,9:22,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:k,7:L,10:23,11:D},t(b,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:y}),t(b,[2,18]),t(b,[2,19]),t(b,[2,20]),t(b,[2,21]),t(b,[2,23]),t(b,[2,24]),t(b,[2,26],{19:[1,30]}),{20:[1,31]},{6:k,7:L,10:32,11:D},{1:[2,7],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t($,[2,14],{7:f,11:B}),t(P,[2,8]),t(P,[2,9]),t(P,[2,10]),t(b,[2,15]),t(b,[2,16]),t(b,[2,17]),{20:[1,35]},{21:[1,36]},t($,[2,13],{7:f,11:B}),t(P,[2,11]),t(P,[2,12]),{21:[1,37]},t(b,[2,25]),t(b,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,i){if(i.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=i,a}},"parseError"),parse:h(function(s){var i=this,a=[0],c=[],u=[null],r=[],M=this.table,g="",F=0,Q=0,ie=2,Z=1,se=r.slice.call(arguments,1),m=Object.create(this.lexer),C={yy:{}};for(var X in this.yy)Object.prototype.hasOwnProperty.call(this.yy,X)&&(C.yy[X]=this.yy[X]);m.setInput(s,C.yy),C.yy.lexer=m,C.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Y=m.yylloc;r.push(Y);var re=m.options&&m.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ae(x){a.length=a.length-2*x,u.length=u.length-x,r.length=r.length-x}h(ae,"popStack");function ee(){var x;return x=c.pop()||m.lex()||Z,typeof x!="number"&&(x instanceof Array&&(c=x,x=c.pop()),x=i.symbols_[x]||x),x}h(ee,"lex");for(var S,I,N,q,w={},G,v,te,j;;){if(I=a[a.length-1],this.defaultActions[I]?N=this.defaultActions[I]:((S===null||typeof S>"u")&&(S=ee()),N=M[I]&&M[I][S]),typeof N>"u"||!N.length||!N[0]){var J="";j=[];for(G in M[I])this.terminals_[G]&&G>ie&&j.push("'"+this.terminals_[G]+"'");m.showPosition?J="Parse error on line "+(F+1)+`: +import{g as oe}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as ce}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as h,l as R,u as le,v as he,y as de,B as W,c as U,i as H,b3 as ge,U as ue,V as pe,W as fe}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function me(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}const ye=new Uint8Array(16);function Ee(){return crypto.getRandomValues(ye)}function _e(t,e,o){return crypto.randomUUID?crypto.randomUUID():be(t)}function be(t,e,o){var n;t=t||{};const l=t.random??((n=t.rng)==null?void 0:n.call(t))??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,me(l)}var K=(function(){var t=h(function(O,s,i,a){for(i=i||{},a=O.length;a--;i[O[a]]=s);return i},"o"),e=[1,4],o=[1,13],l=[1,12],n=[1,15],d=[1,16],p=[1,20],y=[1,19],E=[6,7,8],k=[1,26],L=[1,24],D=[1,25],b=[6,7,11],$=[1,6,13,15,16,19,22],f=[1,33],B=[1,34],P=[1,6,7,11,13,15,16,19,22],z={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,i,a,c,u,r,M){var g=r.length-1;switch(u){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[g].id),c.addNode(r[g-1].length,r[g].id,r[g].descr,r[g].type);break;case 16:c.getLogger().trace("Icon: ",r[g]),c.decorateNode({icon:r[g]});break;case 17:case 21:c.decorateNode({class:r[g]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[g].id),c.addNode(0,r[g].id,r[g].descr,r[g].type);break;case 20:c.decorateNode({icon:r[g]});break;case 25:c.getLogger().trace("node found ..",r[g-2]),this.$={id:r[g-1],descr:r[g-1],type:c.getType(r[g-2],r[g])};break;case 26:this.$={id:r[g],descr:r[g],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[g-3]),this.$={id:r[g-3],descr:r[g-1],type:c.getType(r[g-2],r[g])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:o,7:[1,10],9:9,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:o,9:22,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:k,7:L,10:23,11:D},t(b,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:y}),t(b,[2,18]),t(b,[2,19]),t(b,[2,20]),t(b,[2,21]),t(b,[2,23]),t(b,[2,24]),t(b,[2,26],{19:[1,30]}),{20:[1,31]},{6:k,7:L,10:32,11:D},{1:[2,7],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t($,[2,14],{7:f,11:B}),t(P,[2,8]),t(P,[2,9]),t(P,[2,10]),t(b,[2,15]),t(b,[2,16]),t(b,[2,17]),{20:[1,35]},{21:[1,36]},t($,[2,13],{7:f,11:B}),t(P,[2,11]),t(P,[2,12]),{21:[1,37]},t(b,[2,25]),t(b,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,i){if(i.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=i,a}},"parseError"),parse:h(function(s){var i=this,a=[0],c=[],u=[null],r=[],M=this.table,g="",F=0,Q=0,ie=2,Z=1,se=r.slice.call(arguments,1),m=Object.create(this.lexer),C={yy:{}};for(var X in this.yy)Object.prototype.hasOwnProperty.call(this.yy,X)&&(C.yy[X]=this.yy[X]);m.setInput(s,C.yy),C.yy.lexer=m,C.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Y=m.yylloc;r.push(Y);var re=m.options&&m.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ae(x){a.length=a.length-2*x,u.length=u.length-x,r.length=r.length-x}h(ae,"popStack");function ee(){var x;return x=c.pop()||m.lex()||Z,typeof x!="number"&&(x instanceof Array&&(c=x,x=c.pop()),x=i.symbols_[x]||x),x}h(ee,"lex");for(var S,I,N,q,w={},G,v,te,j;;){if(I=a[a.length-1],this.defaultActions[I]?N=this.defaultActions[I]:((S===null||typeof S>"u")&&(S=ee()),N=M[I]&&M[I][S]),typeof N>"u"||!N.length||!N[0]){var J="";j=[];for(G in M[I])this.terminals_[G]&&G>ie&&j.push("'"+this.terminals_[G]+"'");m.showPosition?J="Parse error on line "+(F+1)+`: `+m.showPosition()+` Expecting `+j.join(", ")+", got '"+(this.terminals_[S]||S)+"'":J="Parse error on line "+(F+1)+": Unexpected "+(S==Z?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(J,{text:m.match,token:this.terminals_[S]||S,line:m.yylineno,loc:Y,expected:j})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+S);switch(N[0]){case 1:a.push(S),u.push(m.yytext),r.push(m.yylloc),a.push(N[1]),S=null,Q=m.yyleng,g=m.yytext,F=m.yylineno,Y=m.yylloc;break;case 2:if(v=this.productions_[N[1]][1],w.$=u[u.length-v],w._$={first_line:r[r.length-(v||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(v||1)].first_column,last_column:r[r.length-1].last_column},re&&(w._$.range=[r[r.length-(v||1)].range[0],r[r.length-1].range[1]]),q=this.performAction.apply(w,[g,Q,F,C.yy,N[1],u,r].concat(se)),typeof q<"u")return q;v&&(a=a.slice(0,-1*v*2),u=u.slice(0,-1*v),r=r.slice(0,-1*v)),a.push(this.productions_[N[1]][0]),u.push(w.$),r.push(w._$),te=M[a[a.length-2]][a[a.length-1]],a.push(te);break;case 3:return!0}}return!0},"parse")},ne=(function(){var O={EOF:1,parseError:h(function(i,a){if(this.yy.parser)this.yy.parser.parseError(i,a);else throw new Error(i)},"parseError"),setInput:h(function(s,i){return this.yy=i||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var i=s.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:h(function(s){var i=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===c.length?this.yylloc.first_column:0)+c[c.length-a.length].length-a[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:h(function(s){this.unput(this.match.slice(s))},"less"),pastInput:h(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/pegDiagram-XKGWAZYB-DCHkihPF.js b/amplifier_web/static/assets/pegDiagram-XKGWAZYB-C77gkBP1.js similarity index 87% rename from amplifier_web/static/assets/pegDiagram-XKGWAZYB-DCHkihPF.js rename to amplifier_web/static/assets/pegDiagram-XKGWAZYB-C77gkBP1.js index 1de294eed..3323d78ed 100644 --- a/amplifier_web/static/assets/pegDiagram-XKGWAZYB-DCHkihPF.js +++ b/amplifier_web/static/assets/pegDiagram-XKGWAZYB-C77gkBP1.js @@ -1 +1 @@ -import{g as l,r as m,d as a}from"./chunk-SVP7TREG-BBG-Pp77.js";import{p}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{_ as t,l as o}from"./mermaid.core-CDlaSEyP.js";import{M as u,d as c}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; +import{g as l,r as m,d as a}from"./chunk-SVP7TREG-DegBQCYH.js";import{p}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as t,l as o}from"./mermaid.core-BQ5lTCZr.js";import{M as u,d as c}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; diff --git a/amplifier_web/static/assets/pieDiagram-E7YTZNPT-nq59ZEFW.js b/amplifier_web/static/assets/pieDiagram-E7YTZNPT-DYkXhOYb.js similarity index 94% rename from amplifier_web/static/assets/pieDiagram-E7YTZNPT-nq59ZEFW.js rename to amplifier_web/static/assets/pieDiagram-E7YTZNPT-DYkXhOYb.js index 619578188..a6c01251a 100644 --- a/amplifier_web/static/assets/pieDiagram-E7YTZNPT-nq59ZEFW.js +++ b/amplifier_web/static/assets/pieDiagram-E7YTZNPT-DYkXhOYb.js @@ -1,4 +1,4 @@ -import{p as rt}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{a3 as T,a6 as B,b2 as nt,g as it,s as ot,a as st,b as lt,o as ct,n as ut,_ as d,l as G,c as gt,A as dt,D as pt,L as ht,d as ft,p as mt,B as vt}from"./mermaid.core-CDlaSEyP.js";import{p as xt}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import{d as J}from"./arc-DXFEdbiI.js";import{o as St}from"./ordinal-Cboi1Yqb.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function yt(t,n){return nt?1:n>=t?0:NaN}function wt(t){return t}function At(){var t=wt,n=yt,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=nt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,R=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=R*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:R};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var Ct=vt.pie,I={sections:new Map,showData:!1},F=I.sections,V=I.showData,$t=structuredClone(Ct),Dt=d(()=>structuredClone($t),"getConfig"),Tt=d(()=>{F=new Map,V=I.showData,mt()},"clear"),bt=d(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);F.has(t)||(F.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),kt=d(()=>F,"getSections"),zt=d(t=>{V=t},"setShowData"),Et=d(()=>V,"getShowData"),K={getConfig:Dt,clear:Tt,setDiagramTitle:ut,getDiagramTitle:ct,setAccTitle:lt,getAccTitle:st,setAccDescription:ot,getAccDescription:it,addSection:bt,getSections:kt,setShowData:zt,getShowData:Et},Mt=d((t,n)=>{rt(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Lt={parse:d(async t=>{const n=await xt("pie",t);G.debug(n),Mt(n,K)},"parse")},Rt=d(t=>` +import{p as rt}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{a3 as T,a6 as B,b2 as nt,g as it,s as ot,a as st,b as lt,o as ct,n as ut,_ as d,l as G,c as gt,A as dt,D as pt,L as ht,d as ft,p as mt,B as vt}from"./mermaid.core-BQ5lTCZr.js";import{p as xt}from"./cynefin-OW5HDTMX-C5aohCXI.js";import{d as J}from"./arc-CxD3pp7w.js";import{o as St}from"./ordinal-Cboi1Yqb.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function yt(t,n){return nt?1:n>=t?0:NaN}function wt(t){return t}function At(){var t=wt,n=yt,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=nt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,R=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=R*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:R};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var Ct=vt.pie,I={sections:new Map,showData:!1},F=I.sections,V=I.showData,$t=structuredClone(Ct),Dt=d(()=>structuredClone($t),"getConfig"),Tt=d(()=>{F=new Map,V=I.showData,mt()},"clear"),bt=d(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);F.has(t)||(F.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),kt=d(()=>F,"getSections"),zt=d(t=>{V=t},"setShowData"),Et=d(()=>V,"getShowData"),K={getConfig:Dt,clear:Tt,setDiagramTitle:ut,getDiagramTitle:ct,setAccTitle:lt,getAccTitle:st,setAccDescription:ot,getAccDescription:it,addSection:bt,getSections:kt,setShowData:zt,getShowData:Et},Mt=d((t,n)=>{rt(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Lt={parse:d(async t=>{const n=await xt("pie",t);G.debug(n),Mt(n,K)},"parse")},Rt=d(t=>` .pieCircle{ stroke: ${t.pieStrokeColor}; stroke-width : ${t.pieStrokeWidth}; diff --git a/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-CApaH6GE.js b/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js similarity index 99% rename from amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-CApaH6GE.js rename to amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js index 385523a34..7cefed7e9 100644 --- a/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-CApaH6GE.js +++ b/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js @@ -1,4 +1,4 @@ -import{s as Ae,g as ke,o as ae,n as Fe,a as Pe,b as ve,_ as o,c as wt,l as At,j as zt,d as Ce,p as Le,B as z,i as Ee,E as De}from"./mermaid.core-CDlaSEyP.js";import{l as ie}from"./linear-DE4AveAz.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Vt=(function(){var t=o(function(j,r,l,g){for(l=l||{},g=j.length;g--;l[j[g]]=r);return l},"o"),n=[1,3],u=[1,4],c=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],S=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],d=[1,37],T=[1,36],m=[1,38],q=[1,35],b=[1,43],x=[1,41],_=[1,45],Y=[1,14],G=[1,23],yt=[1,18],Tt=[1,19],dt=[1,20],Ft=[1,21],ut=[1,22],xt=[1,24],ft=[1,25],gt=[1,26],i=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Ht=[1,71],Xt=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],J=[1,91],$=[1,92],tt=[1,93],et=[1,100],it=[1,94],at=[1,97],nt=[1,95],st=[1,96],rt=[1,98],ot=[1,99],Pt=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],vt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,g,f,A,e,pt){var s=e.length-1;switch(A){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],f.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),f.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),f.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),f.setAccDescription(this.$);break;case 46:f.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:f.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:f.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:f.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:f.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:f.setXAxisLeftText(e[s-2]),f.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟶ ",f.setXAxisLeftText(e[s-1]);break;case 53:f.setXAxisLeftText(e[s]);break;case 54:f.setYAxisBottomText(e[s-2]),f.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟶ ",f.setYAxisBottomText(e[s-1]);break;case 56:f.setYAxisBottomText(e[s]);break;case 57:f.setQuadrant1Text(e[s]);break;case 58:f.setQuadrant2Text(e[s]);break;case 59:f.setQuadrant3Text(e[s]);break;case 60:f.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:u,55:c,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:u,55:c,56:h,57:p},{18:n,26:9,27:2,28:u,55:c,56:h,57:p},t(y,[2,33],{29:10}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:c,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{46:[1,102]},t(a,[2,29],{10:Pt}),t(Zt,[2,27],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:Pt}),t(a,[2,48],{22:89,16:90,23:105,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:106},t(N,[2,26]),t(a,[2,50],{10:Pt}),t(Zt,[2,28],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=l,g}},"parseError"),parse:o(function(r){var l=this,g=[0],f=[],A=[null],e=[],pt=this.table,s="",qt=0,Jt=0,qe=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),K={yy:{}};for(var Ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ct)&&(K.yy[Ct]=this.yy[Ct]);D.setInput(r,K.yy),K.yy.lexer=D,K.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Lt=D.yylloc;e.push(Lt);var Se=D.options&&D.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){g.length=g.length-2*R,A.length=A.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=f.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(f=R,R=f.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,Z,W,Et,lt={},bt,M,ee,St;;){if(Z=g[g.length-1],this.defaultActions[Z]?W=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=te()),W=pt[Z]&&pt[Z][B]),typeof W>"u"||!W.length||!W[0]){var Dt="";St=[];for(bt in pt[Z])this.terminals_[bt]&&bt>qe&&St.push("'"+this.terminals_[bt]+"'");D.showPosition?Dt="Parse error on line "+(qt+1)+`: +import{s as Ae,g as ke,o as ae,n as Fe,a as Pe,b as ve,_ as o,c as wt,l as At,j as zt,d as Ce,p as Le,B as z,i as Ee,E as De}from"./mermaid.core-BQ5lTCZr.js";import{l as ie}from"./linear-BcEdwvr4.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Vt=(function(){var t=o(function(j,r,l,g){for(l=l||{},g=j.length;g--;l[j[g]]=r);return l},"o"),n=[1,3],u=[1,4],c=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],S=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],d=[1,37],T=[1,36],m=[1,38],q=[1,35],b=[1,43],x=[1,41],_=[1,45],Y=[1,14],G=[1,23],yt=[1,18],Tt=[1,19],dt=[1,20],Ft=[1,21],ut=[1,22],xt=[1,24],ft=[1,25],gt=[1,26],i=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Ht=[1,71],Xt=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],J=[1,91],$=[1,92],tt=[1,93],et=[1,100],it=[1,94],at=[1,97],nt=[1,95],st=[1,96],rt=[1,98],ot=[1,99],Pt=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],vt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,g,f,A,e,pt){var s=e.length-1;switch(A){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],f.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),f.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),f.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),f.setAccDescription(this.$);break;case 46:f.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:f.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:f.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:f.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:f.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:f.setXAxisLeftText(e[s-2]),f.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟶ ",f.setXAxisLeftText(e[s-1]);break;case 53:f.setXAxisLeftText(e[s]);break;case 54:f.setYAxisBottomText(e[s-2]),f.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟶ ",f.setYAxisBottomText(e[s-1]);break;case 56:f.setYAxisBottomText(e[s]);break;case 57:f.setQuadrant1Text(e[s]);break;case 58:f.setQuadrant2Text(e[s]);break;case 59:f.setQuadrant3Text(e[s]);break;case 60:f.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:u,55:c,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:u,55:c,56:h,57:p},{18:n,26:9,27:2,28:u,55:c,56:h,57:p},t(y,[2,33],{29:10}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:c,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{46:[1,102]},t(a,[2,29],{10:Pt}),t(Zt,[2,27],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:Pt}),t(a,[2,48],{22:89,16:90,23:105,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:106},t(N,[2,26]),t(a,[2,50],{10:Pt}),t(Zt,[2,28],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=l,g}},"parseError"),parse:o(function(r){var l=this,g=[0],f=[],A=[null],e=[],pt=this.table,s="",qt=0,Jt=0,qe=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),K={yy:{}};for(var Ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ct)&&(K.yy[Ct]=this.yy[Ct]);D.setInput(r,K.yy),K.yy.lexer=D,K.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Lt=D.yylloc;e.push(Lt);var Se=D.options&&D.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){g.length=g.length-2*R,A.length=A.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=f.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(f=R,R=f.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,Z,W,Et,lt={},bt,M,ee,St;;){if(Z=g[g.length-1],this.defaultActions[Z]?W=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=te()),W=pt[Z]&&pt[Z][B]),typeof W>"u"||!W.length||!W[0]){var Dt="";St=[];for(bt in pt[Z])this.terminals_[bt]&&bt>qe&&St.push("'"+this.terminals_[bt]+"'");D.showPosition?Dt="Parse error on line "+(qt+1)+`: `+D.showPosition()+` Expecting `+St.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Dt="Parse error on line "+(qt+1)+": Unexpected "+(B==$t?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Dt,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:Lt,expected:St})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Z+", token: "+B);switch(W[0]){case 1:g.push(B),A.push(D.yytext),e.push(D.yylloc),g.push(W[1]),B=null,Jt=D.yyleng,s=D.yytext,qt=D.yylineno,Lt=D.yylloc;break;case 2:if(M=this.productions_[W[1]][1],lt.$=A[A.length-M],lt._$={first_line:e[e.length-(M||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(M||1)].first_column,last_column:e[e.length-1].last_column},Se&&(lt._$.range=[e[e.length-(M||1)].range[0],e[e.length-1].range[1]]),Et=this.performAction.apply(lt,[s,Jt,qt,K.yy,W[1],A,e].concat(be)),typeof Et<"u")return Et;M&&(g=g.slice(0,-1*M*2),A=A.slice(0,-1*M),e=e.slice(0,-1*M)),g.push(this.productions_[W[1]][0]),A.push(lt.$),e.push(lt._$),ee=pt[g[g.length-2]][g[g.length-1]],g.push(ee);break;case 3:return!0}}return!0},"parse")},me=(function(){var j={EOF:1,parseError:o(function(l,g){if(this.yy.parser)this.yy.parser.parseError(l,g);else throw new Error(l)},"parseError"),setInput:o(function(r,l){return this.yy=l||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:o(function(r){var l=r.length,g=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===f.length?this.yylloc.first_column:0)+f[f.length-g.length].length-g[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(r){this.unput(this.match.slice(r))},"less"),pastInput:o(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-CmYfgBi1.js b/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js similarity index 84% rename from amplifier_web/static/assets/railroadDiagram-O6MQD6OU-CmYfgBi1.js rename to amplifier_web/static/assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js index 754f78b59..f39555fac 100644 --- a/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-CmYfgBi1.js +++ b/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js @@ -1 +1 @@ -import{g as s,r as l,d as t}from"./chunk-SVP7TREG-BBG-Pp77.js";import{p as m}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{_ as n,l as i}from"./mermaid.core-CDlaSEyP.js";import{M as p,c as u}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; +import{g as s,r as l,d as t}from"./chunk-SVP7TREG-DegBQCYH.js";import{p as m}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as n,l as i}from"./mermaid.core-BQ5lTCZr.js";import{M as p,c as u}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; diff --git a/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DZ6X4Hg-.js b/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js similarity index 99% rename from amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DZ6X4Hg-.js rename to amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js index 319953f07..20beef1c9 100644 --- a/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DZ6X4Hg-.js +++ b/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js @@ -1,4 +1,4 @@ -import{g as ze}from"./chunk-XXDRQBXY-BvgnYF8f.js";import{s as Xe}from"./chunk-POPQ4Y6H-fljvmLmW.js";import{_ as d,y as Be,b as Je,a as Ze,s as et,g as tt,n as st,o as it,c as Ne,l as qe,p as rt,t as nt,u as at,v as lt,x as ct}from"./mermaid.core-CDlaSEyP.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var Ce=(function(){var e=d(function($,i,n,l){for(n=n||{},l=$.length;l--;n[$[l]]=i);return n},"o"),r=[1,3],u=[1,4],h=[1,5],o=[1,6],c=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,22],p=[2,7],y=[1,26],f=[1,27],m=[1,28],k=[1,29],C=[1,33],V=[1,34],A=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],_=[1,39],S=[1,40],g=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ve=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ee=[27,29],Ae=[1,70],ve=[1,71],Le=[1,72],xe=[1,73],Oe=[1,74],we=[1,75],De=[1,76],ee=[1,83],U=[1,80],te=[1,84],se=[1,85],ie=[1,86],re=[1,87],ne=[1,88],ae=[1,89],le=[1,90],ce=[1,91],oe=[1,92],pe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],Me=[1,101],Fe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],N=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],he=[1,116],ue=[1,117],fe=[1,114],me=[1,115],Se={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:d(function(i,n,l,s,R,t,de){var a=t.length-1;switch(R){case 4:this.$=t[a].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[a].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[a-3],t[a-4]);break;case 22:s.addRequirement(t[a-5],t[a-6]),s.setClass([t[a-5]],t[a-3]);break;case 23:s.setNewReqId(t[a-2]);break;case 24:s.setNewReqText(t[a-2]);break;case 25:s.setNewReqRisk(t[a-2]);break;case 26:s.setNewReqVerifyMethod(t[a-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[a-3]);break;case 43:s.addElement(t[a-5]),s.setClass([t[a-5]],t[a-3]);break;case 44:s.setNewElementType(t[a-2]);break;case 45:s.setNewElementDocRef(t[a-2]);break;case 48:s.addRelationship(t[a-2],t[a],t[a-4]);break;case 49:s.addRelationship(t[a-2],t[a-4],t[a]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[a-2],s.defineClass(t[a-1],t[a]);break;case 58:s.setClass(t[a-1],t[a]);break;case 59:s.setClass([t[a-2]],t[a]);break;case 60:case 62:this.$=[t[a]];break;case 61:case 63:this.$=t[a-2].concat([t[a]]);break;case 64:this.$=t[a-2],s.setCssStyle(t[a-1],t[a]);break;case 65:this.$=[t[a]];break;case 66:t[a-2].push(t[a]),this.$=t[a-2];break;case 68:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,6:r,9:u,11:h,13:o},{1:[3]},{3:8,4:2,5:[1,7],6:r,9:u,11:h,13:o},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(c,[2,6]),{3:12,4:2,6:r,9:u,11:h,13:o},{1:[2,2]},{4:17,5:E,7:13,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},e(c,[2,4]),e(c,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:E,7:42,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:43,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:44,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:45,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:46,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:47,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:48,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:49,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:50,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),{30:60,33:62,75:P,89:_,90:S},{30:63,33:62,75:P,89:_,90:S},{30:64,33:62,75:P,89:_,90:S},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ve,[2,81]),e(Ve,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(Ee,[2,79]),e(Ee,[2,80]),{27:[1,67],29:[1,68]},e(Ee,[2,85]),e(Ee,[2,86]),{62:69,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{62:77,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{30:78,33:62,75:P,89:_,90:S},{73:79,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,60]),e(pe,[2,62]),{73:93,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},{30:94,33:62,75:P,76:U,89:_,90:S},{5:[1,95]},{30:96,33:62,75:P,89:_,90:S},{5:[1,97]},{30:98,33:62,75:P,89:_,90:S},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(g,[2,59],{76:U}),e(g,[2,64],{76:Me}),{33:103,75:[1,102],89:_,90:S},e(Fe,[2,65],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),e(N,[2,67]),e(N,[2,69]),e(N,[2,70]),e(N,[2,71]),e(N,[2,72]),e(N,[2,73]),e(N,[2,74]),e(N,[2,75]),e(N,[2,76]),e(N,[2,77]),e(N,[2,78]),e(g,[2,57],{76:Me}),e(g,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:he,40:ue,56:113,57:fe,59:me},{27:[1,118],76:U},{33:119,89:_,90:S},{33:120,89:_,90:S},{75:ee,78:121,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,61]),e(pe,[2,63]),e(N,[2,68]),e(g,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(g,[2,28]),{5:[1,127]},e(g,[2,42]),{32:[1,128]},{32:[1,129]},{5:he,40:ue,56:130,57:fe,59:me},e(g,[2,47]),{5:[1,131]},e(g,[2,48]),e(g,[2,49]),e(Fe,[2,66],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),{33:132,89:_,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(g,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(g,[2,46]),{5:he,40:ue,56:152,57:fe,59:me},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(g,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(g,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:he,40:ue,56:163,57:fe,59:me},{5:he,40:ue,56:164,57:fe,59:me},e(g,[2,23]),e(g,[2,24]),e(g,[2,25]),e(g,[2,26]),e(g,[2,44]),e(g,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:d(function(i,n){if(n.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=n,l}},"parseError"),parse:d(function(i){var n=this,l=[0],s=[],R=[null],t=[],de=this.table,a="",ge=0,$e=0,Ke=2,Pe=1,We=t.slice.call(arguments,1),b=Object.create(this.lexer),G={yy:{}};for(var be in this.yy)Object.prototype.hasOwnProperty.call(this.yy,be)&&(G.yy[be]=this.yy[be]);b.setInput(i,G.yy),G.yy.lexer=b,G.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Ie=b.yylloc;t.push(Ie);var je=b.options&&b.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ge(T){l.length=l.length-2*T,R.length=R.length-T,t.length=t.length-T}d(Ge,"popStack");function Ue(){var T;return T=s.pop()||b.lex()||Pe,typeof T!="number"&&(T instanceof Array&&(s=T,T=s.pop()),T=n.symbols_[T]||T),T}d(Ue,"lex");for(var I,z,q,Te,J={},ye,F,Ye,_e;;){if(z=l[l.length-1],this.defaultActions[z]?q=this.defaultActions[z]:((I===null||typeof I>"u")&&(I=Ue()),q=de[z]&&de[z][I]),typeof q>"u"||!q.length||!q[0]){var ke="";_e=[];for(ye in de[z])this.terminals_[ye]&&ye>Ke&&_e.push("'"+this.terminals_[ye]+"'");b.showPosition?ke="Parse error on line "+(ge+1)+`: +import{g as ze}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as Xe}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as d,y as Be,b as Je,a as Ze,s as et,g as tt,n as st,o as it,c as Ne,l as qe,p as rt,t as nt,u as at,v as lt,x as ct}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Ce=(function(){var e=d(function($,i,n,l){for(n=n||{},l=$.length;l--;n[$[l]]=i);return n},"o"),r=[1,3],u=[1,4],h=[1,5],o=[1,6],c=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,22],p=[2,7],y=[1,26],f=[1,27],m=[1,28],k=[1,29],C=[1,33],V=[1,34],A=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],_=[1,39],S=[1,40],g=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ve=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ee=[27,29],Ae=[1,70],ve=[1,71],Le=[1,72],xe=[1,73],Oe=[1,74],we=[1,75],De=[1,76],ee=[1,83],U=[1,80],te=[1,84],se=[1,85],ie=[1,86],re=[1,87],ne=[1,88],ae=[1,89],le=[1,90],ce=[1,91],oe=[1,92],pe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],Me=[1,101],Fe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],N=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],he=[1,116],ue=[1,117],fe=[1,114],me=[1,115],Se={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:d(function(i,n,l,s,R,t,de){var a=t.length-1;switch(R){case 4:this.$=t[a].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[a].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[a-3],t[a-4]);break;case 22:s.addRequirement(t[a-5],t[a-6]),s.setClass([t[a-5]],t[a-3]);break;case 23:s.setNewReqId(t[a-2]);break;case 24:s.setNewReqText(t[a-2]);break;case 25:s.setNewReqRisk(t[a-2]);break;case 26:s.setNewReqVerifyMethod(t[a-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[a-3]);break;case 43:s.addElement(t[a-5]),s.setClass([t[a-5]],t[a-3]);break;case 44:s.setNewElementType(t[a-2]);break;case 45:s.setNewElementDocRef(t[a-2]);break;case 48:s.addRelationship(t[a-2],t[a],t[a-4]);break;case 49:s.addRelationship(t[a-2],t[a-4],t[a]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[a-2],s.defineClass(t[a-1],t[a]);break;case 58:s.setClass(t[a-1],t[a]);break;case 59:s.setClass([t[a-2]],t[a]);break;case 60:case 62:this.$=[t[a]];break;case 61:case 63:this.$=t[a-2].concat([t[a]]);break;case 64:this.$=t[a-2],s.setCssStyle(t[a-1],t[a]);break;case 65:this.$=[t[a]];break;case 66:t[a-2].push(t[a]),this.$=t[a-2];break;case 68:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,6:r,9:u,11:h,13:o},{1:[3]},{3:8,4:2,5:[1,7],6:r,9:u,11:h,13:o},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(c,[2,6]),{3:12,4:2,6:r,9:u,11:h,13:o},{1:[2,2]},{4:17,5:E,7:13,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},e(c,[2,4]),e(c,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:E,7:42,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:43,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:44,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:45,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:46,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:47,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:48,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:49,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:50,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),{30:60,33:62,75:P,89:_,90:S},{30:63,33:62,75:P,89:_,90:S},{30:64,33:62,75:P,89:_,90:S},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ve,[2,81]),e(Ve,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(Ee,[2,79]),e(Ee,[2,80]),{27:[1,67],29:[1,68]},e(Ee,[2,85]),e(Ee,[2,86]),{62:69,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{62:77,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{30:78,33:62,75:P,89:_,90:S},{73:79,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,60]),e(pe,[2,62]),{73:93,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},{30:94,33:62,75:P,76:U,89:_,90:S},{5:[1,95]},{30:96,33:62,75:P,89:_,90:S},{5:[1,97]},{30:98,33:62,75:P,89:_,90:S},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(g,[2,59],{76:U}),e(g,[2,64],{76:Me}),{33:103,75:[1,102],89:_,90:S},e(Fe,[2,65],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),e(N,[2,67]),e(N,[2,69]),e(N,[2,70]),e(N,[2,71]),e(N,[2,72]),e(N,[2,73]),e(N,[2,74]),e(N,[2,75]),e(N,[2,76]),e(N,[2,77]),e(N,[2,78]),e(g,[2,57],{76:Me}),e(g,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:he,40:ue,56:113,57:fe,59:me},{27:[1,118],76:U},{33:119,89:_,90:S},{33:120,89:_,90:S},{75:ee,78:121,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,61]),e(pe,[2,63]),e(N,[2,68]),e(g,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(g,[2,28]),{5:[1,127]},e(g,[2,42]),{32:[1,128]},{32:[1,129]},{5:he,40:ue,56:130,57:fe,59:me},e(g,[2,47]),{5:[1,131]},e(g,[2,48]),e(g,[2,49]),e(Fe,[2,66],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),{33:132,89:_,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(g,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(g,[2,46]),{5:he,40:ue,56:152,57:fe,59:me},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(g,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(g,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:he,40:ue,56:163,57:fe,59:me},{5:he,40:ue,56:164,57:fe,59:me},e(g,[2,23]),e(g,[2,24]),e(g,[2,25]),e(g,[2,26]),e(g,[2,44]),e(g,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:d(function(i,n){if(n.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=n,l}},"parseError"),parse:d(function(i){var n=this,l=[0],s=[],R=[null],t=[],de=this.table,a="",ge=0,$e=0,Ke=2,Pe=1,We=t.slice.call(arguments,1),b=Object.create(this.lexer),G={yy:{}};for(var be in this.yy)Object.prototype.hasOwnProperty.call(this.yy,be)&&(G.yy[be]=this.yy[be]);b.setInput(i,G.yy),G.yy.lexer=b,G.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Ie=b.yylloc;t.push(Ie);var je=b.options&&b.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ge(T){l.length=l.length-2*T,R.length=R.length-T,t.length=t.length-T}d(Ge,"popStack");function Ue(){var T;return T=s.pop()||b.lex()||Pe,typeof T!="number"&&(T instanceof Array&&(s=T,T=s.pop()),T=n.symbols_[T]||T),T}d(Ue,"lex");for(var I,z,q,Te,J={},ye,F,Ye,_e;;){if(z=l[l.length-1],this.defaultActions[z]?q=this.defaultActions[z]:((I===null||typeof I>"u")&&(I=Ue()),q=de[z]&&de[z][I]),typeof q>"u"||!q.length||!q[0]){var ke="";_e=[];for(ye in de[z])this.terminals_[ye]&&ye>Ke&&_e.push("'"+this.terminals_[ye]+"'");b.showPosition?ke="Parse error on line "+(ge+1)+`: `+b.showPosition()+` Expecting `+_e.join(", ")+", got '"+(this.terminals_[I]||I)+"'":ke="Parse error on line "+(ge+1)+": Unexpected "+(I==Pe?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(ke,{text:b.match,token:this.terminals_[I]||I,line:b.yylineno,loc:Ie,expected:_e})}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+I);switch(q[0]){case 1:l.push(I),R.push(b.yytext),t.push(b.yylloc),l.push(q[1]),I=null,$e=b.yyleng,a=b.yytext,ge=b.yylineno,Ie=b.yylloc;break;case 2:if(F=this.productions_[q[1]][1],J.$=R[R.length-F],J._$={first_line:t[t.length-(F||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(F||1)].first_column,last_column:t[t.length-1].last_column},je&&(J._$.range=[t[t.length-(F||1)].range[0],t[t.length-1].range[1]]),Te=this.performAction.apply(J,[a,$e,ge,G.yy,q[1],R,t].concat(We)),typeof Te<"u")return Te;F&&(l=l.slice(0,-1*F*2),R=R.slice(0,-1*F),t=t.slice(0,-1*F)),l.push(this.productions_[q[1]][0]),R.push(J.$),t.push(J._$),Ye=de[l[l.length-2]][l[l.length-1]],l.push(Ye);break;case 3:return!0}}return!0},"parse")},He=(function(){var $={EOF:1,parseError:d(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:d(function(i,n){return this.yy=n||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var n=i.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:d(function(i){var n=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===s.length?this.yylloc.first_column:0)+s[s.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(i){this.unput(this.match.slice(i))},"less"),pastInput:d(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var i=this.pastInput(),n=new Array(i.length+1).join("-");return i+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-KPy6Sszp.js b/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js similarity index 99% rename from amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-KPy6Sszp.js rename to amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js index fdbaf131c..e1fe9c3a1 100644 --- a/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-KPy6Sszp.js +++ b/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js @@ -1,4 +1,4 @@ -import{n as xt,o as _t,s as vt,g as bt,b as St,a as wt,_ as d,c as lt,b6 as Lt,j as H,X as Et,p as At,k as Tt}from"./mermaid.core-CDlaSEyP.js";import{o as Mt}from"./ordinal-Cboi1Yqb.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function Nt(t){for(var n=t.length/6|0,s=new Array(n),a=0;a=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s=u)&&(s=u)}return s}function pt(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s>a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function nt(t,n){let s=0;if(n===void 0)for(let a of t)(a=+a)&&(s+=a);else{let a=-1;for(let u of t)(u=+n(u,++a,t))&&(s+=u)}return s}function Pt(t){return t.target.depth}function It(t){return t.depth}function Ot(t,n){return n-1-t.height}function kt(t,n){return t.sourceLinks.length?t.depth:n-1}function $t(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?pt(t.sourceLinks,Pt)-1:0}function q(t){return function(){return t}}function ut(t,n){return Q(t.source,n.source)||t.index-n.index}function ht(t,n){return Q(t.target,n.target)||t.index-n.index}function Q(t,n){return t.y0-n.y0}function it(t){return t.value}function jt(t){return t.index}function Dt(t){return t.nodes}function zt(t){return t.links}function ft(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function yt({nodes:t}){for(const n of t){let s=n.y0,a=s;for(const u of n.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of n.targetLinks)u.y1=a+u.width/2,a+=u.width}}function Bt(){let t=0,n=0,s=1,a=1,u=24,y=8,p,m=jt,o=kt,l,h,x=Dt,_=zt,g=6;function v(){const i={nodes:x.apply(null,arguments),links:_.apply(null,arguments)};return T(i),A(i),M(i),I(i),S(i),yt(i),i}v.update=function(i){return yt(i),i},v.nodeId=function(i){return arguments.length?(m=typeof i=="function"?i:q(i),v):m},v.nodeAlign=function(i){return arguments.length?(o=typeof i=="function"?i:q(i),v):o},v.nodeSort=function(i){return arguments.length?(l=i,v):l},v.nodeWidth=function(i){return arguments.length?(u=+i,v):u},v.nodePadding=function(i){return arguments.length?(y=p=+i,v):y},v.nodes=function(i){return arguments.length?(x=typeof i=="function"?i:q(i),v):x},v.links=function(i){return arguments.length?(_=typeof i=="function"?i:q(i),v):_},v.linkSort=function(i){return arguments.length?(h=i,v):h},v.size=function(i){return arguments.length?(t=n=0,s=+i[0],a=+i[1],v):[s-t,a-n]},v.extent=function(i){return arguments.length?(t=+i[0][0],s=+i[1][0],n=+i[0][1],a=+i[1][1],v):[[t,n],[s,a]]},v.iterations=function(i){return arguments.length?(g=+i,v):g};function T({nodes:i,links:f}){for(const[e,r]of i.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(i.map((e,r)=>[m(e,r,i),e]));for(const[e,r]of f.entries()){r.index=e;let{source:k,target:b}=r;typeof k!="object"&&(k=r.source=ft(c,k)),typeof b!="object"&&(b=r.target=ft(c,b)),k.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of i)e.sort(h),r.sort(h)}function A({nodes:i}){for(const f of i)f.value=f.fixedValue===void 0?Math.max(nt(f.sourceLinks,it),nt(f.targetLinks,it)):f.fixedValue}function M({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.depth=r;for(const{target:b}of k.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.height=r;for(const{source:b}of k.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:i}){const f=ct(i,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of i){const k=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=k,r.x0=t+k*c,r.x1=r.x0+u,e[k]?e[k].push(r):e[k]=[r]}if(l)for(const r of e)r.sort(l);return e}function j(i){const f=pt(i,c=>(a-n-(c.length-1)*p)/nt(c,it));for(const c of i){let e=n;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+p;for(const k of r.sourceLinks)k.width=k.value*f}e=(a-e+p)/(c.length+1);for(let r=0;rc.length)-1)),j(f);for(let c=0;c0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function R(i,f,c){for(let e=i.length,r=e-2;r>=0;--r){const k=i[r];for(const b of k){let L=0,B=0;for(const{target:X,value:et}of b.sourceLinks){let Y=et*(X.layer-b.layer);L+=E(b,X)*Y,B+=Y}if(!(B>0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function D(i,f){const c=i.length>>1,e=i[c];O(i,e.y0-p,c-1,f),V(i,e.y1+p,c+1,f),O(i,a,i.length-1,f),V(i,n,0,f)}function V(i,f,c,e){for(;c1e-6&&(r.y0+=k,r.y1+=k),f=r.y1+p}}function O(i,f,c,e){for(;c>=0;--c){const r=i[c],k=(r.y1-f)*e;k>1e-6&&(r.y0-=k,r.y1-=k),f=r.y0-p}}function z({sourceLinks:i,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ht);for(const{target:{targetLinks:c}}of i)c.sort(ut)}}function w(i){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of i)f.sort(ht),c.sort(ut)}function P(i,f){let c=i.y0-(i.sourceLinks.length-1)*p/2;for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c+=r+p}for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c-=r}return c}function E(i,f){let c=f.y0-(f.targetLinks.length-1)*p/2;for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c+=r+p}for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c-=r}return c}return v}var rt=Math.PI,st=2*rt,F=1e-6,Ft=st-F;function ot(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function mt(){return new ot}ot.prototype=mt.prototype={constructor:ot,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,a){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+a)},bezierCurveTo:function(t,n,s,a,u,y){this._+="C"+ +t+","+ +n+","+ +s+","+ +a+","+(this._x1=+u)+","+(this._y1=+y)},arcTo:function(t,n,s,a,u){t=+t,n=+n,s=+s,a=+a,u=+u;var y=this._x1,p=this._y1,m=s-t,o=a-n,l=y-t,h=p-n,x=l*l+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(x>F)if(!(Math.abs(h*m-o*l)>F)||!u)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var _=s-y,g=a-p,v=m*m+o*o,T=_*_+g*g,A=Math.sqrt(v),M=Math.sqrt(x),I=u*Math.tan((rt-Math.acos((v+x-T)/(2*A*M)))/2),N=I/M,j=I/A;Math.abs(N-1)>F&&(this._+="L"+(t+N*l)+","+(n+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>l*g)+","+(this._x1=t+j*m)+","+(this._y1=n+j*o)}},arc:function(t,n,s,a,u,y){t=+t,n=+n,s=+s,y=!!y;var p=s*Math.cos(a),m=s*Math.sin(a),o=t+p,l=n+m,h=1^y,x=y?a-u:u-a;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+l:(Math.abs(this._x1-o)>F||Math.abs(this._y1-l)>F)&&(this._+="L"+o+","+l),s&&(x<0&&(x=x%st+st),x>Ft?this._+="A"+s+","+s+",0,1,"+h+","+(t-p)+","+(n-m)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=l):x>F&&(this._+="A"+s+","+s+",0,"+ +(x>=rt)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=n+s*Math.sin(u))))},rect:function(t,n,s,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +a+"h"+-s+"Z"},toString:function(){return this._}};function dt(t){return function(){return t}}function Rt(t){return t[0]}function Vt(t){return t[1]}var Wt=Array.prototype.slice;function Gt(t){return t.source}function Ut(t){return t.target}function Xt(t){var n=Gt,s=Ut,a=Rt,u=Vt,y=null;function p(){var m,o=Wt.call(arguments),l=n.apply(this,o),h=s.apply(this,o);if(y||(y=m=mt()),t(y,+a.apply(this,(o[0]=l,o)),+u.apply(this,o),+a.apply(this,(o[0]=h,o)),+u.apply(this,o)),m)return y=null,m+""||null}return p.source=function(m){return arguments.length?(n=m,p):n},p.target=function(m){return arguments.length?(s=m,p):s},p.x=function(m){return arguments.length?(a=typeof m=="function"?m:dt(+m),p):a},p.y=function(m){return arguments.length?(u=typeof m=="function"?m:dt(+m),p):u},p.context=function(m){return arguments.length?(y=m??null,p):y},p}function Yt(t,n,s,a,u){t.moveTo(n,s),t.bezierCurveTo(n=(n+a)/2,s,n,u,a,u)}function Ht(){return Xt(Yt)}function qt(t){return[t.source.x1,t.y0]}function Qt(t){return[t.target.x0,t.y1]}function Kt(){return Ht().source(qt).target(Qt)}var at=(function(){var t=d(function(m,o,l,h){for(l=l||{},h=m.length;h--;l[m[h]]=o);return l},"o"),n=[1,9],s=[1,10],a=[1,5,10,12],u={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:d(function(o,l,h,x,_,g,v){var T=g.length-1;switch(_){case 7:const A=x.findOrCreateNode(g[T-4].trim().replaceAll('""','"')),M=x.findOrCreateNode(g[T-2].trim().replaceAll('""','"')),I=parseFloat(g[T].trim());x.addLink(A,M,I);break;case 8:case 9:case 11:this.$=g[T];break;case 10:this.$=g[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:d(function(o,l){if(l.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=l,h}},"parseError"),parse:d(function(o){var l=this,h=[0],x=[],_=[null],g=[],v=this.table,T="",A=0,M=0,I=2,N=1,j=g.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(C.yy[R]=this.yy[R]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;g.push(D);var V=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,g.length=g.length-L}d(O,"popStack");function z(){var L;return L=x.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(x=L,L=x.pop()),L=l.symbols_[L]||L),L}d(z,"lex");for(var w,P,E,i,f={},c,e,r,k;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=z()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";k=[];for(c in v[P])this.terminals_[c]&&c>I&&k.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: +import{n as xt,o as _t,s as vt,g as bt,b as St,a as wt,_ as d,c as lt,b6 as Lt,j as H,X as Et,p as At,k as Tt}from"./mermaid.core-BQ5lTCZr.js";import{o as Mt}from"./ordinal-Cboi1Yqb.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function Nt(t){for(var n=t.length/6|0,s=new Array(n),a=0;a=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s=u)&&(s=u)}return s}function pt(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s>a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function nt(t,n){let s=0;if(n===void 0)for(let a of t)(a=+a)&&(s+=a);else{let a=-1;for(let u of t)(u=+n(u,++a,t))&&(s+=u)}return s}function Pt(t){return t.target.depth}function It(t){return t.depth}function Ot(t,n){return n-1-t.height}function kt(t,n){return t.sourceLinks.length?t.depth:n-1}function $t(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?pt(t.sourceLinks,Pt)-1:0}function q(t){return function(){return t}}function ut(t,n){return Q(t.source,n.source)||t.index-n.index}function ht(t,n){return Q(t.target,n.target)||t.index-n.index}function Q(t,n){return t.y0-n.y0}function it(t){return t.value}function jt(t){return t.index}function Dt(t){return t.nodes}function zt(t){return t.links}function ft(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function yt({nodes:t}){for(const n of t){let s=n.y0,a=s;for(const u of n.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of n.targetLinks)u.y1=a+u.width/2,a+=u.width}}function Bt(){let t=0,n=0,s=1,a=1,u=24,y=8,p,m=jt,o=kt,l,h,x=Dt,_=zt,g=6;function v(){const i={nodes:x.apply(null,arguments),links:_.apply(null,arguments)};return T(i),A(i),M(i),I(i),S(i),yt(i),i}v.update=function(i){return yt(i),i},v.nodeId=function(i){return arguments.length?(m=typeof i=="function"?i:q(i),v):m},v.nodeAlign=function(i){return arguments.length?(o=typeof i=="function"?i:q(i),v):o},v.nodeSort=function(i){return arguments.length?(l=i,v):l},v.nodeWidth=function(i){return arguments.length?(u=+i,v):u},v.nodePadding=function(i){return arguments.length?(y=p=+i,v):y},v.nodes=function(i){return arguments.length?(x=typeof i=="function"?i:q(i),v):x},v.links=function(i){return arguments.length?(_=typeof i=="function"?i:q(i),v):_},v.linkSort=function(i){return arguments.length?(h=i,v):h},v.size=function(i){return arguments.length?(t=n=0,s=+i[0],a=+i[1],v):[s-t,a-n]},v.extent=function(i){return arguments.length?(t=+i[0][0],s=+i[1][0],n=+i[0][1],a=+i[1][1],v):[[t,n],[s,a]]},v.iterations=function(i){return arguments.length?(g=+i,v):g};function T({nodes:i,links:f}){for(const[e,r]of i.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(i.map((e,r)=>[m(e,r,i),e]));for(const[e,r]of f.entries()){r.index=e;let{source:k,target:b}=r;typeof k!="object"&&(k=r.source=ft(c,k)),typeof b!="object"&&(b=r.target=ft(c,b)),k.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of i)e.sort(h),r.sort(h)}function A({nodes:i}){for(const f of i)f.value=f.fixedValue===void 0?Math.max(nt(f.sourceLinks,it),nt(f.targetLinks,it)):f.fixedValue}function M({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.depth=r;for(const{target:b}of k.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.height=r;for(const{source:b}of k.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:i}){const f=ct(i,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of i){const k=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=k,r.x0=t+k*c,r.x1=r.x0+u,e[k]?e[k].push(r):e[k]=[r]}if(l)for(const r of e)r.sort(l);return e}function j(i){const f=pt(i,c=>(a-n-(c.length-1)*p)/nt(c,it));for(const c of i){let e=n;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+p;for(const k of r.sourceLinks)k.width=k.value*f}e=(a-e+p)/(c.length+1);for(let r=0;rc.length)-1)),j(f);for(let c=0;c0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function R(i,f,c){for(let e=i.length,r=e-2;r>=0;--r){const k=i[r];for(const b of k){let L=0,B=0;for(const{target:X,value:et}of b.sourceLinks){let Y=et*(X.layer-b.layer);L+=E(b,X)*Y,B+=Y}if(!(B>0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function D(i,f){const c=i.length>>1,e=i[c];O(i,e.y0-p,c-1,f),V(i,e.y1+p,c+1,f),O(i,a,i.length-1,f),V(i,n,0,f)}function V(i,f,c,e){for(;c1e-6&&(r.y0+=k,r.y1+=k),f=r.y1+p}}function O(i,f,c,e){for(;c>=0;--c){const r=i[c],k=(r.y1-f)*e;k>1e-6&&(r.y0-=k,r.y1-=k),f=r.y0-p}}function z({sourceLinks:i,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ht);for(const{target:{targetLinks:c}}of i)c.sort(ut)}}function w(i){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of i)f.sort(ht),c.sort(ut)}function P(i,f){let c=i.y0-(i.sourceLinks.length-1)*p/2;for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c+=r+p}for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c-=r}return c}function E(i,f){let c=f.y0-(f.targetLinks.length-1)*p/2;for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c+=r+p}for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c-=r}return c}return v}var rt=Math.PI,st=2*rt,F=1e-6,Ft=st-F;function ot(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function mt(){return new ot}ot.prototype=mt.prototype={constructor:ot,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,a){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+a)},bezierCurveTo:function(t,n,s,a,u,y){this._+="C"+ +t+","+ +n+","+ +s+","+ +a+","+(this._x1=+u)+","+(this._y1=+y)},arcTo:function(t,n,s,a,u){t=+t,n=+n,s=+s,a=+a,u=+u;var y=this._x1,p=this._y1,m=s-t,o=a-n,l=y-t,h=p-n,x=l*l+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(x>F)if(!(Math.abs(h*m-o*l)>F)||!u)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var _=s-y,g=a-p,v=m*m+o*o,T=_*_+g*g,A=Math.sqrt(v),M=Math.sqrt(x),I=u*Math.tan((rt-Math.acos((v+x-T)/(2*A*M)))/2),N=I/M,j=I/A;Math.abs(N-1)>F&&(this._+="L"+(t+N*l)+","+(n+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>l*g)+","+(this._x1=t+j*m)+","+(this._y1=n+j*o)}},arc:function(t,n,s,a,u,y){t=+t,n=+n,s=+s,y=!!y;var p=s*Math.cos(a),m=s*Math.sin(a),o=t+p,l=n+m,h=1^y,x=y?a-u:u-a;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+l:(Math.abs(this._x1-o)>F||Math.abs(this._y1-l)>F)&&(this._+="L"+o+","+l),s&&(x<0&&(x=x%st+st),x>Ft?this._+="A"+s+","+s+",0,1,"+h+","+(t-p)+","+(n-m)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=l):x>F&&(this._+="A"+s+","+s+",0,"+ +(x>=rt)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=n+s*Math.sin(u))))},rect:function(t,n,s,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +a+"h"+-s+"Z"},toString:function(){return this._}};function dt(t){return function(){return t}}function Rt(t){return t[0]}function Vt(t){return t[1]}var Wt=Array.prototype.slice;function Gt(t){return t.source}function Ut(t){return t.target}function Xt(t){var n=Gt,s=Ut,a=Rt,u=Vt,y=null;function p(){var m,o=Wt.call(arguments),l=n.apply(this,o),h=s.apply(this,o);if(y||(y=m=mt()),t(y,+a.apply(this,(o[0]=l,o)),+u.apply(this,o),+a.apply(this,(o[0]=h,o)),+u.apply(this,o)),m)return y=null,m+""||null}return p.source=function(m){return arguments.length?(n=m,p):n},p.target=function(m){return arguments.length?(s=m,p):s},p.x=function(m){return arguments.length?(a=typeof m=="function"?m:dt(+m),p):a},p.y=function(m){return arguments.length?(u=typeof m=="function"?m:dt(+m),p):u},p.context=function(m){return arguments.length?(y=m??null,p):y},p}function Yt(t,n,s,a,u){t.moveTo(n,s),t.bezierCurveTo(n=(n+a)/2,s,n,u,a,u)}function Ht(){return Xt(Yt)}function qt(t){return[t.source.x1,t.y0]}function Qt(t){return[t.target.x0,t.y1]}function Kt(){return Ht().source(qt).target(Qt)}var at=(function(){var t=d(function(m,o,l,h){for(l=l||{},h=m.length;h--;l[m[h]]=o);return l},"o"),n=[1,9],s=[1,10],a=[1,5,10,12],u={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:d(function(o,l,h,x,_,g,v){var T=g.length-1;switch(_){case 7:const A=x.findOrCreateNode(g[T-4].trim().replaceAll('""','"')),M=x.findOrCreateNode(g[T-2].trim().replaceAll('""','"')),I=parseFloat(g[T].trim());x.addLink(A,M,I);break;case 8:case 9:case 11:this.$=g[T];break;case 10:this.$=g[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:d(function(o,l){if(l.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=l,h}},"parseError"),parse:d(function(o){var l=this,h=[0],x=[],_=[null],g=[],v=this.table,T="",A=0,M=0,I=2,N=1,j=g.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(C.yy[R]=this.yy[R]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;g.push(D);var V=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,g.length=g.length-L}d(O,"popStack");function z(){var L;return L=x.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(x=L,L=x.pop()),L=l.symbols_[L]||L),L}d(z,"lex");for(var w,P,E,i,f={},c,e,r,k;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=z()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";k=[];for(c in v[P])this.terminals_[c]&&c>I&&k.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: `+S.showPosition()+` Expecting `+k.join(", ")+", got '"+(this.terminals_[w]||w)+"'":b="Parse error on line "+(A+1)+": Unexpected "+(w==N?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(b,{text:S.match,token:this.terminals_[w]||w,line:S.yylineno,loc:D,expected:k})}if(E[0]instanceof Array&&E.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+w);switch(E[0]){case 1:h.push(w),_.push(S.yytext),g.push(S.yylloc),h.push(E[1]),w=null,M=S.yyleng,T=S.yytext,A=S.yylineno,D=S.yylloc;break;case 2:if(e=this.productions_[E[1]][1],f.$=_[_.length-e],f._$={first_line:g[g.length-(e||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(e||1)].first_column,last_column:g[g.length-1].last_column},V&&(f._$.range=[g[g.length-(e||1)].range[0],g[g.length-1].range[1]]),i=this.performAction.apply(f,[T,M,A,C.yy,E[1],_,g].concat(j)),typeof i<"u")return i;e&&(h=h.slice(0,-1*e*2),_=_.slice(0,-1*e),g=g.slice(0,-1*e)),h.push(this.productions_[E[1]][0]),_.push(f.$),g.push(f._$),r=v[h[h.length-2]][h[h.length-1]],h.push(r);break;case 3:return!0}}return!0},"parse")},y=(function(){var m={EOF:1,parseError:d(function(l,h){if(this.yy.parser)this.yy.parser.parseError(l,h);else throw new Error(l)},"parseError"),setInput:d(function(o,l){return this.yy=l||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var l=o.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:d(function(o){var l=o.length,h=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===x.length?this.yylloc.first_column:0)+x[x.length-h.length].length-h[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(o){this.unput(this.match.slice(o))},"less"),pastInput:d(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var o=this.pastInput(),l=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-DZbP_JPP.js b/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js similarity index 99% rename from amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-DZbP_JPP.js rename to amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js index d42733f41..6e8f5b81f 100644 --- a/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-DZbP_JPP.js +++ b/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js @@ -1,4 +1,4 @@ -import{I as er}from"./chunk-2Q5K7J3B-CLX5dmV-.js";import{_ as x,F as rr,c as j,j as Yt,l as it,G as Me,d as ar,e as sr,k as m,b as De,s as ir,n as nr,a as or,g as cr,o as lr,H as hr,J as dr,p as Tr,i as Wt,x as Z,I as Q,K as kt,L as Be,Z as pr,y as Ft,M as Er,N as Ve}from"./mermaid.core-CDlaSEyP.js";import{a as ur,g as se,b as dt,d as fr,c as ie,e as ne}from"./chunk-F27PBJKO-D9qW0VD2.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var ee=(function(){var e=x(function(ut,N,v,k){for(v=v||{},k=ut.length;k--;v[ut[k]]=N);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],E=[1,14],h=[1,15],p=[1,17],_=[1,18],u=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],P=[1,32],S=[1,33],w=[1,34],M=[1,35],V=[1,36],Y=[1,37],z=[1,38],K=[1,39],X=[1,40],$=[1,42],tt=[1,43],U=[1,44],nt=[1,45],et=[1,46],W=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],wt=[1,74],Dt=[1,80],A=[1,81],D=[1,82],rt=[1,83],at=[1,84],F=[1,85],Ot=[1,86],oe=[1,87],ce=[1,88],le=[1,89],he=[1,90],de=[1,91],Te=[1,92],pe=[1,93],Ee=[1,94],ue=[1,95],fe=[1,96],_e=[1,97],ge=[1,98],xe=[1,99],Ie=[1,100],ye=[1,101],Re=[1,102],Oe=[1,103],Le=[1,104],be=[1,105],Ae=[2,78],Nt=[4,5,17,51,53,54],vt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Gt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],we=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Xt=[5,52],H=[70,71,72,73],ct=[1,151],Jt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(N,v,k,y,G,c,mt){var d=c.length-1;switch(G){case 3:return y.apply(c[d]),c[d];case 4:case 10:this.$=[];break;case 5:case 11:c[d-1].push(c[d]),this.$=c[d-1];break;case 6:case 7:case 12:case 13:this.$=c[d];break;case 8:case 9:case 14:this.$=[];break;case 16:c[d].type="createParticipant",this.$=c[d];break;case 17:c[d-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[d-2])}),c[d-1].push({type:"boxEnd",boxText:c[d-2]}),this.$=c[d-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-2]),sequenceIndexStep:Number(c[d-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-1].actor};break;case 30:y.setDiagramTitle(c[d].substring(6)),this.$=c[d].substring(6);break;case 31:y.setDiagramTitle(c[d].substring(7)),this.$=c[d].substring(7);break;case 32:this.$=c[d].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[d].trim(),y.setAccDescription(this.$);break;case 35:c[d-1].unshift({type:"loopStart",loopText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.LOOP_START}),c[d-1].push({type:"loopEnd",loopText:c[d-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[d-1];break;case 36:c[d-1].unshift({type:"rectStart",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_START}),c[d-1].push({type:"rectEnd",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[d-1];break;case 37:c[d-1].unshift({type:"optStart",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_START}),c[d-1].push({type:"optEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[d-1];break;case 38:c[d-1].unshift({type:"altStart",altText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.ALT_START}),c[d-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[d-1];break;case 39:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 40:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 41:c[d-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.CRITICAL_START}),c[d-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[d-1];break;case 42:c[d-1].unshift({type:"breakStart",breakText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_START}),c[d-1].push({type:"breakEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[d-1];break;case 44:this.$=c[d-3].concat([{type:"option",optionText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[d]]);break;case 46:this.$=c[d-3].concat([{type:"and",parText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.PAR_AND},c[d]]);break;case 48:this.$=c[d-3].concat([{type:"else",altText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.ALT_ELSE},c[d]]);break;case 49:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 50:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 51:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 52:case 57:c[d-1].draw="actor",c[d-1].type="addParticipant",this.$=c[d-1];break;case 53:c[d-1].type="destroyParticipant",this.$=c[d-1];break;case 54:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 55:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 56:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 58:this.$=[c[d-1],{type:"addNote",placement:c[d-2],actor:c[d-1].actor,text:c[d]}];break;case 59:c[d-2]=[].concat(c[d-1],c[d-1]).slice(0,2),c[d-2][0]=c[d-2][0].actor,c[d-2][1]=c[d-2][1].actor,this.$=[c[d-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[d-2].slice(0,2),text:c[d]}];break;case 60:this.$=[c[d-1],{type:"addLinks",actor:c[d-1].actor,text:c[d]}];break;case 61:this.$=[c[d-1],{type:"addALink",actor:c[d-1].actor,text:c[d]}];break;case 62:this.$=[c[d-1],{type:"addProperties",actor:c[d-1].actor,text:c[d]}];break;case 63:this.$=[c[d-1],{type:"addDetails",actor:c[d-1].actor,text:c[d]}];break;case 66:this.$=[c[d-2],c[d]];break;case 67:this.$=c[d];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor}];break;case 71:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-4].actor}];break;case 72:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor}];break;case 73:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-4].actor}];break;case 74:this.$=[c[d-5],c[d-1],{type:"addMessage",from:c[d-5].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-5].actor}];break;case 75:this.$=[c[d-3],c[d-1],{type:"addMessage",from:c[d-3].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d]}];break;case 76:this.$={type:"addParticipant",actor:c[d-1],config:c[d]};break;case 77:this.$=c[d-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[d]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[d].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,5]),{9:48,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:z,53:K,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:W},{23:56,73:W},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:wt},{23:75,55:76,73:wt},{23:77,73:W},{69:78,72:[1,79],78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:W},{23:111,73:W},{23:112,73:W},{23:113,73:W},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],Ae),e(C,[2,6]),e(C,[2,16]),e(Nt,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(vt,i,{7:120}),e(vt,i,{7:121}),e(vt,i,{7:122}),e(Se,i,{41:123,7:124}),e(Gt,i,{43:125,7:126}),e(Gt,i,{7:126,43:127}),e(we,i,{46:128,7:129}),e(vt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Xt,Ae,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:W},{69:146,78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},e(H,[2,79]),e(H,[2,80]),e(H,[2,81]),e(H,[2,82]),e(H,[2,83]),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(H,[2,89]),e(H,[2,90]),e(H,[2,91]),e(H,[2,92]),e(H,[2,93]),e(H,[2,94]),e(H,[2,95]),e(H,[2,96]),e(H,[2,97]),e(H,[2,98]),e(H,[2,99]),e(H,[2,100]),e(H,[2,101]),e(H,[2,102]),e(H,[2,103]),e(H,[2,104]),{23:147,73:W},{23:149,60:148,73:W},{73:[2,68]},{73:[2,69]},{58:150,104:ct},{58:152,104:ct},{58:153,104:ct},{58:154,104:ct},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:z,53:K,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,161],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,162],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,163],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,47],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,50:[1,165],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,45],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,49:[1,167],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,43],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,48:[1,170],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,171],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Xt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:W},{23:178,73:W},{23:179,73:W},{58:180,104:ct},{23:181,72:[1,182],73:W},{58:183,104:ct},{58:184,104:ct},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(Nt,[2,11]),{13:186,51:z,53:K,54:X},e(Nt,[2,13]),e(Nt,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ct},{58:196,104:ct},{58:197,104:ct},{5:[2,75]},{58:198,104:ct},{23:199,73:W},{5:[2,58]},{5:[2,59]},{23:200,73:W},e(Nt,[2,12]),e(Se,i,{7:124,41:201}),e(Gt,i,{7:126,43:202}),e(we,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Xt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ct},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(N,v){if(v.recoverable)this.trace(N);else{var k=new Error(N);throw k.hash=v,k}},"parseError"),parse:x(function(N){var v=this,k=[0],y=[],G=[null],c=[],mt=this.table,d="",Mt=0,Ne=0,Qe=2,me=1,$e=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Zt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Zt)&&(gt.yy[Zt]=this.yy[Zt]);J.setInput(N,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Qt=J.yylloc;c.push(Qt);var je=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tr(ot){k.length=k.length-2*ot,G.length=G.length-ot,c.length=c.length-ot}x(tr,"popStack");function Pe(){var ot;return ot=y.pop()||J.lex()||me,typeof ot!="number"&&(ot instanceof Array&&(y=ot,ot=y.pop()),ot=v.symbols_[ot]||ot),ot}x(Pe,"lex");for(var st,xt,lt,$t,Lt={},Bt,Tt,ke,Vt;;){if(xt=k[k.length-1],this.defaultActions[xt]?lt=this.defaultActions[xt]:((st===null||typeof st>"u")&&(st=Pe()),lt=mt[xt]&&mt[xt][st]),typeof lt>"u"||!lt.length||!lt[0]){var jt="";Vt=[];for(Bt in mt[xt])this.terminals_[Bt]&&Bt>Qe&&Vt.push("'"+this.terminals_[Bt]+"'");J.showPosition?jt="Parse error on line "+(Mt+1)+`: +import{I as er}from"./chunk-2Q5K7J3B-DR5XPUmF.js";import{_ as x,F as rr,c as j,j as Yt,l as it,G as Me,d as ar,e as sr,k as m,b as De,s as ir,n as nr,a as or,g as cr,o as lr,H as hr,J as dr,p as Tr,i as Wt,x as Z,I as Q,K as kt,L as Be,Z as pr,y as Ft,M as Er,N as Ve}from"./mermaid.core-BQ5lTCZr.js";import{a as ur,g as se,b as dt,d as fr,c as ie,e as ne}from"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var ee=(function(){var e=x(function(ut,N,v,k){for(v=v||{},k=ut.length;k--;v[ut[k]]=N);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],E=[1,14],h=[1,15],p=[1,17],_=[1,18],u=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],P=[1,32],S=[1,33],w=[1,34],M=[1,35],V=[1,36],Y=[1,37],z=[1,38],K=[1,39],X=[1,40],$=[1,42],tt=[1,43],U=[1,44],nt=[1,45],et=[1,46],W=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],wt=[1,74],Dt=[1,80],A=[1,81],D=[1,82],rt=[1,83],at=[1,84],F=[1,85],Ot=[1,86],oe=[1,87],ce=[1,88],le=[1,89],he=[1,90],de=[1,91],Te=[1,92],pe=[1,93],Ee=[1,94],ue=[1,95],fe=[1,96],_e=[1,97],ge=[1,98],xe=[1,99],Ie=[1,100],ye=[1,101],Re=[1,102],Oe=[1,103],Le=[1,104],be=[1,105],Ae=[2,78],Nt=[4,5,17,51,53,54],vt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Gt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],we=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Xt=[5,52],H=[70,71,72,73],ct=[1,151],Jt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(N,v,k,y,G,c,mt){var d=c.length-1;switch(G){case 3:return y.apply(c[d]),c[d];case 4:case 10:this.$=[];break;case 5:case 11:c[d-1].push(c[d]),this.$=c[d-1];break;case 6:case 7:case 12:case 13:this.$=c[d];break;case 8:case 9:case 14:this.$=[];break;case 16:c[d].type="createParticipant",this.$=c[d];break;case 17:c[d-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[d-2])}),c[d-1].push({type:"boxEnd",boxText:c[d-2]}),this.$=c[d-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-2]),sequenceIndexStep:Number(c[d-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-1].actor};break;case 30:y.setDiagramTitle(c[d].substring(6)),this.$=c[d].substring(6);break;case 31:y.setDiagramTitle(c[d].substring(7)),this.$=c[d].substring(7);break;case 32:this.$=c[d].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[d].trim(),y.setAccDescription(this.$);break;case 35:c[d-1].unshift({type:"loopStart",loopText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.LOOP_START}),c[d-1].push({type:"loopEnd",loopText:c[d-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[d-1];break;case 36:c[d-1].unshift({type:"rectStart",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_START}),c[d-1].push({type:"rectEnd",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[d-1];break;case 37:c[d-1].unshift({type:"optStart",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_START}),c[d-1].push({type:"optEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[d-1];break;case 38:c[d-1].unshift({type:"altStart",altText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.ALT_START}),c[d-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[d-1];break;case 39:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 40:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 41:c[d-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.CRITICAL_START}),c[d-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[d-1];break;case 42:c[d-1].unshift({type:"breakStart",breakText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_START}),c[d-1].push({type:"breakEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[d-1];break;case 44:this.$=c[d-3].concat([{type:"option",optionText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[d]]);break;case 46:this.$=c[d-3].concat([{type:"and",parText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.PAR_AND},c[d]]);break;case 48:this.$=c[d-3].concat([{type:"else",altText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.ALT_ELSE},c[d]]);break;case 49:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 50:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 51:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 52:case 57:c[d-1].draw="actor",c[d-1].type="addParticipant",this.$=c[d-1];break;case 53:c[d-1].type="destroyParticipant",this.$=c[d-1];break;case 54:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 55:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 56:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 58:this.$=[c[d-1],{type:"addNote",placement:c[d-2],actor:c[d-1].actor,text:c[d]}];break;case 59:c[d-2]=[].concat(c[d-1],c[d-1]).slice(0,2),c[d-2][0]=c[d-2][0].actor,c[d-2][1]=c[d-2][1].actor,this.$=[c[d-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[d-2].slice(0,2),text:c[d]}];break;case 60:this.$=[c[d-1],{type:"addLinks",actor:c[d-1].actor,text:c[d]}];break;case 61:this.$=[c[d-1],{type:"addALink",actor:c[d-1].actor,text:c[d]}];break;case 62:this.$=[c[d-1],{type:"addProperties",actor:c[d-1].actor,text:c[d]}];break;case 63:this.$=[c[d-1],{type:"addDetails",actor:c[d-1].actor,text:c[d]}];break;case 66:this.$=[c[d-2],c[d]];break;case 67:this.$=c[d];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor}];break;case 71:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-4].actor}];break;case 72:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor}];break;case 73:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-4].actor}];break;case 74:this.$=[c[d-5],c[d-1],{type:"addMessage",from:c[d-5].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-5].actor}];break;case 75:this.$=[c[d-3],c[d-1],{type:"addMessage",from:c[d-3].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d]}];break;case 76:this.$={type:"addParticipant",actor:c[d-1],config:c[d]};break;case 77:this.$=c[d-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[d]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[d].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,5]),{9:48,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:z,53:K,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:W},{23:56,73:W},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:wt},{23:75,55:76,73:wt},{23:77,73:W},{69:78,72:[1,79],78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:W},{23:111,73:W},{23:112,73:W},{23:113,73:W},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],Ae),e(C,[2,6]),e(C,[2,16]),e(Nt,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(vt,i,{7:120}),e(vt,i,{7:121}),e(vt,i,{7:122}),e(Se,i,{41:123,7:124}),e(Gt,i,{43:125,7:126}),e(Gt,i,{7:126,43:127}),e(we,i,{46:128,7:129}),e(vt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Xt,Ae,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:W},{69:146,78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},e(H,[2,79]),e(H,[2,80]),e(H,[2,81]),e(H,[2,82]),e(H,[2,83]),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(H,[2,89]),e(H,[2,90]),e(H,[2,91]),e(H,[2,92]),e(H,[2,93]),e(H,[2,94]),e(H,[2,95]),e(H,[2,96]),e(H,[2,97]),e(H,[2,98]),e(H,[2,99]),e(H,[2,100]),e(H,[2,101]),e(H,[2,102]),e(H,[2,103]),e(H,[2,104]),{23:147,73:W},{23:149,60:148,73:W},{73:[2,68]},{73:[2,69]},{58:150,104:ct},{58:152,104:ct},{58:153,104:ct},{58:154,104:ct},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:z,53:K,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,161],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,162],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,163],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,47],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,50:[1,165],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,45],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,49:[1,167],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,43],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,48:[1,170],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,171],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Xt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:W},{23:178,73:W},{23:179,73:W},{58:180,104:ct},{23:181,72:[1,182],73:W},{58:183,104:ct},{58:184,104:ct},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(Nt,[2,11]),{13:186,51:z,53:K,54:X},e(Nt,[2,13]),e(Nt,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ct},{58:196,104:ct},{58:197,104:ct},{5:[2,75]},{58:198,104:ct},{23:199,73:W},{5:[2,58]},{5:[2,59]},{23:200,73:W},e(Nt,[2,12]),e(Se,i,{7:124,41:201}),e(Gt,i,{7:126,43:202}),e(we,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Xt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ct},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(N,v){if(v.recoverable)this.trace(N);else{var k=new Error(N);throw k.hash=v,k}},"parseError"),parse:x(function(N){var v=this,k=[0],y=[],G=[null],c=[],mt=this.table,d="",Mt=0,Ne=0,Qe=2,me=1,$e=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Zt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Zt)&&(gt.yy[Zt]=this.yy[Zt]);J.setInput(N,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Qt=J.yylloc;c.push(Qt);var je=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tr(ot){k.length=k.length-2*ot,G.length=G.length-ot,c.length=c.length-ot}x(tr,"popStack");function Pe(){var ot;return ot=y.pop()||J.lex()||me,typeof ot!="number"&&(ot instanceof Array&&(y=ot,ot=y.pop()),ot=v.symbols_[ot]||ot),ot}x(Pe,"lex");for(var st,xt,lt,$t,Lt={},Bt,Tt,ke,Vt;;){if(xt=k[k.length-1],this.defaultActions[xt]?lt=this.defaultActions[xt]:((st===null||typeof st>"u")&&(st=Pe()),lt=mt[xt]&&mt[xt][st]),typeof lt>"u"||!lt.length||!lt[0]){var jt="";Vt=[];for(Bt in mt[xt])this.terminals_[Bt]&&Bt>Qe&&Vt.push("'"+this.terminals_[Bt]+"'");J.showPosition?jt="Parse error on line "+(Mt+1)+`: `+J.showPosition()+` Expecting `+Vt.join(", ")+", got '"+(this.terminals_[st]||st)+"'":jt="Parse error on line "+(Mt+1)+": Unexpected "+(st==me?"end of input":"'"+(this.terminals_[st]||st)+"'"),this.parseError(jt,{text:J.match,token:this.terminals_[st]||st,line:J.yylineno,loc:Qt,expected:Vt})}if(lt[0]instanceof Array&<.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xt+", token: "+st);switch(lt[0]){case 1:k.push(st),G.push(J.yytext),c.push(J.yylloc),k.push(lt[1]),st=null,Ne=J.yyleng,d=J.yytext,Mt=J.yylineno,Qt=J.yylloc;break;case 2:if(Tt=this.productions_[lt[1]][1],Lt.$=G[G.length-Tt],Lt._$={first_line:c[c.length-(Tt||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(Tt||1)].first_column,last_column:c[c.length-1].last_column},je&&(Lt._$.range=[c[c.length-(Tt||1)].range[0],c[c.length-1].range[1]]),$t=this.performAction.apply(Lt,[d,Ne,Mt,gt.yy,lt[1],G,c].concat($e)),typeof $t<"u")return $t;Tt&&(k=k.slice(0,-1*Tt*2),G=G.slice(0,-1*Tt),c=c.slice(0,-1*Tt)),k.push(this.productions_[lt[1]][0]),G.push(Lt.$),c.push(Lt._$),ke=mt[k[k.length-2]][k[k.length-1]],k.push(ke);break;case 3:return!0}}return!0},"parse")},Ze=(function(){var ut={EOF:1,parseError:x(function(v,k){if(this.yy.parser)this.yy.parser.parseError(v,k);else throw new Error(v)},"parseError"),setInput:x(function(N,v){return this.yy=v||this.yy||{},this._input=N,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:x(function(){var N=this._input[0];this.yytext+=N,this.yyleng++,this.offset++,this.match+=N,this.matched+=N;var v=N.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),N},"input"),unput:x(function(N){var v=N.length,k=N.split(/(?:\r\n?|\n)/g);this._input=N+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),k.length-1&&(this.yylineno-=k.length-1);var G=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===y.length?this.yylloc.first_column:0)+y[y.length-k.length].length-k[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[G[0],G[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:x(function(){return this._more=!0,this},"more"),reject:x(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:x(function(N){this.unput(this.match.slice(N))},"less"),pastInput:x(function(){var N=this.matched.substr(0,this.matched.length-this.match.length);return(N.length>20?"...":"")+N.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:x(function(){var N=this.match;return N.length<20&&(N+=this._input.substr(0,20-N.length)),(N.substr(0,20)+(N.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:x(function(){var N=this.pastInput(),v=new Array(N.length+1).join("-");return N+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/sizeCapture-INFHLROL-tpuKIw98.js b/amplifier_web/static/assets/sizeCapture-INFHLROL-CKc8uScH.js similarity index 87% rename from amplifier_web/static/assets/sizeCapture-INFHLROL-tpuKIw98.js rename to amplifier_web/static/assets/sizeCapture-INFHLROL-CKc8uScH.js index f68ede3f1..c55e5a23e 100644 --- a/amplifier_web/static/assets/sizeCapture-INFHLROL-tpuKIw98.js +++ b/amplifier_web/static/assets/sizeCapture-INFHLROL-CKc8uScH.js @@ -1 +1 @@ -import{_ as n}from"./mermaid.core-CDlaSEyP.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var c=1;function a(){if(!(typeof globalThis>"u"))return globalThis}n(a,"getCaptureGlobal");function m(){var o;return!!((o=a())!=null&&o.mermaidCaptureSizes)}n(m,"shouldCaptureSizes");function d(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}n(d,"capturedFromLocation");function s(o,r){const e=a();if(!e)return;const t=r.node(),i=(t&&"ownerSVGElement"in t?t.ownerSVGElement:null)??t,p=(i==null?void 0:i.id)??"(unknown)";e.mermaidCapturedSizes??(e.mermaidCapturedSizes=[]);const u={svgId:p,sizes:o};e.mermaidCapturedSizes.push(u),e.mermaidLastCapturedSizes=u}n(s,"emitCapturedSizes");function l(o,r){const e=[];for(const t of r.nodes)t.isGroup||e.push({id:t.id,width:t.width??0,height:t.height??0});e.length!==0&&s({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:d()},nodes:e},o)}n(l,"captureNodeSizes");export{l as captureNodeSizes,m as shouldCaptureSizes}; +import{_ as n}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var c=1;function a(){if(!(typeof globalThis>"u"))return globalThis}n(a,"getCaptureGlobal");function m(){var o;return!!((o=a())!=null&&o.mermaidCaptureSizes)}n(m,"shouldCaptureSizes");function d(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}n(d,"capturedFromLocation");function s(o,r){const e=a();if(!e)return;const t=r.node(),i=(t&&"ownerSVGElement"in t?t.ownerSVGElement:null)??t,p=(i==null?void 0:i.id)??"(unknown)";e.mermaidCapturedSizes??(e.mermaidCapturedSizes=[]);const u={svgId:p,sizes:o};e.mermaidCapturedSizes.push(u),e.mermaidLastCapturedSizes=u}n(s,"emitCapturedSizes");function l(o,r){const e=[];for(const t of r.nodes)t.isGroup||e.push({id:t.id,width:t.width??0,height:t.height??0});e.length!==0&&s({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:d()},nodes:e},o)}n(l,"captureNodeSizes");export{l as captureNodeSizes,m as shouldCaptureSizes}; diff --git a/amplifier_web/static/assets/stateDiagram-D77RDMKH-DYtq5BDk.js b/amplifier_web/static/assets/stateDiagram-D77RDMKH-sy7Rfo0f.js similarity index 96% rename from amplifier_web/static/assets/stateDiagram-D77RDMKH-DYtq5BDk.js rename to amplifier_web/static/assets/stateDiagram-D77RDMKH-sy7Rfo0f.js index db4fbca59..70ee9388e 100644 --- a/amplifier_web/static/assets/stateDiagram-D77RDMKH-DYtq5BDk.js +++ b/amplifier_web/static/assets/stateDiagram-D77RDMKH-sy7Rfo0f.js @@ -1 +1 @@ -import{s as G,a as P,S as N}from"./chunk-IMKFNOWR-CF8hlUB5.js";import{_ as f,c as t,j as H,l as S,d as W,P as _,k as z,Q as U,R as C,M as F,x as O}from"./mermaid.core-CDlaSEyP.js";import{l as J}from"./layout-KwbWDr7K.js";import"./chunk-XXDRQBXY-BvgnYF8f.js";import"./chunk-POPQ4Y6H-fljvmLmW.js";import"./chunk-F27PBJKO-D9qW0VD2.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),j=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),q=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Q=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
");p=p.replace(/\n/g,"
");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),Z=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Q(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&j(n),(i.type==="fork"||i.type==="join")&&q(n,i),i.type==="note"&&Z(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),R=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=U().x(function(s){return s.x}).y(function(s){return s.y}).curve(C),p=e.append("path").attr("d",l(n)).attr("id","edge"+R).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=F(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=O.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}R++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;W(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},ht={parser:P,get db(){return new N(1)},renderer:it,styles:G,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ht as diagram}; +import{s as G,a as P,S as N}from"./chunk-IMKFNOWR-D_IoXv7y.js";import{_ as f,c as t,j as H,l as S,d as W,P as _,k as z,Q as U,R as C,M as F,x as O}from"./mermaid.core-BQ5lTCZr.js";import{l as J}from"./layout-xx7K6ykp.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),j=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),q=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Q=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
");p=p.replace(/\n/g,"
");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),Z=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Q(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&j(n),(i.type==="fork"||i.type==="join")&&q(n,i),i.type==="note"&&Z(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),R=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=U().x(function(s){return s.x}).y(function(s){return s.y}).curve(C),p=e.append("path").attr("d",l(n)).attr("id","edge"+R).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=F(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=O.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}R++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;W(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},ht={parser:P,get db(){return new N(1)},renderer:it,styles:G,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ht as diagram}; diff --git a/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js b/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js new file mode 100644 index 000000000..c5367fec1 --- /dev/null +++ b/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js @@ -0,0 +1 @@ +import{s as r,b as e,a,S as s}from"./chunk-IMKFNOWR-D_IoXv7y.js";import{_ as i}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CFM38Jht.js b/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CFM38Jht.js deleted file mode 100644 index ba365a686..000000000 --- a/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CFM38Jht.js +++ /dev/null @@ -1 +0,0 @@ -import{s as r,b as e,a,S as s}from"./chunk-IMKFNOWR-CF8hlUB5.js";import{_ as i}from"./mermaid.core-CDlaSEyP.js";import"./chunk-XXDRQBXY-BvgnYF8f.js";import"./chunk-POPQ4Y6H-fljvmLmW.js";import"./chunk-F27PBJKO-D9qW0VD2.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/amplifier_web/static/assets/swimlanes-42K2YHIH-Ef_o-11t.js b/amplifier_web/static/assets/swimlanes-42K2YHIH-1QzInuS-.js similarity index 99% rename from amplifier_web/static/assets/swimlanes-42K2YHIH-Ef_o-11t.js rename to amplifier_web/static/assets/swimlanes-42K2YHIH-1QzInuS-.js index 4c54f44b8..e92fd6214 100644 --- a/amplifier_web/static/assets/swimlanes-42K2YHIH-Ef_o-11t.js +++ b/amplifier_web/static/assets/swimlanes-42K2YHIH-1QzInuS-.js @@ -1 +1 @@ -import{ap as Tr,l as Ln,_ as d,aA as No}from"./mermaid.core-CDlaSEyP.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var Oo=5,ze=1e-5,Ve=1e-6;function Je(t){const e=[];for(let n=0;n=1-Ve||I<=Ve||I>=1-Ve?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:I}}d(Do,"segmentIntersection");function En(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(En,"isHorizontalSeg");function Ho(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Xo,"getArcSweepFlag");var Ar=.001;function Yo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&No[e.arrowTypeStart];if(o){const r=t[0],f=t[1],a=Math.atan2(f.y-r.y,f.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&No[e.arrowTypeEnd];if(s){const r=t.length,f=t[r-2],a=t[r-1],l=Math.atan2(a.y-f.y,a.x-f.x);n[r-1].x=a.x-s*Math.cos(l),n[r-1].y=a.y-s*Math.sin(l)}return n}d(Yo,"applyMarkerOffsets");function Go(t,e,n,o,s){const r=t.point.x,f=t.point.y,a={x:r-e*t.r,y:f-n*t.r},l={x:r+e*t.r,y:f+n*t.r},c=[`L${Oe(a)}`];return s==="arc"?c.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(l)}`):c.push(`M${Oe(l)}`),c}d(Go,"emitJump");function Tn(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=n.x-e.x,a=n.y-e.y,l=Math.hypot(s,r),c=Math.hypot(f,a);if(l0){const v=Tn(s[c-1],s[c],s[c+1]??s[c],Oo);v&&(i=v.cutLen)}let x=p,C=null;r&&cv.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-i,x-v.d);for(let v=0;vL){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r=2?o:null}catch{return null}}d(jo,"decodeDataPoints");function Uo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const c of e)s.set(c.id,c);const r=[],f=new Map;for(const c of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(c.id):c.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;f.set(c.id,p);const u=jo(p.getAttribute("data-points"))??c.points;r.push({...c,points:u})}const a=Ho(r);if(a.length===0)return;const l=new Map;for(const c of a){const g=l.get(c.jumpEdgeId)??[];g.push(c),l.set(c.jumpEdgeId,g)}for(const c of r){const g=l.get(c.id);if(!g||g.length===0)continue;const p=s.get(c.id),I=p==null?void 0:p.curve;if(I!==void 0&&!Vo(I))continue;const u=f.get(c.id);if(!u)continue;if(I===void 0){const v=u.getAttribute("d")??"";if(!zo(v))continue}const h=u.getAttribute("style")??"",i=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=i?Number.parseFloat(i[1]):null,C=i?Number.parseFloat(i[2]):null,b=$o(c,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,M=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",M)}}}d(Uo,"applyLineJumpsToSvg");function Wo(t,{measure:e}){var r,f;const n=(f=(r=t.config)==null?void 0:r.swimlane)==null?void 0:f.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(a=>Array.isArray(a.points)&&a.points.length>=2).map(a=>({id:a.id,points:a.points,curve:a.curve,arrowTypeStart:a.arrowTypeStart,arrowTypeEnd:a.arrowTypeEnd}));Uo(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}d(Wo,"applySwimlaneLineJumps");var In="__swimlane_default__",wr=21,Po=20;function An(t){return Math.max(t.padding??Po,Po)}d(An,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const f=n-s/2,a=Math.min(r,n+s/2),l=Math.min(wr,Math.max(0,a-f)),c=f+l;if(c<=f){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:f,bottom:c}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===In);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:In,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=In}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const l of t.nodes??[])e.set(l.id,l);const n=[];for(const l of t.edges??[]){const c=typeof l.start=="string"?l.start:void 0,g=typeof l.end=="string"?l.end:void 0;!c||!g||l.labelNodeId||n.push({id:l.id,src:c,dst:g,ref:l})}const o=t.nodes??[],s=o.filter(l=>l.isGroup),r=o.filter(l=>!l.isGroup);return{nodes:[...[...s].reverse(),...r].map(l=>l.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,f=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let l=0;for(const I of e.layers){let u=0;for(const h of I){const i=r.get(h);if(!i){u++;continue}i.layer=l,i.order=u;const x=n.x[h]??u*a,C=n.y[h]??l*f;i.x=x,i.y=C,u++}l++}const c=s.nodes??[],g=new Map,p=[];for(const I of c){if(!(I!=null&&I.isGroup))continue;I.parentId||p.push(I);const u=c.filter(b=>b.parentId===I.id);let h=1/0,i=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,M=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),i=Math.max(i,v+y/2),x=Math.min(x,L-M/2),C=Math.max(C,L+M/2))}if(h===1/0||x===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const b=I.padding??20,v=I.parentId?b:2*An(I),L=b,y=Math.max(0,i-h)+v,M=Math.max(0,C-x)+L,E=(h+i)/2,w=(x+C)/2;I.x=E,I.y=w,I.width=y,I.height=M,g.set(I.id,{minX:h,maxX:i,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let I=1/0,u=-1/0,h=0;for(const i of p){const x=i.padding??20;x>h&&(h=x);const C=g.get(i.id);C&&(I=Math.min(I,C.minY),u=Math.max(u,C.maxY))}if(I!==1/0&&u!==-1/0){const i=Math.max(0,u-I),C=Math.max(h,36),b=i+2*C,v=(I+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=I;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],M=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*An(B),H=(O.minX+O.maxX)/2;y.push(B.id),M.push(H),E.push(k)}const w=y.length;if(w>0){const B=new Map;if(w===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(ro,"measuredNodeRect");function io(t){if(t.isGroup)return;const e=ro(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(io,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&>(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function co(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(co,"classifyThreeSegmentRoute");function an(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),f=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&fe.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Ze(t,e){return t.lefte.left&&t.tope.top}d(Ze,"rectsOverlap");function wn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(wn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=ro(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Le,"portForRectSide");function lo(t,e,n,o,s,r=Yt){const f=e==="left"||e==="right",a=o==="left"||o==="right";if(f&&a){if(e==="right"&&o==="left"&&t.xn.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!f&&!a){if(e===o){if(gt(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(f&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const l=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return l&&c?[t,{x:t.x,y:n.y},n]:void 0}d(lo,"buildOrthogonalPortPath");function fo(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(fo,"buildSameSideTrackPath");function ln(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=io(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(ln,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=io(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,f=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,f,a)})}return n}d(es,"collectLayoutNodeRects");function uo(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),f=e.get(s);if(!(!r||!f))return{srcId:o,dstId:s,srcInfo:r,dstInfo:f,collinearX:Math.abs(r.cx-f.cx)h||IC)return!1;const b=Math.abs(i-g.a.x)s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Qe(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const f of n){if(f===o||f.isLayoutOnly)continue;const a=f.points;if(!(!a||a.length<2))for(let l=0;lI+s&&hi+s&&po+Yt&&t=2?e[e.length-2]:void 0,l=(f?gt(f,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(l)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(tn,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Nr=.5,Bo=4;function go(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const f=rs(t[s],t[r],e);return n?[f,...t.slice(s)]:[...t.slice(0,s+1),f]}d(Nn,"clipEndpoint");function is(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Nn(s,o.srcRect,!0)),o.dstRect&&(s=Nn(s,o.dstRect,!1)),s=ue(tn(s)),s=mo(s,o.srcRect,o.dstRect),o.edge.points=ue(tn(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function On(t,e,n,o=!1){if(yt(t,e,it)){if(e.yn.bottom+it)return e;if(o){if(t.xn.right+it)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(gt(t,e,it)){if(e.xn.right+it)return e;if(o){if(t.yn.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(On,"snapEndpointToBoundary");function en(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function Bn(t,e){return e==="left"||e==="right"?nn(t.top,t.bottom):nn(t.left,t.right)}d(Bn,"clearanceRangeForSide");function on(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function kn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const f=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,f));if(!(Math.abs(a-f)({...a}));for(let a=e;a>=0&&a=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)o.bottom+it;case"left":return yt(e,n,it)&&n.xo.right+it}}d(Dn,"leavesOutward");function Hn(t,e,n){if(t.length<3)return t;if(n){const r=_n(t[0],t[1],e);return r&&Dn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=_n(t[o-1],t[o],e);return s&&Dn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Hn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=en(o,0,1);if(r){const f=On(r,o[0],e);f!==o[0]&&(o=[f,...o.slice(1)])}o=Hn(o,e,!0)}if(n){const r=o.length-1,f=en(o,r,-1);if(f){const a=On(f,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Hn(o,n,!1)}const s=mo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Fn(o,e,!0)),n&&(o=Fn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Xn(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const f=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=f}}d(Xn,"prepareEdgeEndpointsForRenderer");function yo(t){return new Map(t.map(e=>[e.id,e]))}d(yo,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Yn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d(Yn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const f=r.x,a=r.y;if(typeof f!="number"||typeof a!="number")continue;const l=r.width??0,c=r.height??0;e=Math.min(e,f-l/2),n=Math.max(n,f+l/2),o=Math.min(o,a-c/2),s=Math.max(s,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=yo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Yn(s,e)-Yn(o,e));for(const o of n){const s=t.filter(f=>f.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function sn(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup);let r=1/0,f=-1/0;for(const l of s){const c=l[e];typeof c=="number"&&(r=Math.min(r,c),f=Math.max(f,c))}if(!Number.isFinite(r)||!Number.isFinite(f))return!1;const a=d(l=>r+f-l,"mirror");for(const l of n){const c=l[e];typeof c=="number"&&(l[e]=a(c));const g=l.groupTitleRect;g&&(l.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const l of o)for(const c of l.points??[])c[e]=a(c[e]);return!0}d(sn,"mirrorAxis");function ms(t){return(t.nodes??[]).some(n=>!n.isGroup)?sn(t,"y"):!0}d(ms,"applyBtDirectionTransform");function ys(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,f=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-f)*I+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-f)*I+a,Mt=j-r;G.x=ft,G.y=Mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&sn(t,"x"),!0;const h=yo(n),i=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,h);if(!G)continue;const j=i.get(G)??[];j.push(P),i.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=i.get(P.id)??[],j=po(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),M=L+2*y,E=a+M,O=(b+v)/2-M/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?C.bottom:C.top,H=I.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>I.cx?C.right:C.left,H=I.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const M=ce(v,L,ae),E=ce(L,y,ae);if(M&&E||!M&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const w=!M&&Qe(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&Qe(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(w||B)){M?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(ps,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<4)continue;const c=xt(l,.001);if(c.length<4)continue;const g=c.length-1,p=c[g],I=c[g-1],u=c[g-2],h=p.x-I.x,i=p.y-I.y,x=Math.hypot(h,i);if(x>=10||x<.001)continue;const C=I.x-u.x,b=I.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(I,p,.001),y=Ot(I,p,.001),M=Nt(u,I,.001),E=Ot(u,I,.001);if(!(L&&E||y&&M))continue;const w=a.end,B=a.start,O=w?e.get(w):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,w?[w]:[],-2)||Pt(G,j,f,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&ao(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St=0){const J=c[g-3],rt=[B,w].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const _t=[...c.slice(0,g-2),G,j];a.points=_t;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,At=-1;for(let Kt=0;Kt<_t.length-1;Kt++){const qt=_t[Kt],Jt=_t[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>At&&(At=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(xs,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Sn=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function bs(t,e){const s=d((u,h)=>{const i=u.x??0,x=u.y??0,C=h.x-i,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:i+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:i+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const i=xt(u.points??[]);if(i.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?i[0]:i[i.length-1],L=h?i[1]:i[i.length-2],y=s(C,v);let M=v;if(Sn(L,y)&&(M=L),gt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,M.y),max:Math.max(y.y,M.y),boundary:y,railEnd:M,rect:b};if(yt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,M.x),max:Math.max(y.x,M.x),boundary:y,railEnd:M,rect:b}},"terminalLaneFor"),f=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&>(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),l=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:f(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),c=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const i=f(u,h);if(i2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const i=xt(u.edge.points??[]);if(i.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const M=i.length>1&&ce(i[1],u.railEnd,et),E=i.slice(M?2:1),w=E[0];return w&&!Sn(w,C)?void 0:[x,C,...E]}const v=i.length>1&&ce(i[i.length-2],u.railEnd,et),L=i.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Sn(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,i=xt(h.points??[]);if(i.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,M=v.x??0,E=v.y??0,[w,B]=i;return yt(w,B,et)&&Math.abs(y-E)<1&&Math.abs(L-M)>1||gt(w,B,et)&&Math.abs(L-M)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let i=!1;for(let x=0;x{const w=p(M),B=p(E);return w!==B?Number(w)-Number(B):+!E.atStart-+!M.atStart});for(const M of y){for(const E of I){const w=g(M,E);if(!w)continue;const B=r({...M.edge,points:w},M.atStart);if(!(!B||h.some(O=>O.edge!==M.edge&&(l(B,O)||L&&c(B,O))))){M.edge.points=w,i=!0;break}}if(i)break}}if(!i)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,l)=>{const c=a.start,g=a.end,p=at(l);if(p.length!==l.length-1)return!1;const I=[c,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,I,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const i of p)for(const x of at(xt(h)))if(de(i,x,.5)>=Xt||he(i.a,i.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),f=d((a,l)=>{if(l+4>=a.length)return;const c=a[l],g=a[l+1],p=a[l+2],I=a[l+3],u=a[l+4],h=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&>(c,I,et)&>(c,u,et)&>(g,p,et)&&(g.x-c.x)*(I.x-p.x)<0,i=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&yt(c,I,et)&&yt(c,u,et)&&yt(g,p,et)&&(g.y-c.y)*(I.y-p.y)<0;if(h||i)return xt([...a.slice(0,l+1),u,...a.slice(l+5)]);if(l+5>=a.length)return;const x=a[l+5],C=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&Ot(u,x)&>(c,u,et)&>(c,x,et)&>(p,I,et)&&(p.x-g.x)*(u.x-I.x)<0,b=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&&Nt(u,x)&&yt(c,u,et)&&yt(c,x,et)&&yt(p,I,et)&&(p.y-g.y)*(u.y-I.y)<0;if(!(!C&&!b))return xt([...a.slice(0,l+1),x,...a.slice(l+6)])},"withoutDogleg");for(let a=0;a<8;a++){let l=!1;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(let p=0;p<=g.length-5;p++){const I=f(g,p);if(!(!I||!r(c,I))){c.points=I,l=!0;break}}if(l)break}if(!l)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Gn(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),l=d((h,i,x)=>xt(h===i?x??[]:h.points??[]),"pointsFor"),c=d((h,i)=>{let x=0;for(let C=0;C{const i=at(h);if(i.length!==3)return;const x=i[1];if(!(i[0].horizontal===x.horizontal||i[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return i.horizontal?Wt(i.a.x,i.b.x,b.left,b.right)>=Xt&&i.a.y>=b.top-2&&i.a.y<=b.bottom+2:Wt(i.a.y,i.b.y,b.top,b.bottom)>=Xt&&i.a.x>=b.left-2&&i.a.x<=b.right+2})},"blockingRectsFor"),I=d((h,i,x)=>{const C=h.map(v=>({...v}));if(i.horizontal)C[i.index].y=x,C[i.index+1].y=x;else if(i.vertical)C[i.index].x=x,C[i.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,i,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(i);if(b.length!==i.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,f,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(l(v)))if(de(L,y,.5)>=Xt)return!1}return c(h,i)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const i=c();let x=!1;for(const C of a){const b=l(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(M=>M.rect.top))-20,Math.max(...L.map(M=>M.rect.bottom))+20]:[Math.min(...L.map(M=>M.rect.left))-20,Math.max(...L.map(M=>M.rect.right))+20];for(const M of y){const E=I(b,v.segment,M);if(!(!E||!u(C,E,i))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(Gn,"liftObstacleHuggingSameSideRails");function $n(t,e){const o=d(l=>{const c=l.groupTitleRect;if(!(!c||typeof c.left!="number"||typeof c.right!="number"||typeof c.top!="number"||typeof c.bottom!="number"||!Number.isFinite(c.left)||!Number.isFinite(c.right)||!Number.isFinite(c.top)||!Number.isFinite(c.bottom)||c.right<=c.left||c.bottom<=c.top))return{left:c.left,right:c.right,top:c.top,bottom:c.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId)return;const c=l.direction,g=typeof c=="string"?c.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(l),I=l.y,u=l.height;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(i<=0||h{if(!l.horizontal)return!1;const g=l.a.y;return g<=c.top+et||g>=c.bottom-et?!1:Wt(l.a.x,l.b.x,c.left,c.right)>=Xt},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(l=>!!l);if(f.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const c=xt(l.points??[]);for(const g of at(c))for(const p of f)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const l of f){const c=l.node.y,g=l.node.height;typeof c!="number"||typeof g!="number"||!Number.isFinite(c)||!Number.isFinite(g)||g<=0||(l.node.y=c-a/2,l.node.height=g+a,l.node.groupTitleRect={...l.rect,top:l.rect.top-a,bottom:l.rect.bottom-a})}}d($n,"liftTopLaneTitleBandsAboveRails");function zn(t,e){const o=d(c=>{const g=c.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId||c.direction!=="LR")return;const p=o(c),I=c.x,u=c.width;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(h<=0||i{if(!c.vertical)return!1;const p=c.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(c.a.y,c.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),f=d((c,g)=>{if(!c.horizontal)return!1;const p=c.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(c.a.x,c.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(c=>!!c);if(a.length===0)return;let l=0;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(const p of at(g))for(const I of a)if(r(p,I.rect))l=Math.max(l,I.rect.right-p.a.x+4);else if(f(p,I.rect)){const u=Math.min(p.a.x,p.b.x);l=Math.max(l,I.rect.right-u+4)}}if(!(l<=et))for(const c of a){const g=c.node.x,p=c.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(c.node.x=g-l/2,c.node.width=p+l,c.node.groupTitleRect={...c.rect,left:c.rect.left-l,right:c.rect.right-l})}}d(zn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,i=new Map)=>xt(i.get(h)??h.points??[]),"replacementPointsFor"),f=d((h=new Map)=>{let i=0;for(let x=0;xs.reduce((i,x)=>i+oe(r(x,h)),0),"totalBends"),l=d(h=>{const i=r(h);if(i.length<4)return;const x=i[i.length-2],C=i[i.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),c=d((h,i)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:i.tailStart.y};else if(Ot(C,b,et))v={x:i.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,i.tailStart,i.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(i))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,i,x)=>{for(const C of s)if(C!==h){for(const b of at(i))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),I=d((h,i,x)=>!g(h,i)&&!p(h,i,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const i of s){const x=i.end;if(!x||!e.has(x)||r(i).length<4)continue;const b=h.get(x)??[];b.push(i),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const i=f();if(i===0)return;const x=a();let C,b=i,v=x;for(const L of u().values())for(let y=0;y=i||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),l=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),c=d((L=new Map)=>{let y=0;for(let M=0;Ma.reduce((y,M)=>y+oe(l(M,L)),0),"totalBends"),p=d(L=>{const y=L.start,M=L.end,E=y?e.get(y):void 0,w=M?e.get(M):void 0,B=E?te(E):void 0,O=w?te(w):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),I=d((L,y,M)=>{if(M.index<=0||M.index+1>=y.length-1)return;const E=p(L);if(E){if(M.vertical){const w=M.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=wO+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"vertical",side:k,coord:w,min:Math.min(M.a.y,M.b.y),max:Math.max(M.a.y,M.b.y)}:void 0}if(M.horizontal){const w=M.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=wO+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"horizontal",side:k,coord:w,min:Math.min(M.a.x,M.b.x),max:Math.max(M.a.x,M.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const M=l(y);for(const E of at(M)){const w=I(y,M,E);w&&L.push(w)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),i=d(L=>{const y=[],M=new Set;for(const E of L){if(M.has(E))continue;const w=[E],B=[];for(M.add(E);w.length>0;){const O=w.pop();B.push(O);for(const k of L)!M.has(k)&&h(O,k)&&(M.add(k),w.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const M of L)y.some(E=>Math.abs(E-M.coord){const y=L.map(w=>w.coord),M=x(L),E=[];if(L.length<=6){const w=new Array(M.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of M.entries())w[k]||(w[k]=!0,B.push(H),O(),B.pop(),w[k]=!1)},"visit");return O(),E}for(let w=0;w{const M=new Map;for(const[w,B]of L.entries()){const O=y[w],k=M.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),M.set(B.edge,k)}const E=new Map;for(const[w,B]of M){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(w,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,M]of L){const E=[y.start,y.end].filter(w=>!!w);for(const w of at(M))if(Pt(w.a,w.b,r,E,-2)||Pt(w.a,w.b,f,[],-2))return!1}for(let y=0;y=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=c();if(y===0)return;let M,E=y,w=g(),B=Number.POSITIVE_INFINITY;for(const O of i(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=c(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>w||G===w&&j>=B)||(M=H,E=P,w=G,B=j)}if(!M)return;for(const[O,k]of M)O.points=k}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),f=d((u,h,i)=>xt(u===h?i??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,i)=>{const x=i.a.x-i.b.x,C=i.a.y-i.b.y;return h+Math.hypot(x,C)},0),"pathLength"),l=d((u,h)=>{let i=0;for(let x=0;x{if(u.horizontal){const i=u.a.y;return(Math.abs(i-h.top)<1||Math.abs(i-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const i=u.a.x;return(Math.abs(i-h.left)<1||Math.abs(i-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),i=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&i.push(b)}return i},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const i=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(i,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(i,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-i.x)!==Math.sign(b.x-C.x):Math.sign(x.y-i.y)!==Math.sign(b.y-C.y)))return[];const M=gt(i,b,et)||yt(i,b,et)?[]:[{x:i.x,y:b.y},{x:b.x,y:i.y}],E=M.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:M.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),w=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return w.has(O)?!1:(w.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,h,i)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>c(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(f(b)))if(de(v,L,.5)>=Xt)return!1}return l(u,h)<=i},"candidateIsSafe");for(let u=0;u<8;u++){const h=l();let i,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=f(L),M=oe(y,et),E=a(y);for(let w=0;w<=y.length-4;w++)for(const B of p(y,w)){const O=oe(B,et),k=a(B);if(!(OC||P===C&&(O>b||O===b&&k>=v)||(i=L,x=B,C=P,b=O,v=k)}}if(!i||!x)return;i.points=x}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const f=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const F=R.x??0,_=R.y??0,V=te(R);V&&f.push({id:String(R.id??""),cx:F,cy:_,rect:V})}if(f.length===0)return;const a=new Map(f.map(R=>[R.id,R])),l=f.map(R=>({id:R.id,rect:R.rect})),c=["top","bottom","left","right"],g={top:Math.min(...f.map(R=>R.rect.top))-20,bottom:Math.max(...f.map(R=>R.rect.bottom))+20,left:Math.min(...f.map(R=>R.rect.left))-20,right:Math.max(...f.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),I=new Map(p.map((R,F)=>[R,F])),u=d(R=>{const F=R==="left"||R==="top"?-1:1,_=[];for(let V=0;V<=2;V++)_.push(g[R]+F*20*V);return _},"outwardTracksForSide"),h=d((R,F=new Map)=>xt(F.get(R)??R.points??[]),"replacementPointsFor"),i=d((R,F)=>{let _=0;for(const V of R)for(const K of F)he(V.a,V.b,K.a,K.b,et)&&_++;return _},"crossingCountBetweenSegments"),x=d((R,F)=>i(at(R),at(F)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let F=0;const _=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y0&&(F+=T,_.push({first:q,second:A,count:T}),Z(q),Z(A))}}return K.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),{count:F,pairs:_,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,F)=>{const _=new Set(F.keys());if(_.size===0)return R.count;let V=0;for(const Z of R.pairs)(_.has(Z.first)||_.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z{const F=new Map;for(const K of R.pairs){const Z=F.get(K.first)??new Set;Z.add(K.second),F.set(K.first,Z);const Y=F.get(K.second)??new Set;Y.add(K.first),F.set(K.second,Y)}const _=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of F.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(I.get(q)??0)-(I.get(m)??0)),Y.length>1&&_.push(Y)}return _},"crossingComponents"),L=d(R=>[R.start,R.end].filter(F=>!!F),"endpointIdsFor"),y=d(R=>{const F=[];for(const _ of v(R)){const V=new Set(_),K=new Set(_.flatMap(Y=>L(Y))),Z=[..._];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),F.push(Z)}return F},"pairSearchGroups"),M=d((R,F,_)=>b(R,new Map([[F,_]])),"crossingCountWithSingleReplacement"),E=d(R=>{const F=new Map;for(const _ of R.pairs)F.set(_.first,(F.get(_.first)??0)+_.count),F.set(_.second,(F.get(_.second)??0)+_.count);return F},"currentCrossingsByEdge"),w=d(R=>R.slice(1).reduce((F,_,V)=>{const K=R[V];return F+Math.abs(_.x-K.x)+Math.abs(_.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((F,_)=>F+oe(h(_,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((F,_)=>F+w(h(_,R)),0),"totalLength"),k=d((R,F,_=new Map)=>{const V=at(F);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,_)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,F)=>{const _=[R.start,R.end].filter(V=>!!V);for(const V of at(F))if(Pt(V.a,V.b,l,_,-2))return!0;return!1},"pathHitsNode"),P=d((R,F)=>{const _=ue(xt(F));at(_).length===_.length-1&&R.push(_)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,F,_)=>{switch(F){case"left":return Math.min(R.x,_.x)-20;case"right":return Math.max(R.x,_.x)+20;case"top":return Math.min(R.y,_.y)-20;case"bottom":return Math.max(R.y,_.y)+20}},"localTrackForSameSide"),tt=d((R,F,_,V)=>{const K=_==="left"||_==="top"?-1:1,Z=[j(F,_,V),g[_]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,fo(F,_,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:Z,y:F.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:F.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,F,_,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:Y,y:F.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),_t=d((R,F,_,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:F.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const F=new Set;return R.map(_=>xt(_)).filter(_=>{const V=_.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return F.has(V)||_.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,F,_,V)=>{const K=[],Z=lo(R,F,_,V,20,et);Z&&P(K,Z),F===V&&tt(K,R,F,_);const Y=G(F),q=G(V);return Y&&!q?ft(K,R,F,_,V):!Y&&q?Mt(K,R,F,_,V):Y?Ht(K,R,F,_,V):_t(K,R,F,_,V),nt(K)},"buildCandidatesForSides"),rt=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[F,_,{x:S,y:_.y},{x:S,y:q.y},q]);for(const A of m)P(R,[F,_,{x:S,y:_.y},{x:S,y:A},{x:q.x,y:A},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[F,_,{x:_.x,y:S},{x:q.x,y:S},q]);for(const A of m)P(R,[F,_,{x:_.x,y:S},{x:A,y:S},{x:A,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const F=R.start,_=R.end,V=_?a.get(_):void 0;if(!F||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const F=R.start,_=R.end,V=F?a.get(F):void 0,K=_?a.get(_):void 0;if(!V||!K)return[];const Z=[];for(const Y of c){const q=Le(V,Y);for(const m of c)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),At=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,F,_)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=_.get(K)??at(h(K));F.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,F,_,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=i(q,_.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:F.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:w(Y)}}).filter(({crossings:Y})=>Y<=F.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,_),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,F,_,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===F||m.second===F||m.first===V||m.second===V)&&(Y+=m.count);let q=i(_.segments,K.segments);for(const m of p){if(m===F||m===V)continue;const S=Z.get(m)??at(h(m));q+=i(_.segments,S)+i(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,F)=>{for(const _ of R.sharedTrackConflicts)if(_!==F)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,F)=>R.segments.some(_=>F.segments.some(V=>de(_,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,F,_,V)=>se(F,_.edge)&&se(V,R.edge)&&!Ee(F,V),"pairCandidatesAreCompatible"),Te=d((R,F,_,V,K)=>{const Z=Jt(R.current,F.edge,_,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[F.edge,_.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(F.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+_.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(F.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+_.length+K.length}},"scorePairReplacement"),un=d((R,F)=>R.crossings{let K=V;for(const Z of F.candidates)for(const Y of _.candidates){if(!me(F,Z,_,Y))continue;const q=Te(R,F,Z,_,Y);q&&un(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),gn=d(R=>{const F=B(),_=O(),V=At(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,w(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:F,length:_};const A={current:R,currentBends:F,currentLength:_,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const F=C(),_=F.count;if(_===0)return;let V,K,Z=_,Y=Number.POSITIVE_INFINITY;for(const m of F.edges){const S=oe(h(m),et);for(const A of St(m)){const T=H(m,A),N=!T&&k(m,A),D=M(F,m,A),W=oe(A,et);T||N||!(D<_||D===_&&WZ||D===Z&&W>=Y||(V=m,K=A,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=gn(F);if(!q)return;for(const[m,S]of q)m.points=S}}d(vs,"resolveRenderedOrthogonalCrossings");var be=.001,Br=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=ln(e),s=["top","bottom","left","right"],r=20,f={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},a=d((i,x,C,b)=>{const v=[],L=lo(i,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(fo(i,x,C,f[x])),v},"buildOrthogonalPathCandidates"),l=d((i,x)=>{for(let C=0;C{let b=0;const v=Be(i,be),L=x.start,y=x.end;for(const M of t){if(M===x||M.isLayoutOnly)continue;const E=M.start,w=M.end;if(!C&&L&&y&&(E===L||E===y||w===L||w===y))continue;const B=M.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(ho(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Br&&b++}}return b},"pathConflictCount"),g=4,p=d((i,x)=>{const C=Math.abs(i.y-x.rect.top),b=Math.abs(i.y-x.rect.bottom),v=Math.abs(i.x-x.rect.left),L=Math.abs(i.x-x.rect.right);let y="top",M=C;return b{const b=I.get(i)??[];b.push({side:x,edgeId:C}),I.set(i,b)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points??[];if(x.length<1)continue;const C=i.id??"",b=i.start,v=i.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((i,x,C)=>{var b;return((b=I.get(i))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C0){const Mt=c(tt,i,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}c(tt,i)>w||ftG.edgeId!==M));const P=I.get(v);P&&I.set(v,P.filter(G=>G.edgeId!==M)),u(b,p(B[0],L),M),u(v,p(B[B.length-1],y),M)}}}d(Ls,"simplifyDetouredEdges");var Qt=.001,ko=10,Ue=7;function Vn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const f=r.x-s.x,a=r.y-s.y;if(!(Math.abs(f)+Math.abs(a)r&&Ze(t,Es(r)))}d(jn,"labelOverlapsOwnMarker");function Ke(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const i=h.points;if(!(!i||i.length<2))for(let x=0;x{const x=wn(i,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&Ze(x,b))return!0;return!1},"labelOverlapsForeignNode"),c=d((h,i)=>{const x=wn(i,r);for(const C of n)if(C.edgeId!==h&&an(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,i,x)=>l(h,x)||c(i,x),"labelOverlapsAnything"),p=[],I=d(h=>{for(const{id:i,rect:x}of s)if(ts(x,h))return i},"findContainingLane"),u=d((h,i)=>p.some(x=>x.labelId!==h&&Ze(i,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const i=h.labelNodeId;if(!i)continue;const x=e.get(i);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx0?y:L,E=b>=v?"horizontal":"vertical",w=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,At=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==At?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=I(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+f,St=ut.rect.right-b/2-f,At=ut.rect.top+v/2+f,Kt=ut.rect.bottom-v/2-f;if(pt>St||At>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,At,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt{const J=w(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!jn(St.rect,C)&&!u(i,St.rect)&&!g(i,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=w(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const At=j(St);if(At&&!jn(At.rect,C)&&!u(i,At.rect)&&!l(i,At.rect)&&(rt||!c(h.id,At.rect)))return{laneId:At.laneId,anchor:At.anchor}}},"findLaneContainingFallback"),_t=Mt(M)??(M.lengthrt.labelId===i);J>=0?p[J]={labelId:i,rect:nt}:p.push({labelId:i,rect:nt})}}}d(Ke,"anchorLabelsToPolyline");var Cn=1e-6,kr=8,Fo=kr/2,Fr=3;function Un(t,e){return t{const g=Un(a,l);let p=0;const I=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const i=c==="x"?h.w/2:h.h/2;i>p&&(p=i)},"consider");I(f.labelNodeId);for(const u of t){if(u===f||u.isLayoutOnly)continue;const h=u.start,i=u.end;!h||!i||Un(h,i)===g&&I(u.labelNodeId)}return p>0?p+Fr:0},"labelClearanceFor");for(const f of t){if(f.isLayoutOnly)continue;const a=f.points;if(!co(a,Cn))continue;const l=uo(f,n,Cn);if(!l)continue;const{srcId:c,dstId:g,srcInfo:p,dstInfo:I,collinearX:u,collinearY:h}=l;if(u===h)continue;let i,x;if(u){const y=I.cy>p.cy;i={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:I.cx,y:y?I.rect.top:I.rect.bottom}}else{const y=I.cx>p.cx;i={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?I.rect.left:I.rect.right,y:I.cy}}if(Pt(i,x,o,[c,g],1))continue;const b=r(f,c,g,u?"x":"y"),v=b>Fo?b:Fo,L=[0,v,-v];for(const y of L){const M={...i},E={...x};if(u){if(M.x+=y,E.x+=y,M.x<=p.rect.left||M.x>=p.rect.right||E.x<=I.rect.left||E.x>=I.rect.right)continue}else if(M.y+=y,E.y+=y,M.y<=p.rect.top||M.y>=p.rect.bottom||E.y<=I.rect.top||E.y>=I.rect.bottom)continue;if(!Pt(M,E,o,[c,g],1)&&!Qe(M,E,t,f,{epsilon:Cn})){f.points=[M,E];break}}}}d(Ts,"straightenCollinearSiblingDetours");function Wn(t,e){const{realNodeRects:l,labelNodeRects:c}=Me(e.values()),g=d((y,M)=>Be(M,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=M.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const M of t){if(M.isLayoutOnly)continue;const E=M.points;!E||E.length<2||y.push(...g(M,xt(E)))}return y},"allSegments"),I=d((y,M)=>y.horizontal&&M.horizontal?Wt(y.a.x,y.b.x,M.a.x,M.b.x)>=8&&Math.abs(y.a.y-M.a.y)<7:y.vertical&&M.vertical?Wt(y.a.y,y.b.y,M.a.y,M.b.y)>=8&&Math.abs(y.a.x-M.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,M)=>{const E=y.start,w=y.end,B=g(y,M);if(B.length!==M.length-1)return!1;const O=[E,w].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,l,O,-2)||Pt(H.a,H.b,c,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(I(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,M)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const w=E.map(B=>({...B}));if(y.horizontal)w[y.index].y+=M,w[y.index+1].y+=M;else if(y.vertical)w[y.index].x+=M,w[y.index+1].x+=M;else return;return g(y.edge,w).length===w.length-1?w:void 0},"shiftedCandidate"),i=d((y,M)=>({x:y.x??(M.left+M.right)/2,y:y.y??(M.top+M.bottom)/2}),"nodeCenter"),x=d(y=>{const M=y.edge,E=xt(M.points??[]);if(E.length!==4||y.index!==1)return;const w=M.start?e.get(M.start):void 0,B=M.end?e.get(M.end):void 0,O=w?te(w):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!w||!B||!O||!k||H.length===0))return{sourceCenter:i(w,O),targetCenter:i(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,M,E,w,B,O)=>{const k=w.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+M;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,M,E,w,B,O)=>{const k=w.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+M;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,M)=>{const E=x(y);if(E){if(y.vertical)return C(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const M=p();let E=!1;for(let w=0;wP.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(Wn,"nudgeSharedInteriorSubpaths");function As(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=o.x-n.x,a=o.y-n.y,l=s*a-r*f;if(Math.abs(l)<1e-10)return!1;const c=n.x-t.x,g=n.y-t.y,p=(c*a-g*f)/l,I=(c*r-g*s)/l,u=.01;return p>u&&p<1-u&&I>u&&I<1-u}d(As,"segmentsIntersect");function ws(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<2)continue;const c=a.start,g=a.end,p=a.labelNodeId,I=a.id??`${c}->${g}`;for(const u of s)if(!(u.nodeId===c||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h0){const a=o.filter(c=>c.type==="edge-node-overlap").length,l=o.filter(c=>c.type==="edge-edge-crossing").length;Ln.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${l} edge crossing(s)`);for(const c of o)Ln.warn(`[SWIMLANE_VALIDATE] ${c.type}: ${c.detail}`)}return o}d(ws,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ys(t,e)||e==="BT"&&s.length>0&&!ms(t))return;for(const a of o){if(a.isLayoutOnly)continue;const l=a.points;!l||l.length<2||(a.points=ue(tn(l)))}Ls(o,n),Ts(o,n),ps(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Ke(o,r),is(o,r),xs(o,r),Wn(o,r),bs(o,r),Ms(o,r),Gn(o,r),Is(o,r);const f=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ke(o,r),Xn(o,r),Gn(o,r),Ke(o,r),Xn(o,r)},"finalizeRenderedEdges");f(),Wn(o,r),f(),$n(o,r),zn(o,r),$n(o,r),zn(o,r)}d(Rs,"postProcessSwimlaneLayout");function Ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const f=`${r.id}:${r.src}->${r.dst}`;n.has(f)||(n.add(f),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function xo(t,e){return t.edges.filter(n=>n.dst===e)}d(xo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function bo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(bo,"buildSortedSuccessorMap");function Mo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(Mo,"buildInDegreeMap");function Io(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Io,"sortedZeroInDegreeNodes");function fn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(fn,"buildPredecessorSuccessorMaps");function So(t,e,n,o){var f,a;let s=0;for(const l of t.nodes)o!=null&&o.skipGroups&&((f=t.nodeById.get(l))!=null&&f.isGroup)||(s=Math.max(s,n[l]??0));const r=Array.from({length:s+1},()=>[]);for(const l of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(l))!=null&&a.isGroup)||r[Math.max(0,n[l]??0)].push(l);return r}d(So,"buildLayersFromRanks");function _e(t){const e=Mo(t),n=Io(e),o=[],s=bo(t);for(;n.length;){const r=n.shift();o.push(r);for(const f of s.get(r)??[])if(e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0){let a=0;for(;a{if(s-o<=1)return 0;const r=o+s>>1;let f=n(o,r)+n(r,s),a=o,l=r,c=o;for(;a=s||ap.dst===I.dst?p.id.localeCompare(I.id):p.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const I=p.dst;o[I]===0?r(I):o[I]===1&&s.push(p)}o[g]=2},"dfs"),f=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of f)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),l=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:l,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function ge(t){const e=Ps(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function dn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(dn,"buildTopLaneOrder");function vo(t,e){const n=dn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const f of e)!o.has(f)||s.has(f)||(s.add(f),r.push(f));for(const f of n)s.has(f)||r.push(f);return r}d(vo,"resolveTopLaneOrder");var _r={EPSILON:1e-6},rn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},_o={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=fn(n);for(const y of r.values())y.sort((M,E)=>M.localeCompare(E));const f=_e(n)??[...n.nodes].sort((y,M)=>y.localeCompare(M)),a=new Map;for(const[y,M]of f.entries())a.set(M,y);const l=new Map,c=new Map;for(const y of n.nodes)c.set(y,[]);for(const y of f){const M=(r.get(y)??[]).filter(E=>l.has(E));if(M.length>0){const E=ks(y,M,{laneOf:o,rankHint:s,topoIndex:a});l.set(y,E),c.get(E).push(y)}else l.has(y)||l.set(y,null)}for(const y of n.nodes)l.has(y)||l.set(y,null);const g=new Set;for(const y of n.nodes)(l.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,M)=>{const E=a.get(y)??0,w=a.get(M)??0;return E===w?y.localeCompare(M):E-w}),I=Fs(n),u=new Map;for(const[y,M]of I.entries())u.set(y,[...M].sort((E,w)=>E.localeCompare(w)));const h=_s(u),i=Ds(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of i)for(const M of y.nodes){const E=x.get(M);E?E.push(y.id):x.set(M,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const M of c.get(y)??[])L(M);b.push(y)}},"walk");for(const y of p)L(y);for(const y of f)L(y);return{parent:l,children:c,roots:p,componentOf:h,blocks:i,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:f}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,f)=>{var i,x;const a=n.laneOf(r),l=n.laneOf(f),c=a!=null&&a===o,g=l!=null&&l===o;if(c!==g)return c?-1:1;const p=(i=n.rankHint)==null?void 0:i[r],I=(x=n.rankHint)==null?void 0:x[f];if(p!=null&&I!=null&&p!==I)return I-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(f)??0;return u!==h?u-h:r.localeCompare(f)})[0]}d(ks,"chooseParent");function Fs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Fs,"buildAdjacency");function _s(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const f of t.get(r)??[])e.has(f)||s.push(f)}}n++}return e}d(_s,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const f=d((a,l)=>{e.set(a,++r),n.set(a,r);for(const c of t.get(a)??[])c!==l&&(e.has(c)?(e.get(c)??0)<(e.get(a)??0)&&(o.push([a,c]),n.set(a,Math.min(n.get(a)??r,e.get(c)??r))):(o.push([a,c]),f(c,a),n.set(a,Math.min(n.get(a)??r,n.get(c)??r)),(n.get(c)??0)>=(e.get(a)??0)&&s.push(Hs(a,c,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||f(a,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const f=n.pop();if(s.push(f),r.add(f[0]),r.add(f[1]),f[0]===t&&f[1]===e||f[0]===e&&f[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,f=new Array(r).fill(-1),a=new Array(r).fill(0),l=[],c=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(f[L]=-1,a[L]=0,c.has(b)||(c.add(b),l.push(b)))}for(;l.length>0;){const b=l.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(c.has(y))continue;const M=s.get(y);M!=null&&(f[M]=v,a[M]=a[v]+1,c.add(y),l.push(y))}}for(const b of o){if(c.has(b))continue;const v=s.get(b);v!=null&&(f[v]=-1,a[v]=0,c.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b{if(b===-1||v===-1)return-1;a[b]>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const M=p[y][b],E=p[y][v];M===-1||E===-1||M!==E&&(b=M,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],M=e[L];if(y==null||M==null||(y>M&&([v,L]=[L,v],[y,M]=[M,y]),y==null||M==null||y===M))continue;const E=s.get(v),w=s.get(L);if(E==null||w==null)continue;const B=I(E,w);if(B===-1)continue;const O=u[B];for(let k=y;k{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,M=n.children.get(b)??[];for(const E of M){const w=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=w.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}i(y,w)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let f=n[r]??0;const a=[...e.get(r)??[]];a.sort(Lo(n));for(const l of a){s(l);const c=o.get(l);c!=null&&(f=Math.min(f,c))}o.set(r,f)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Lo(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Lo,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const l of e){const c=n[l]??0;c>s&&(s=c)}const r=Array.from({length:s+1},()=>[]),f=new Set,a=d(l=>{if(f.has(l))return;f.add(l);const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l);for(const g of o(l))a(g)},"emit");for(const l of t)a(l);for(const l of e)if(!f.has(l)){const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l),f.add(l)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const f=e[s]??0,a=[],l=[],c=n.get(s);for(const g of r){const p=o.get(g)??f;p>f?a.push({child:g,min:p}):l.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),l.sort((g,p)=>{const I=(c==null?void 0:c.get(g))??0,u=(c==null?void 0:c.get(p))??0;if(I!==u)return I-u;const h=o.get(g)??f,i=o.get(p)??f;return h!==i?h-i:g.localeCompare(p)}),[...a.map(g=>g.child),...l]}}d(zs,"createChildOrderer");function cn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const f=Xs(t,e,o),a=[...r].sort(Lo(e)),l=Ys(a,s,e),c=zs(s,e,f,l);let g=Gs(a,t.nodes,e,c);return g=$s(g),g}d(cn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),f=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&f.push(r.get(a.dst));return Co(f)}d(Vs,"countCrossingsBetweenAdjacent");function Kn(t,e,n){const o=[];for(const r of e){const f=n[r.src],a=n[r.dst];if(f==null||a==null||f===a)continue;let l=r.src,c=r.dst,g=f,p=a;f>a&&(l=r.dst,c=r.src,g=a,p=f);for(let I=g;I(n[I]??0)-(n[p]??0));for(const p of g){const I=n[p]??0;if(I===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=I)continue;const h=I;n[p]=u;const i=cn(t,n,s),x=Kn(i,t.edges,n);x(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const f=t.edges.filter(i=>i.src===s);if(f.length===0)continue;let a=!1,l=0;for(const i of f){const x=n(i.dst);x==null||x===r?a=!0:l++}if(l===0||a)continue;let c=0,g=!1;for(const i of t.edges){if(i.dst!==s)continue;const x=n(i.src);x&&(x===r?g=!0:c++)}if(c>0||!g)continue;const p=e[s]??0,I=p+l;let u=0;for(const i of t.edges)i.dst===s&&(u=Math.max(u,(e[i.src]??0)+1));const h=Math.max(p,u,I);h!==p&&(e[s]=h)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=Ie(t),o=_e(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let f=Object.create(null);for(const l of o){const c=xo(n,l),g=e!=null&&e.ignoreCrossLaneEdges?c.filter(p=>{const I=r(p.src),u=r(l);return!I||!u?!0:I===u}):c;if(g.length===0)f[l]=0;else if(s&&g.length===1){const p=g[0].src,I=r(p),u=r(l);I!==u?f[l]=f[p]??0:f[l]=(f[p]??0)+1}else{let p=-1/0;for(const I of g)p=Math.max(p,(f[I.src]??0)+1);f[l]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(f=js(n,f)),e!=null&&e.ignoreCrossLaneEdges&&Us(n,f),{layers:cn(n,f,r),rankOf:f,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=Ie(t),s={...Ws(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:f,succs:a}=fn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const i=r(h.src),x=r(h.dst);if(i&&x&&i!==x)return!1}return!0}),l=_e(n)??[...n.nodes],c=[...l].reverse(),g=d((h,i)=>{let x=0;for(const v of f.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,i)),Math.min(Math.max(i,x),C)},"clampFeasible"),p=rn.GRAVITY_ITERATIONS,I=d(h=>{let i=!1;for(const x of h){const C=f.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,w)=>E+(s[w]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,w)=>E+(s[w]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),M=g(x,y);M!==s[x]&&(s[x]=M,i=!0)}return i},"relaxOrder");for(let h=0;h0){const x=Math.min(...i.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:So(n,l,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=Mo(t),n=bo(t);let o=Io(e);const s=[];for(;o.length>0;){const r=[];for(const f of o){s.push(f);for(const a of n.get(f)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((f,a)=>f.localeCompare(a))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?qs(n)??[...n.nodes].sort():_e(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),f=Object.create(null),a=new Map,l=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const I=xo(n,g);let u=0;if(I.length>0)for(const C of I){const b=C.src,v=f[b]??0;u=Math.max(u,v+l(b,g))}const h=r(g),i=a.get(h)??0,x=Math.max(u,i);f[g]=x,a.set(h,x+1)}return{layers:So(n,o,f,{skipGroups:!0}),rankOf:f,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let f=0;const a=new Map(n.nodeById),l=d(u=>{const h=`placeholder-${f++}`,i={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,i),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),c=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of c){const h=o[u.src]??0,i=o[u.dst]??0;if(i-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function qn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(qn,"median");function Jn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Jn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function Zn(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),f=ke(e),a=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&a.push({u:r.get(c.src),v:f.get(c.dst)});a.sort((c,g)=>c.u===g.u?c.v-g.v:c.u-g.u);const l=a.map(c=>c.v);return Co(l)}d(Zn,"countCrossingsBetweenAdjacent");function qe(t,e,n){return[...t].sort((o,s)=>{const r=qn(e.get(o)??[]),f=qn(e.get(s)??[]);return r===f?tr(o,s,n):isFinite(r)?isFinite(f)?r-f:-1:1})}d(qe,"sortByHeuristic");function Qn(t,e,n,o,s,r){const f=ke(t),a=ke(e),l=Qs(e,f,n,o);if(!s||!r||r.length===0)return qe(e,l,a);const c=new Map;for(const I of e){const u=s(I),h=c.get(u)??[];h.push(I),c.set(u,h)}const g=[];for(const I of r){const u=c.get(I);if(!u||u.length===0)continue;const h=qe(u,l,a);g.push(...h)}const p=c.get(null);if(p&&p.length>0){const I=qe(p,l,a);for(const u of I){const h=Jn(l.get(u)??[]);let i=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Jn(l.get(C)??[]);if(hf.has(i.src)&&a.has(i.dst)),g=l?n.filter(i=>a.has(i.src)&&l.has(i.dst)):void 0,p=d(i=>{let x=Zn(t,i,c);return g&&o&&(x+=Zn(i,o,g)),x},"crossingScore"),I=s?new Map:null;if(s&&I)for(const i of e)I.set(i,s(i));let u=!0,h=p(r);for(;u;){u=!1;for(let i=0;i+1[...a]),s=e.edges,r=ge(e),f=vo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let l=1;l=0;l--)o[l]=Qn(o[l+1],o[l],s,"up",r,f),o[l]=to(o[l+1],o[l],s,o[l-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=(n==null?void 0:n.layerGap)??_o.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??_o.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,f=(n==null?void 0:n.direction)??"TB",a=f==="LR"||f==="RL",l=t.layers,c=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),i=vo(e,n==null?void 0:n.laneOrder),x=l.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1Math.max(Mt,I(Ht)),0),H=l[O+1].reduce((Mt,Ht)=>Math.max(Mt,I(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of l)for(const k of O)b.add(h(k));const v=b.has(null),L=i.filter(O=>b.has(O)),y=[...v?[null]:[],...L],M=Object.create(null);for(const O of L)M[O]=0;v&&(M.null=0);for(const O of l){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+I(ft),0)+s*Math.max(0,G.length-1);M[P]=Math.max(M[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);M.null=Math.max(M.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?M.null:M[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;PI(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let _t=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];c[J]=_t+rt/2,g[J]=w+H/2,_t+=rt+s}}}const G=C[O]??0;w+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((c[H]??0)+(c[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(c[tt]=G)}}return{x:c,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function eo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:f}of e){const a=n.get(s),l=n.get(r);a==null||l==null||(o+=f*Math.abs(a-l))}return o}d(eo,"laneArrangementCost");function ar(t){const e=dn(t);if(e.length<2)return[];const n=new Map(e.map((r,f)=>[r,f])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const f=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!f||!a||!t.nodeById.has(f)||!t.nodeById.has(a))continue;const l=o(f),c=o(a);if(!l||!c||l===c)continue;const g=n.get(l),p=n.get(c);if(g==null||p==null)continue;const[I,u]=g<=p?[l,c]:[c,l],h=`${I}\0${u}`,i=s.get(h);i?i.weight++:s.set(h,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function no(t,e,n){const o=[...t];let s=eo(o,e),r=!0,f=0;const a=Math.max(1,o.length);for(;r&&fs.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:f})=>`${s}:${r}:${f}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=dn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((a,l)=>[a,l]));let r=no(n,o,s);const f=Math.max(0,e.restarts??or);for(let a=0;alt&&l*3>=a?f>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(oo,"chooseOrthogonalSide");function so(t,e){return Math.abs(t.to-e.from)m.isGroup&&!m.parentId);for(const m of c){const S={id:m.id},A=d(T=>{f.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(A)},"assignLane");A(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,A=m.height??10,T=m.x??0,N=m.y??0,D=Dr;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-A/2-D,maxY:N+A/2+D,visualXHalfExtent:l?A/2+D:S/2+D}}),p=d((m,S,A,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:A,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,A),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),I=d((m,S)=>{const A=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-A/2,y:D};case"right":return{x:N+A/2,y:D}}},"portForSide"),u=d((m,S,A)=>I(m,oo(m,S,A?"bottom":"top")),"getOrthogonalPort"),h=[],i=[],x=new Set,C=1e3,b=d((m,S,A)=>{if(h.length===0)return 0;const T=Math.abs(S.y-A.y)U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,A.y)-lt,U=Math.max(S.y,A.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coordU||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const A=r.get(m.start),T=r.get(m.end),N=f.get(m.start),D=f.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=A&&T?Math.abs((T.x??0)-(A.x??0)):0,U=A&&T?Math.abs((T.y??0)-(A.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const A=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(A-T)>1?A-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,A,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>A&&z.nodeId===A||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minYm.y&&z.maxX>N&&z.minXm.x&&z.maxY>W&&z.minYoo(m,S,"bottom"),"determineSide"),w=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const N=(T.x??0)-(A.x??0),D=(T.y??0)-(A.y??0);w.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(A,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:A.x??0,y:A.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of w.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of w.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,A)=>{const T=B(S),N=B(A);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-A.edgeIdx});for(let S=1;S=N||(H.set(P(A.srcId,A.srcSide),N-1),H.set(P(A.srcId,T),D+1),A.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of w.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of w.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const A=O(m);if(S.has(A)||(H.get(P(m.srcId,A))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,A),1),m.srcSide=A}for(const m of w.values()){const{edgeIdx:S,srcId:A,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(A),ot=r.get(T),U=`${A}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((wt,Gt)=>wt.oppositeCoord-Gt.oppositeCoord);const A=m.split(":"),T=A.slice(0,-2).join(":"),N=A[A.length-2],D=A[A.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[wt,Gt]of S.entries()){const ee=Bt+wt*st,mn=`${Gt.edgeIdx}:${D}`;tt.set(mn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:A})=>Mt(A))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:A})=>Mt(A)):!1,"faceHasLabelNode"),_t=d((m,S,A)=>S==="top"||S==="bottom"?{x:m.x+A,y:m.y}:{x:m.x,y:m.y+A},"applyPortOffset"),nt=d((m,S,A)=>{const T=w.get(m),N={x:A.x??0,y:A.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(A,D);let U=T?I(S,T.srcSide):u(S,N,!0),z=T?I(A,T.dstSide):u(A,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=_t(U,W,bt)),dt!==void 0&&(z=_t(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(i[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,A,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(A.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(A.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.xQ.minY&&X.y{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],wt=ct(U,Bt);if(wt.inside&&wt.obstacle){const X=wt.obstacle;if(bt){const $=st(N,A,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,A,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,A,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,A,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)1||Ct>1,kt=M.get(S.start??"")??0,mt=M.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const mn=p("vertical",U.x,U.y,U.y);U.x=mn.coord;const pr=p("vertical",z.x,z.y,z.y);z.x=pr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,Ae=Math.min(U.y,z.y)-50,we=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX$&&X.minYht&&(ye=Math.min(ye,X.minX-We),pe=Math.max(pe,X.maxX+We),Ae=Math.min(Ae,X.minY-We),we=Math.max(we,X.maxY+We))}for(const X of g){if(X.maxXpe||X.maxYwe)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,Ae,we),p("vertical",X.maxX+Q,Ae,we)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const xr=a.filter(X=>X.orientation==="horizontal"&&X.coord>=Ae&&X.coord<=we),br=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),De=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),He=De(U.x,U.y),Eo=De(z.x,z.y),Xe=new Map,yn=new Map,pn=new Map,Ye=new Set,Se=[];Xe.set(He,0),pn.set(He,"n"),Se.push({key:He,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ye.add(He);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),xn={x:z.x,y:U.y},Mr=xe(U,xn),Ir=xe(xn,z),Sr=Mr||Ir,bn={x:U.x,y:z.y},Cr=xe(U,bn),vr=xe(bn,z);if(Sr?Cr||vr||(Math.abs(U.x-z.x)0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ye.delete(X.key),X.key===Eo){let mt=Eo,Vt=z;for($t=[Vt];yn.has(mt);){const re=yn.get(mt);$t.unshift(re),Vt=re,mt=De(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=br.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=xr.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rtne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minYQ&&ne.maxX>Vt&&ne.minX$&&ne.maxY>Dt&&ne.minY10&&Mn<-5||Re<-10&&Mn>5)&&(Et=Math.abs(Mn)*100),(Zt>10&&Ge<-5||Zt<-10&&Ge>5)&&(Et+=Math.abs(Ge)*50);let To=0;const Ao=pn.get(X.key)??"n",wo=Math.abs(Ge)>lt?"h":"v";Ao!=="n"&&Ao!==wo&&(To=50);const Lr=Ut+Lt+Et+To,$e=(Xe.get(X.key)??1/0)+Lr,Ro=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if($e<(Xe.get(vt)??1/0))if(yn.set(vt,X.pt),Xe.set(vt,$e),pn.set(vt,wo),!Ye.has(vt))Se.push({key:vt,f:$e+Ro,pt:mt}),Ye.add(vt);else{const ne=Se.findIndex(Er=>Er.key===vt);ne!==-1&&(Se[ne].f=$e+Ro)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=QLt.minXjt&&Lt.minYFt);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(Ft=>Ft.minXMath.min(X.y,$.y));if(jt.length>0){let Ft=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;Ft=Math.min(Ft,Lt)}Q=Ft}}}const mt=d(Dt=>{const jt=$.y>X.y,Ft=g.filter(Lt=>{const Et=Math.min(X.x,$.x)Lt.minX,Zt=Math.min(X.y,$.y)Lt.minY;return Et&&Zt});let vt=Ft;if(l&&Ft.length>0){const Lt=Ft.filter(Et=>Et.minXDt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),Ft={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,Ft),Et=xe(Ft,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;Xm.from{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!A.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=A.index,A.segments=[...A.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const A=m.pipe.tracks[m.trackIndex];A.segments=A.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const A=i[m.edgeIndex];for(const T of A){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),At=d(m=>{const S=i[m.edgeIndex],A=S.indexOf(h.indexOf(m)),T=[];return A>0&&T.push(h[S[A-1]]),A{if(m.orientation===S.orientation)return!1;const A=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>A.from&&T.pipe.coordT.from&&A.pipe.coord{for(const A of m.tracks)if(!A.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return A.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const A=At(m),T=At(S);return A.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,A)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);A(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let A=0;A{if(me.has(m))return me.get(m);const S=i[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;otMath.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),un=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())i[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const A=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=A(D),bt=A(W);if(Math.abs(z-bt)>1)return bt-z;const dt=i[D].length,ct=i[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=i[D][0],It=i[W][0];if(h[st]&&h[It]){const Bt=h[st],wt=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(wt.to-wt.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[i[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),hn=d(()=>{let m=0;const S=new Map;for(const[A,T]of s.entries())i[A].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(A));for(const A of S.values()){A.sort((N,D)=>{const W=d(z=>{const bt=i[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=A.map(N=>h[i[N][i[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),gn=d(()=>{let m=0;for(const S of a){const A=[];for(const T of S.tracks)for(const N of T.segments){const D=i[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&A.push(h[D])}A.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const A=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;DN.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const wt=x.has(Bt.edgeIndex)?m.coord:It;_.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,wt)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*vn);if(U.length===0&&N.size>0){const st=[...N].sort((wt,Gt)=>Math.abs(D.get(wt)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*vn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*vn)}}for(const[m,S]of s.entries()){const A=i[m]??[];if(A.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=A.map(dt=>{const ct=h[dt],st=_.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dtlt&&T.push(ve(ct,It)),Gt&&wt.orient===ct.orient)if(Math.abs(ct.coord-wt.coord)>lt){const ee=ct.orient==="vertical"?(It+wt.from)/2:so(ct,wt);T.push(ve(ct,ee),ve(wt,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,so(ct,wt)));else if(Gt)T.push(ve(ct,wt.coord));else{const ee=Math.abs(ct.from-It)lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dtlt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const A=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=A-N/2,ot=A+N/2,U=T-D/2,z=T+D/2;if(m.xot||m.yz)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const A=m.start,T=m.end,N=A?r.get(A):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function mr(t){var g,p,I,u,h;const e=Jo(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((I=t.config.swimlane)==null?void 0:I.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,f=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=gr(t),{ordered:l,coordinates:c}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:f,direction:a});Zo(e,l,c,{nodeGap:n,layerGap:o});for(const i of t.edges??[])delete i.points;hr(t,a);for(const i of t.edges??[])(!i.curve||i.curve==="basis")&&(i.curve="rounded");return Rs(t,a),ws(t),a}d(mr,"runSwimlaneLayoutCore");function yr(t){qo(t);const e=Qo(t);t.nodes=e.nodes,t.edges=e.edges}d(yr,"prepareSwimlaneLayout");var $r=Tr({prepareLayout:yr,runLayoutCore:mr,afterPaint:Wo});export{$r as render}; +import{ap as Tr,l as Ln,_ as d,aA as No}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Oo=5,ze=1e-5,Ve=1e-6;function Je(t){const e=[];for(let n=0;n=1-Ve||I<=Ve||I>=1-Ve?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:I}}d(Do,"segmentIntersection");function En(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(En,"isHorizontalSeg");function Ho(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Xo,"getArcSweepFlag");var Ar=.001;function Yo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&No[e.arrowTypeStart];if(o){const r=t[0],f=t[1],a=Math.atan2(f.y-r.y,f.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&No[e.arrowTypeEnd];if(s){const r=t.length,f=t[r-2],a=t[r-1],l=Math.atan2(a.y-f.y,a.x-f.x);n[r-1].x=a.x-s*Math.cos(l),n[r-1].y=a.y-s*Math.sin(l)}return n}d(Yo,"applyMarkerOffsets");function Go(t,e,n,o,s){const r=t.point.x,f=t.point.y,a={x:r-e*t.r,y:f-n*t.r},l={x:r+e*t.r,y:f+n*t.r},c=[`L${Oe(a)}`];return s==="arc"?c.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(l)}`):c.push(`M${Oe(l)}`),c}d(Go,"emitJump");function Tn(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=n.x-e.x,a=n.y-e.y,l=Math.hypot(s,r),c=Math.hypot(f,a);if(l0){const v=Tn(s[c-1],s[c],s[c+1]??s[c],Oo);v&&(i=v.cutLen)}let x=p,C=null;r&&cv.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-i,x-v.d);for(let v=0;vL){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r=2?o:null}catch{return null}}d(jo,"decodeDataPoints");function Uo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const c of e)s.set(c.id,c);const r=[],f=new Map;for(const c of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(c.id):c.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;f.set(c.id,p);const u=jo(p.getAttribute("data-points"))??c.points;r.push({...c,points:u})}const a=Ho(r);if(a.length===0)return;const l=new Map;for(const c of a){const g=l.get(c.jumpEdgeId)??[];g.push(c),l.set(c.jumpEdgeId,g)}for(const c of r){const g=l.get(c.id);if(!g||g.length===0)continue;const p=s.get(c.id),I=p==null?void 0:p.curve;if(I!==void 0&&!Vo(I))continue;const u=f.get(c.id);if(!u)continue;if(I===void 0){const v=u.getAttribute("d")??"";if(!zo(v))continue}const h=u.getAttribute("style")??"",i=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=i?Number.parseFloat(i[1]):null,C=i?Number.parseFloat(i[2]):null,b=$o(c,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,M=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",M)}}}d(Uo,"applyLineJumpsToSvg");function Wo(t,{measure:e}){var r,f;const n=(f=(r=t.config)==null?void 0:r.swimlane)==null?void 0:f.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(a=>Array.isArray(a.points)&&a.points.length>=2).map(a=>({id:a.id,points:a.points,curve:a.curve,arrowTypeStart:a.arrowTypeStart,arrowTypeEnd:a.arrowTypeEnd}));Uo(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}d(Wo,"applySwimlaneLineJumps");var In="__swimlane_default__",wr=21,Po=20;function An(t){return Math.max(t.padding??Po,Po)}d(An,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const f=n-s/2,a=Math.min(r,n+s/2),l=Math.min(wr,Math.max(0,a-f)),c=f+l;if(c<=f){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:f,bottom:c}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===In);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:In,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=In}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const l of t.nodes??[])e.set(l.id,l);const n=[];for(const l of t.edges??[]){const c=typeof l.start=="string"?l.start:void 0,g=typeof l.end=="string"?l.end:void 0;!c||!g||l.labelNodeId||n.push({id:l.id,src:c,dst:g,ref:l})}const o=t.nodes??[],s=o.filter(l=>l.isGroup),r=o.filter(l=>!l.isGroup);return{nodes:[...[...s].reverse(),...r].map(l=>l.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,f=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let l=0;for(const I of e.layers){let u=0;for(const h of I){const i=r.get(h);if(!i){u++;continue}i.layer=l,i.order=u;const x=n.x[h]??u*a,C=n.y[h]??l*f;i.x=x,i.y=C,u++}l++}const c=s.nodes??[],g=new Map,p=[];for(const I of c){if(!(I!=null&&I.isGroup))continue;I.parentId||p.push(I);const u=c.filter(b=>b.parentId===I.id);let h=1/0,i=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,M=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),i=Math.max(i,v+y/2),x=Math.min(x,L-M/2),C=Math.max(C,L+M/2))}if(h===1/0||x===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const b=I.padding??20,v=I.parentId?b:2*An(I),L=b,y=Math.max(0,i-h)+v,M=Math.max(0,C-x)+L,E=(h+i)/2,w=(x+C)/2;I.x=E,I.y=w,I.width=y,I.height=M,g.set(I.id,{minX:h,maxX:i,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let I=1/0,u=-1/0,h=0;for(const i of p){const x=i.padding??20;x>h&&(h=x);const C=g.get(i.id);C&&(I=Math.min(I,C.minY),u=Math.max(u,C.maxY))}if(I!==1/0&&u!==-1/0){const i=Math.max(0,u-I),C=Math.max(h,36),b=i+2*C,v=(I+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=I;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],M=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*An(B),H=(O.minX+O.maxX)/2;y.push(B.id),M.push(H),E.push(k)}const w=y.length;if(w>0){const B=new Map;if(w===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(ro,"measuredNodeRect");function io(t){if(t.isGroup)return;const e=ro(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(io,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&>(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function co(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(co,"classifyThreeSegmentRoute");function an(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),f=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&fe.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Ze(t,e){return t.lefte.left&&t.tope.top}d(Ze,"rectsOverlap");function wn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(wn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=ro(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Le,"portForRectSide");function lo(t,e,n,o,s,r=Yt){const f=e==="left"||e==="right",a=o==="left"||o==="right";if(f&&a){if(e==="right"&&o==="left"&&t.xn.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!f&&!a){if(e===o){if(gt(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(f&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const l=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return l&&c?[t,{x:t.x,y:n.y},n]:void 0}d(lo,"buildOrthogonalPortPath");function fo(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(fo,"buildSameSideTrackPath");function ln(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=io(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(ln,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=io(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,f=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,f,a)})}return n}d(es,"collectLayoutNodeRects");function uo(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),f=e.get(s);if(!(!r||!f))return{srcId:o,dstId:s,srcInfo:r,dstInfo:f,collinearX:Math.abs(r.cx-f.cx)h||IC)return!1;const b=Math.abs(i-g.a.x)s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Qe(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const f of n){if(f===o||f.isLayoutOnly)continue;const a=f.points;if(!(!a||a.length<2))for(let l=0;lI+s&&hi+s&&po+Yt&&t=2?e[e.length-2]:void 0,l=(f?gt(f,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(l)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(tn,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Nr=.5,Bo=4;function go(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const f=rs(t[s],t[r],e);return n?[f,...t.slice(s)]:[...t.slice(0,s+1),f]}d(Nn,"clipEndpoint");function is(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Nn(s,o.srcRect,!0)),o.dstRect&&(s=Nn(s,o.dstRect,!1)),s=ue(tn(s)),s=mo(s,o.srcRect,o.dstRect),o.edge.points=ue(tn(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function On(t,e,n,o=!1){if(yt(t,e,it)){if(e.yn.bottom+it)return e;if(o){if(t.xn.right+it)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(gt(t,e,it)){if(e.xn.right+it)return e;if(o){if(t.yn.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(On,"snapEndpointToBoundary");function en(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function Bn(t,e){return e==="left"||e==="right"?nn(t.top,t.bottom):nn(t.left,t.right)}d(Bn,"clearanceRangeForSide");function on(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function kn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const f=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,f));if(!(Math.abs(a-f)({...a}));for(let a=e;a>=0&&a=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)o.bottom+it;case"left":return yt(e,n,it)&&n.xo.right+it}}d(Dn,"leavesOutward");function Hn(t,e,n){if(t.length<3)return t;if(n){const r=_n(t[0],t[1],e);return r&&Dn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=_n(t[o-1],t[o],e);return s&&Dn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Hn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=en(o,0,1);if(r){const f=On(r,o[0],e);f!==o[0]&&(o=[f,...o.slice(1)])}o=Hn(o,e,!0)}if(n){const r=o.length-1,f=en(o,r,-1);if(f){const a=On(f,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Hn(o,n,!1)}const s=mo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Fn(o,e,!0)),n&&(o=Fn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Xn(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const f=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=f}}d(Xn,"prepareEdgeEndpointsForRenderer");function yo(t){return new Map(t.map(e=>[e.id,e]))}d(yo,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Yn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d(Yn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const f=r.x,a=r.y;if(typeof f!="number"||typeof a!="number")continue;const l=r.width??0,c=r.height??0;e=Math.min(e,f-l/2),n=Math.max(n,f+l/2),o=Math.min(o,a-c/2),s=Math.max(s,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=yo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Yn(s,e)-Yn(o,e));for(const o of n){const s=t.filter(f=>f.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function sn(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup);let r=1/0,f=-1/0;for(const l of s){const c=l[e];typeof c=="number"&&(r=Math.min(r,c),f=Math.max(f,c))}if(!Number.isFinite(r)||!Number.isFinite(f))return!1;const a=d(l=>r+f-l,"mirror");for(const l of n){const c=l[e];typeof c=="number"&&(l[e]=a(c));const g=l.groupTitleRect;g&&(l.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const l of o)for(const c of l.points??[])c[e]=a(c[e]);return!0}d(sn,"mirrorAxis");function ms(t){return(t.nodes??[]).some(n=>!n.isGroup)?sn(t,"y"):!0}d(ms,"applyBtDirectionTransform");function ys(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,f=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-f)*I+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-f)*I+a,Mt=j-r;G.x=ft,G.y=Mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&sn(t,"x"),!0;const h=yo(n),i=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,h);if(!G)continue;const j=i.get(G)??[];j.push(P),i.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=i.get(P.id)??[],j=po(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),M=L+2*y,E=a+M,O=(b+v)/2-M/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?C.bottom:C.top,H=I.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>I.cx?C.right:C.left,H=I.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const M=ce(v,L,ae),E=ce(L,y,ae);if(M&&E||!M&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const w=!M&&Qe(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&Qe(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(w||B)){M?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(ps,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<4)continue;const c=xt(l,.001);if(c.length<4)continue;const g=c.length-1,p=c[g],I=c[g-1],u=c[g-2],h=p.x-I.x,i=p.y-I.y,x=Math.hypot(h,i);if(x>=10||x<.001)continue;const C=I.x-u.x,b=I.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(I,p,.001),y=Ot(I,p,.001),M=Nt(u,I,.001),E=Ot(u,I,.001);if(!(L&&E||y&&M))continue;const w=a.end,B=a.start,O=w?e.get(w):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,w?[w]:[],-2)||Pt(G,j,f,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&ao(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St=0){const J=c[g-3],rt=[B,w].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const _t=[...c.slice(0,g-2),G,j];a.points=_t;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,At=-1;for(let Kt=0;Kt<_t.length-1;Kt++){const qt=_t[Kt],Jt=_t[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>At&&(At=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(xs,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Sn=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function bs(t,e){const s=d((u,h)=>{const i=u.x??0,x=u.y??0,C=h.x-i,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:i+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:i+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const i=xt(u.points??[]);if(i.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?i[0]:i[i.length-1],L=h?i[1]:i[i.length-2],y=s(C,v);let M=v;if(Sn(L,y)&&(M=L),gt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,M.y),max:Math.max(y.y,M.y),boundary:y,railEnd:M,rect:b};if(yt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,M.x),max:Math.max(y.x,M.x),boundary:y,railEnd:M,rect:b}},"terminalLaneFor"),f=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&>(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),l=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:f(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),c=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const i=f(u,h);if(i2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const i=xt(u.edge.points??[]);if(i.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const M=i.length>1&&ce(i[1],u.railEnd,et),E=i.slice(M?2:1),w=E[0];return w&&!Sn(w,C)?void 0:[x,C,...E]}const v=i.length>1&&ce(i[i.length-2],u.railEnd,et),L=i.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Sn(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,i=xt(h.points??[]);if(i.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,M=v.x??0,E=v.y??0,[w,B]=i;return yt(w,B,et)&&Math.abs(y-E)<1&&Math.abs(L-M)>1||gt(w,B,et)&&Math.abs(L-M)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let i=!1;for(let x=0;x{const w=p(M),B=p(E);return w!==B?Number(w)-Number(B):+!E.atStart-+!M.atStart});for(const M of y){for(const E of I){const w=g(M,E);if(!w)continue;const B=r({...M.edge,points:w},M.atStart);if(!(!B||h.some(O=>O.edge!==M.edge&&(l(B,O)||L&&c(B,O))))){M.edge.points=w,i=!0;break}}if(i)break}}if(!i)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,l)=>{const c=a.start,g=a.end,p=at(l);if(p.length!==l.length-1)return!1;const I=[c,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,I,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const i of p)for(const x of at(xt(h)))if(de(i,x,.5)>=Xt||he(i.a,i.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),f=d((a,l)=>{if(l+4>=a.length)return;const c=a[l],g=a[l+1],p=a[l+2],I=a[l+3],u=a[l+4],h=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&>(c,I,et)&>(c,u,et)&>(g,p,et)&&(g.x-c.x)*(I.x-p.x)<0,i=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&yt(c,I,et)&&yt(c,u,et)&&yt(g,p,et)&&(g.y-c.y)*(I.y-p.y)<0;if(h||i)return xt([...a.slice(0,l+1),u,...a.slice(l+5)]);if(l+5>=a.length)return;const x=a[l+5],C=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&Ot(u,x)&>(c,u,et)&>(c,x,et)&>(p,I,et)&&(p.x-g.x)*(u.x-I.x)<0,b=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&&Nt(u,x)&&yt(c,u,et)&&yt(c,x,et)&&yt(p,I,et)&&(p.y-g.y)*(u.y-I.y)<0;if(!(!C&&!b))return xt([...a.slice(0,l+1),x,...a.slice(l+6)])},"withoutDogleg");for(let a=0;a<8;a++){let l=!1;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(let p=0;p<=g.length-5;p++){const I=f(g,p);if(!(!I||!r(c,I))){c.points=I,l=!0;break}}if(l)break}if(!l)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Gn(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),l=d((h,i,x)=>xt(h===i?x??[]:h.points??[]),"pointsFor"),c=d((h,i)=>{let x=0;for(let C=0;C{const i=at(h);if(i.length!==3)return;const x=i[1];if(!(i[0].horizontal===x.horizontal||i[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return i.horizontal?Wt(i.a.x,i.b.x,b.left,b.right)>=Xt&&i.a.y>=b.top-2&&i.a.y<=b.bottom+2:Wt(i.a.y,i.b.y,b.top,b.bottom)>=Xt&&i.a.x>=b.left-2&&i.a.x<=b.right+2})},"blockingRectsFor"),I=d((h,i,x)=>{const C=h.map(v=>({...v}));if(i.horizontal)C[i.index].y=x,C[i.index+1].y=x;else if(i.vertical)C[i.index].x=x,C[i.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,i,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(i);if(b.length!==i.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,f,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(l(v)))if(de(L,y,.5)>=Xt)return!1}return c(h,i)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const i=c();let x=!1;for(const C of a){const b=l(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(M=>M.rect.top))-20,Math.max(...L.map(M=>M.rect.bottom))+20]:[Math.min(...L.map(M=>M.rect.left))-20,Math.max(...L.map(M=>M.rect.right))+20];for(const M of y){const E=I(b,v.segment,M);if(!(!E||!u(C,E,i))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(Gn,"liftObstacleHuggingSameSideRails");function $n(t,e){const o=d(l=>{const c=l.groupTitleRect;if(!(!c||typeof c.left!="number"||typeof c.right!="number"||typeof c.top!="number"||typeof c.bottom!="number"||!Number.isFinite(c.left)||!Number.isFinite(c.right)||!Number.isFinite(c.top)||!Number.isFinite(c.bottom)||c.right<=c.left||c.bottom<=c.top))return{left:c.left,right:c.right,top:c.top,bottom:c.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId)return;const c=l.direction,g=typeof c=="string"?c.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(l),I=l.y,u=l.height;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(i<=0||h{if(!l.horizontal)return!1;const g=l.a.y;return g<=c.top+et||g>=c.bottom-et?!1:Wt(l.a.x,l.b.x,c.left,c.right)>=Xt},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(l=>!!l);if(f.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const c=xt(l.points??[]);for(const g of at(c))for(const p of f)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const l of f){const c=l.node.y,g=l.node.height;typeof c!="number"||typeof g!="number"||!Number.isFinite(c)||!Number.isFinite(g)||g<=0||(l.node.y=c-a/2,l.node.height=g+a,l.node.groupTitleRect={...l.rect,top:l.rect.top-a,bottom:l.rect.bottom-a})}}d($n,"liftTopLaneTitleBandsAboveRails");function zn(t,e){const o=d(c=>{const g=c.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId||c.direction!=="LR")return;const p=o(c),I=c.x,u=c.width;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(h<=0||i{if(!c.vertical)return!1;const p=c.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(c.a.y,c.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),f=d((c,g)=>{if(!c.horizontal)return!1;const p=c.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(c.a.x,c.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(c=>!!c);if(a.length===0)return;let l=0;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(const p of at(g))for(const I of a)if(r(p,I.rect))l=Math.max(l,I.rect.right-p.a.x+4);else if(f(p,I.rect)){const u=Math.min(p.a.x,p.b.x);l=Math.max(l,I.rect.right-u+4)}}if(!(l<=et))for(const c of a){const g=c.node.x,p=c.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(c.node.x=g-l/2,c.node.width=p+l,c.node.groupTitleRect={...c.rect,left:c.rect.left-l,right:c.rect.right-l})}}d(zn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,i=new Map)=>xt(i.get(h)??h.points??[]),"replacementPointsFor"),f=d((h=new Map)=>{let i=0;for(let x=0;xs.reduce((i,x)=>i+oe(r(x,h)),0),"totalBends"),l=d(h=>{const i=r(h);if(i.length<4)return;const x=i[i.length-2],C=i[i.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),c=d((h,i)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:i.tailStart.y};else if(Ot(C,b,et))v={x:i.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,i.tailStart,i.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(i))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,i,x)=>{for(const C of s)if(C!==h){for(const b of at(i))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),I=d((h,i,x)=>!g(h,i)&&!p(h,i,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const i of s){const x=i.end;if(!x||!e.has(x)||r(i).length<4)continue;const b=h.get(x)??[];b.push(i),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const i=f();if(i===0)return;const x=a();let C,b=i,v=x;for(const L of u().values())for(let y=0;y=i||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),l=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),c=d((L=new Map)=>{let y=0;for(let M=0;Ma.reduce((y,M)=>y+oe(l(M,L)),0),"totalBends"),p=d(L=>{const y=L.start,M=L.end,E=y?e.get(y):void 0,w=M?e.get(M):void 0,B=E?te(E):void 0,O=w?te(w):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),I=d((L,y,M)=>{if(M.index<=0||M.index+1>=y.length-1)return;const E=p(L);if(E){if(M.vertical){const w=M.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=wO+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"vertical",side:k,coord:w,min:Math.min(M.a.y,M.b.y),max:Math.max(M.a.y,M.b.y)}:void 0}if(M.horizontal){const w=M.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=wO+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"horizontal",side:k,coord:w,min:Math.min(M.a.x,M.b.x),max:Math.max(M.a.x,M.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const M=l(y);for(const E of at(M)){const w=I(y,M,E);w&&L.push(w)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),i=d(L=>{const y=[],M=new Set;for(const E of L){if(M.has(E))continue;const w=[E],B=[];for(M.add(E);w.length>0;){const O=w.pop();B.push(O);for(const k of L)!M.has(k)&&h(O,k)&&(M.add(k),w.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const M of L)y.some(E=>Math.abs(E-M.coord){const y=L.map(w=>w.coord),M=x(L),E=[];if(L.length<=6){const w=new Array(M.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of M.entries())w[k]||(w[k]=!0,B.push(H),O(),B.pop(),w[k]=!1)},"visit");return O(),E}for(let w=0;w{const M=new Map;for(const[w,B]of L.entries()){const O=y[w],k=M.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),M.set(B.edge,k)}const E=new Map;for(const[w,B]of M){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(w,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,M]of L){const E=[y.start,y.end].filter(w=>!!w);for(const w of at(M))if(Pt(w.a,w.b,r,E,-2)||Pt(w.a,w.b,f,[],-2))return!1}for(let y=0;y=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=c();if(y===0)return;let M,E=y,w=g(),B=Number.POSITIVE_INFINITY;for(const O of i(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=c(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>w||G===w&&j>=B)||(M=H,E=P,w=G,B=j)}if(!M)return;for(const[O,k]of M)O.points=k}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),f=d((u,h,i)=>xt(u===h?i??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,i)=>{const x=i.a.x-i.b.x,C=i.a.y-i.b.y;return h+Math.hypot(x,C)},0),"pathLength"),l=d((u,h)=>{let i=0;for(let x=0;x{if(u.horizontal){const i=u.a.y;return(Math.abs(i-h.top)<1||Math.abs(i-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const i=u.a.x;return(Math.abs(i-h.left)<1||Math.abs(i-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),i=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&i.push(b)}return i},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const i=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(i,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(i,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-i.x)!==Math.sign(b.x-C.x):Math.sign(x.y-i.y)!==Math.sign(b.y-C.y)))return[];const M=gt(i,b,et)||yt(i,b,et)?[]:[{x:i.x,y:b.y},{x:b.x,y:i.y}],E=M.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:M.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),w=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return w.has(O)?!1:(w.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,h,i)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>c(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(f(b)))if(de(v,L,.5)>=Xt)return!1}return l(u,h)<=i},"candidateIsSafe");for(let u=0;u<8;u++){const h=l();let i,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=f(L),M=oe(y,et),E=a(y);for(let w=0;w<=y.length-4;w++)for(const B of p(y,w)){const O=oe(B,et),k=a(B);if(!(OC||P===C&&(O>b||O===b&&k>=v)||(i=L,x=B,C=P,b=O,v=k)}}if(!i||!x)return;i.points=x}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const f=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const F=R.x??0,_=R.y??0,V=te(R);V&&f.push({id:String(R.id??""),cx:F,cy:_,rect:V})}if(f.length===0)return;const a=new Map(f.map(R=>[R.id,R])),l=f.map(R=>({id:R.id,rect:R.rect})),c=["top","bottom","left","right"],g={top:Math.min(...f.map(R=>R.rect.top))-20,bottom:Math.max(...f.map(R=>R.rect.bottom))+20,left:Math.min(...f.map(R=>R.rect.left))-20,right:Math.max(...f.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),I=new Map(p.map((R,F)=>[R,F])),u=d(R=>{const F=R==="left"||R==="top"?-1:1,_=[];for(let V=0;V<=2;V++)_.push(g[R]+F*20*V);return _},"outwardTracksForSide"),h=d((R,F=new Map)=>xt(F.get(R)??R.points??[]),"replacementPointsFor"),i=d((R,F)=>{let _=0;for(const V of R)for(const K of F)he(V.a,V.b,K.a,K.b,et)&&_++;return _},"crossingCountBetweenSegments"),x=d((R,F)=>i(at(R),at(F)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let F=0;const _=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y0&&(F+=T,_.push({first:q,second:A,count:T}),Z(q),Z(A))}}return K.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),{count:F,pairs:_,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,F)=>{const _=new Set(F.keys());if(_.size===0)return R.count;let V=0;for(const Z of R.pairs)(_.has(Z.first)||_.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z{const F=new Map;for(const K of R.pairs){const Z=F.get(K.first)??new Set;Z.add(K.second),F.set(K.first,Z);const Y=F.get(K.second)??new Set;Y.add(K.first),F.set(K.second,Y)}const _=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of F.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(I.get(q)??0)-(I.get(m)??0)),Y.length>1&&_.push(Y)}return _},"crossingComponents"),L=d(R=>[R.start,R.end].filter(F=>!!F),"endpointIdsFor"),y=d(R=>{const F=[];for(const _ of v(R)){const V=new Set(_),K=new Set(_.flatMap(Y=>L(Y))),Z=[..._];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),F.push(Z)}return F},"pairSearchGroups"),M=d((R,F,_)=>b(R,new Map([[F,_]])),"crossingCountWithSingleReplacement"),E=d(R=>{const F=new Map;for(const _ of R.pairs)F.set(_.first,(F.get(_.first)??0)+_.count),F.set(_.second,(F.get(_.second)??0)+_.count);return F},"currentCrossingsByEdge"),w=d(R=>R.slice(1).reduce((F,_,V)=>{const K=R[V];return F+Math.abs(_.x-K.x)+Math.abs(_.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((F,_)=>F+oe(h(_,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((F,_)=>F+w(h(_,R)),0),"totalLength"),k=d((R,F,_=new Map)=>{const V=at(F);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,_)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,F)=>{const _=[R.start,R.end].filter(V=>!!V);for(const V of at(F))if(Pt(V.a,V.b,l,_,-2))return!0;return!1},"pathHitsNode"),P=d((R,F)=>{const _=ue(xt(F));at(_).length===_.length-1&&R.push(_)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,F,_)=>{switch(F){case"left":return Math.min(R.x,_.x)-20;case"right":return Math.max(R.x,_.x)+20;case"top":return Math.min(R.y,_.y)-20;case"bottom":return Math.max(R.y,_.y)+20}},"localTrackForSameSide"),tt=d((R,F,_,V)=>{const K=_==="left"||_==="top"?-1:1,Z=[j(F,_,V),g[_]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,fo(F,_,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:Z,y:F.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:F.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,F,_,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:Y,y:F.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),_t=d((R,F,_,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:F.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const F=new Set;return R.map(_=>xt(_)).filter(_=>{const V=_.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return F.has(V)||_.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,F,_,V)=>{const K=[],Z=lo(R,F,_,V,20,et);Z&&P(K,Z),F===V&&tt(K,R,F,_);const Y=G(F),q=G(V);return Y&&!q?ft(K,R,F,_,V):!Y&&q?Mt(K,R,F,_,V):Y?Ht(K,R,F,_,V):_t(K,R,F,_,V),nt(K)},"buildCandidatesForSides"),rt=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[F,_,{x:S,y:_.y},{x:S,y:q.y},q]);for(const A of m)P(R,[F,_,{x:S,y:_.y},{x:S,y:A},{x:q.x,y:A},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[F,_,{x:_.x,y:S},{x:q.x,y:S},q]);for(const A of m)P(R,[F,_,{x:_.x,y:S},{x:A,y:S},{x:A,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const F=R.start,_=R.end,V=_?a.get(_):void 0;if(!F||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const F=R.start,_=R.end,V=F?a.get(F):void 0,K=_?a.get(_):void 0;if(!V||!K)return[];const Z=[];for(const Y of c){const q=Le(V,Y);for(const m of c)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),At=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,F,_)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=_.get(K)??at(h(K));F.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,F,_,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=i(q,_.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:F.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:w(Y)}}).filter(({crossings:Y})=>Y<=F.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,_),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,F,_,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===F||m.second===F||m.first===V||m.second===V)&&(Y+=m.count);let q=i(_.segments,K.segments);for(const m of p){if(m===F||m===V)continue;const S=Z.get(m)??at(h(m));q+=i(_.segments,S)+i(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,F)=>{for(const _ of R.sharedTrackConflicts)if(_!==F)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,F)=>R.segments.some(_=>F.segments.some(V=>de(_,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,F,_,V)=>se(F,_.edge)&&se(V,R.edge)&&!Ee(F,V),"pairCandidatesAreCompatible"),Te=d((R,F,_,V,K)=>{const Z=Jt(R.current,F.edge,_,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[F.edge,_.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(F.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+_.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(F.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+_.length+K.length}},"scorePairReplacement"),un=d((R,F)=>R.crossings{let K=V;for(const Z of F.candidates)for(const Y of _.candidates){if(!me(F,Z,_,Y))continue;const q=Te(R,F,Z,_,Y);q&&un(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),gn=d(R=>{const F=B(),_=O(),V=At(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,w(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:F,length:_};const A={current:R,currentBends:F,currentLength:_,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const F=C(),_=F.count;if(_===0)return;let V,K,Z=_,Y=Number.POSITIVE_INFINITY;for(const m of F.edges){const S=oe(h(m),et);for(const A of St(m)){const T=H(m,A),N=!T&&k(m,A),D=M(F,m,A),W=oe(A,et);T||N||!(D<_||D===_&&WZ||D===Z&&W>=Y||(V=m,K=A,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=gn(F);if(!q)return;for(const[m,S]of q)m.points=S}}d(vs,"resolveRenderedOrthogonalCrossings");var be=.001,Br=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=ln(e),s=["top","bottom","left","right"],r=20,f={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},a=d((i,x,C,b)=>{const v=[],L=lo(i,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(fo(i,x,C,f[x])),v},"buildOrthogonalPathCandidates"),l=d((i,x)=>{for(let C=0;C{let b=0;const v=Be(i,be),L=x.start,y=x.end;for(const M of t){if(M===x||M.isLayoutOnly)continue;const E=M.start,w=M.end;if(!C&&L&&y&&(E===L||E===y||w===L||w===y))continue;const B=M.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(ho(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Br&&b++}}return b},"pathConflictCount"),g=4,p=d((i,x)=>{const C=Math.abs(i.y-x.rect.top),b=Math.abs(i.y-x.rect.bottom),v=Math.abs(i.x-x.rect.left),L=Math.abs(i.x-x.rect.right);let y="top",M=C;return b{const b=I.get(i)??[];b.push({side:x,edgeId:C}),I.set(i,b)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points??[];if(x.length<1)continue;const C=i.id??"",b=i.start,v=i.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((i,x,C)=>{var b;return((b=I.get(i))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C0){const Mt=c(tt,i,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}c(tt,i)>w||ftG.edgeId!==M));const P=I.get(v);P&&I.set(v,P.filter(G=>G.edgeId!==M)),u(b,p(B[0],L),M),u(v,p(B[B.length-1],y),M)}}}d(Ls,"simplifyDetouredEdges");var Qt=.001,ko=10,Ue=7;function Vn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const f=r.x-s.x,a=r.y-s.y;if(!(Math.abs(f)+Math.abs(a)r&&Ze(t,Es(r)))}d(jn,"labelOverlapsOwnMarker");function Ke(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const i=h.points;if(!(!i||i.length<2))for(let x=0;x{const x=wn(i,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&Ze(x,b))return!0;return!1},"labelOverlapsForeignNode"),c=d((h,i)=>{const x=wn(i,r);for(const C of n)if(C.edgeId!==h&&an(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,i,x)=>l(h,x)||c(i,x),"labelOverlapsAnything"),p=[],I=d(h=>{for(const{id:i,rect:x}of s)if(ts(x,h))return i},"findContainingLane"),u=d((h,i)=>p.some(x=>x.labelId!==h&&Ze(i,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const i=h.labelNodeId;if(!i)continue;const x=e.get(i);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx0?y:L,E=b>=v?"horizontal":"vertical",w=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,At=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==At?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=I(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+f,St=ut.rect.right-b/2-f,At=ut.rect.top+v/2+f,Kt=ut.rect.bottom-v/2-f;if(pt>St||At>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,At,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt{const J=w(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!jn(St.rect,C)&&!u(i,St.rect)&&!g(i,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=w(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const At=j(St);if(At&&!jn(At.rect,C)&&!u(i,At.rect)&&!l(i,At.rect)&&(rt||!c(h.id,At.rect)))return{laneId:At.laneId,anchor:At.anchor}}},"findLaneContainingFallback"),_t=Mt(M)??(M.lengthrt.labelId===i);J>=0?p[J]={labelId:i,rect:nt}:p.push({labelId:i,rect:nt})}}}d(Ke,"anchorLabelsToPolyline");var Cn=1e-6,kr=8,Fo=kr/2,Fr=3;function Un(t,e){return t{const g=Un(a,l);let p=0;const I=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const i=c==="x"?h.w/2:h.h/2;i>p&&(p=i)},"consider");I(f.labelNodeId);for(const u of t){if(u===f||u.isLayoutOnly)continue;const h=u.start,i=u.end;!h||!i||Un(h,i)===g&&I(u.labelNodeId)}return p>0?p+Fr:0},"labelClearanceFor");for(const f of t){if(f.isLayoutOnly)continue;const a=f.points;if(!co(a,Cn))continue;const l=uo(f,n,Cn);if(!l)continue;const{srcId:c,dstId:g,srcInfo:p,dstInfo:I,collinearX:u,collinearY:h}=l;if(u===h)continue;let i,x;if(u){const y=I.cy>p.cy;i={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:I.cx,y:y?I.rect.top:I.rect.bottom}}else{const y=I.cx>p.cx;i={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?I.rect.left:I.rect.right,y:I.cy}}if(Pt(i,x,o,[c,g],1))continue;const b=r(f,c,g,u?"x":"y"),v=b>Fo?b:Fo,L=[0,v,-v];for(const y of L){const M={...i},E={...x};if(u){if(M.x+=y,E.x+=y,M.x<=p.rect.left||M.x>=p.rect.right||E.x<=I.rect.left||E.x>=I.rect.right)continue}else if(M.y+=y,E.y+=y,M.y<=p.rect.top||M.y>=p.rect.bottom||E.y<=I.rect.top||E.y>=I.rect.bottom)continue;if(!Pt(M,E,o,[c,g],1)&&!Qe(M,E,t,f,{epsilon:Cn})){f.points=[M,E];break}}}}d(Ts,"straightenCollinearSiblingDetours");function Wn(t,e){const{realNodeRects:l,labelNodeRects:c}=Me(e.values()),g=d((y,M)=>Be(M,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=M.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const M of t){if(M.isLayoutOnly)continue;const E=M.points;!E||E.length<2||y.push(...g(M,xt(E)))}return y},"allSegments"),I=d((y,M)=>y.horizontal&&M.horizontal?Wt(y.a.x,y.b.x,M.a.x,M.b.x)>=8&&Math.abs(y.a.y-M.a.y)<7:y.vertical&&M.vertical?Wt(y.a.y,y.b.y,M.a.y,M.b.y)>=8&&Math.abs(y.a.x-M.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,M)=>{const E=y.start,w=y.end,B=g(y,M);if(B.length!==M.length-1)return!1;const O=[E,w].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,l,O,-2)||Pt(H.a,H.b,c,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(I(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,M)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const w=E.map(B=>({...B}));if(y.horizontal)w[y.index].y+=M,w[y.index+1].y+=M;else if(y.vertical)w[y.index].x+=M,w[y.index+1].x+=M;else return;return g(y.edge,w).length===w.length-1?w:void 0},"shiftedCandidate"),i=d((y,M)=>({x:y.x??(M.left+M.right)/2,y:y.y??(M.top+M.bottom)/2}),"nodeCenter"),x=d(y=>{const M=y.edge,E=xt(M.points??[]);if(E.length!==4||y.index!==1)return;const w=M.start?e.get(M.start):void 0,B=M.end?e.get(M.end):void 0,O=w?te(w):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!w||!B||!O||!k||H.length===0))return{sourceCenter:i(w,O),targetCenter:i(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,M,E,w,B,O)=>{const k=w.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+M;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,M,E,w,B,O)=>{const k=w.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+M;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,M)=>{const E=x(y);if(E){if(y.vertical)return C(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const M=p();let E=!1;for(let w=0;wP.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(Wn,"nudgeSharedInteriorSubpaths");function As(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=o.x-n.x,a=o.y-n.y,l=s*a-r*f;if(Math.abs(l)<1e-10)return!1;const c=n.x-t.x,g=n.y-t.y,p=(c*a-g*f)/l,I=(c*r-g*s)/l,u=.01;return p>u&&p<1-u&&I>u&&I<1-u}d(As,"segmentsIntersect");function ws(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<2)continue;const c=a.start,g=a.end,p=a.labelNodeId,I=a.id??`${c}->${g}`;for(const u of s)if(!(u.nodeId===c||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h0){const a=o.filter(c=>c.type==="edge-node-overlap").length,l=o.filter(c=>c.type==="edge-edge-crossing").length;Ln.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${l} edge crossing(s)`);for(const c of o)Ln.warn(`[SWIMLANE_VALIDATE] ${c.type}: ${c.detail}`)}return o}d(ws,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ys(t,e)||e==="BT"&&s.length>0&&!ms(t))return;for(const a of o){if(a.isLayoutOnly)continue;const l=a.points;!l||l.length<2||(a.points=ue(tn(l)))}Ls(o,n),Ts(o,n),ps(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Ke(o,r),is(o,r),xs(o,r),Wn(o,r),bs(o,r),Ms(o,r),Gn(o,r),Is(o,r);const f=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ke(o,r),Xn(o,r),Gn(o,r),Ke(o,r),Xn(o,r)},"finalizeRenderedEdges");f(),Wn(o,r),f(),$n(o,r),zn(o,r),$n(o,r),zn(o,r)}d(Rs,"postProcessSwimlaneLayout");function Ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const f=`${r.id}:${r.src}->${r.dst}`;n.has(f)||(n.add(f),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function xo(t,e){return t.edges.filter(n=>n.dst===e)}d(xo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function bo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(bo,"buildSortedSuccessorMap");function Mo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(Mo,"buildInDegreeMap");function Io(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Io,"sortedZeroInDegreeNodes");function fn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(fn,"buildPredecessorSuccessorMaps");function So(t,e,n,o){var f,a;let s=0;for(const l of t.nodes)o!=null&&o.skipGroups&&((f=t.nodeById.get(l))!=null&&f.isGroup)||(s=Math.max(s,n[l]??0));const r=Array.from({length:s+1},()=>[]);for(const l of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(l))!=null&&a.isGroup)||r[Math.max(0,n[l]??0)].push(l);return r}d(So,"buildLayersFromRanks");function _e(t){const e=Mo(t),n=Io(e),o=[],s=bo(t);for(;n.length;){const r=n.shift();o.push(r);for(const f of s.get(r)??[])if(e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0){let a=0;for(;a{if(s-o<=1)return 0;const r=o+s>>1;let f=n(o,r)+n(r,s),a=o,l=r,c=o;for(;a=s||ap.dst===I.dst?p.id.localeCompare(I.id):p.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const I=p.dst;o[I]===0?r(I):o[I]===1&&s.push(p)}o[g]=2},"dfs"),f=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of f)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),l=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:l,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function ge(t){const e=Ps(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function dn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(dn,"buildTopLaneOrder");function vo(t,e){const n=dn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const f of e)!o.has(f)||s.has(f)||(s.add(f),r.push(f));for(const f of n)s.has(f)||r.push(f);return r}d(vo,"resolveTopLaneOrder");var _r={EPSILON:1e-6},rn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},_o={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=fn(n);for(const y of r.values())y.sort((M,E)=>M.localeCompare(E));const f=_e(n)??[...n.nodes].sort((y,M)=>y.localeCompare(M)),a=new Map;for(const[y,M]of f.entries())a.set(M,y);const l=new Map,c=new Map;for(const y of n.nodes)c.set(y,[]);for(const y of f){const M=(r.get(y)??[]).filter(E=>l.has(E));if(M.length>0){const E=ks(y,M,{laneOf:o,rankHint:s,topoIndex:a});l.set(y,E),c.get(E).push(y)}else l.has(y)||l.set(y,null)}for(const y of n.nodes)l.has(y)||l.set(y,null);const g=new Set;for(const y of n.nodes)(l.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,M)=>{const E=a.get(y)??0,w=a.get(M)??0;return E===w?y.localeCompare(M):E-w}),I=Fs(n),u=new Map;for(const[y,M]of I.entries())u.set(y,[...M].sort((E,w)=>E.localeCompare(w)));const h=_s(u),i=Ds(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of i)for(const M of y.nodes){const E=x.get(M);E?E.push(y.id):x.set(M,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const M of c.get(y)??[])L(M);b.push(y)}},"walk");for(const y of p)L(y);for(const y of f)L(y);return{parent:l,children:c,roots:p,componentOf:h,blocks:i,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:f}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,f)=>{var i,x;const a=n.laneOf(r),l=n.laneOf(f),c=a!=null&&a===o,g=l!=null&&l===o;if(c!==g)return c?-1:1;const p=(i=n.rankHint)==null?void 0:i[r],I=(x=n.rankHint)==null?void 0:x[f];if(p!=null&&I!=null&&p!==I)return I-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(f)??0;return u!==h?u-h:r.localeCompare(f)})[0]}d(ks,"chooseParent");function Fs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Fs,"buildAdjacency");function _s(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const f of t.get(r)??[])e.has(f)||s.push(f)}}n++}return e}d(_s,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const f=d((a,l)=>{e.set(a,++r),n.set(a,r);for(const c of t.get(a)??[])c!==l&&(e.has(c)?(e.get(c)??0)<(e.get(a)??0)&&(o.push([a,c]),n.set(a,Math.min(n.get(a)??r,e.get(c)??r))):(o.push([a,c]),f(c,a),n.set(a,Math.min(n.get(a)??r,n.get(c)??r)),(n.get(c)??0)>=(e.get(a)??0)&&s.push(Hs(a,c,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||f(a,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const f=n.pop();if(s.push(f),r.add(f[0]),r.add(f[1]),f[0]===t&&f[1]===e||f[0]===e&&f[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,f=new Array(r).fill(-1),a=new Array(r).fill(0),l=[],c=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(f[L]=-1,a[L]=0,c.has(b)||(c.add(b),l.push(b)))}for(;l.length>0;){const b=l.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(c.has(y))continue;const M=s.get(y);M!=null&&(f[M]=v,a[M]=a[v]+1,c.add(y),l.push(y))}}for(const b of o){if(c.has(b))continue;const v=s.get(b);v!=null&&(f[v]=-1,a[v]=0,c.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b{if(b===-1||v===-1)return-1;a[b]>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const M=p[y][b],E=p[y][v];M===-1||E===-1||M!==E&&(b=M,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],M=e[L];if(y==null||M==null||(y>M&&([v,L]=[L,v],[y,M]=[M,y]),y==null||M==null||y===M))continue;const E=s.get(v),w=s.get(L);if(E==null||w==null)continue;const B=I(E,w);if(B===-1)continue;const O=u[B];for(let k=y;k{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,M=n.children.get(b)??[];for(const E of M){const w=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=w.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}i(y,w)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let f=n[r]??0;const a=[...e.get(r)??[]];a.sort(Lo(n));for(const l of a){s(l);const c=o.get(l);c!=null&&(f=Math.min(f,c))}o.set(r,f)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Lo(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Lo,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const l of e){const c=n[l]??0;c>s&&(s=c)}const r=Array.from({length:s+1},()=>[]),f=new Set,a=d(l=>{if(f.has(l))return;f.add(l);const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l);for(const g of o(l))a(g)},"emit");for(const l of t)a(l);for(const l of e)if(!f.has(l)){const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l),f.add(l)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const f=e[s]??0,a=[],l=[],c=n.get(s);for(const g of r){const p=o.get(g)??f;p>f?a.push({child:g,min:p}):l.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),l.sort((g,p)=>{const I=(c==null?void 0:c.get(g))??0,u=(c==null?void 0:c.get(p))??0;if(I!==u)return I-u;const h=o.get(g)??f,i=o.get(p)??f;return h!==i?h-i:g.localeCompare(p)}),[...a.map(g=>g.child),...l]}}d(zs,"createChildOrderer");function cn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const f=Xs(t,e,o),a=[...r].sort(Lo(e)),l=Ys(a,s,e),c=zs(s,e,f,l);let g=Gs(a,t.nodes,e,c);return g=$s(g),g}d(cn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),f=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&f.push(r.get(a.dst));return Co(f)}d(Vs,"countCrossingsBetweenAdjacent");function Kn(t,e,n){const o=[];for(const r of e){const f=n[r.src],a=n[r.dst];if(f==null||a==null||f===a)continue;let l=r.src,c=r.dst,g=f,p=a;f>a&&(l=r.dst,c=r.src,g=a,p=f);for(let I=g;I(n[I]??0)-(n[p]??0));for(const p of g){const I=n[p]??0;if(I===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=I)continue;const h=I;n[p]=u;const i=cn(t,n,s),x=Kn(i,t.edges,n);x(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const f=t.edges.filter(i=>i.src===s);if(f.length===0)continue;let a=!1,l=0;for(const i of f){const x=n(i.dst);x==null||x===r?a=!0:l++}if(l===0||a)continue;let c=0,g=!1;for(const i of t.edges){if(i.dst!==s)continue;const x=n(i.src);x&&(x===r?g=!0:c++)}if(c>0||!g)continue;const p=e[s]??0,I=p+l;let u=0;for(const i of t.edges)i.dst===s&&(u=Math.max(u,(e[i.src]??0)+1));const h=Math.max(p,u,I);h!==p&&(e[s]=h)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=Ie(t),o=_e(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let f=Object.create(null);for(const l of o){const c=xo(n,l),g=e!=null&&e.ignoreCrossLaneEdges?c.filter(p=>{const I=r(p.src),u=r(l);return!I||!u?!0:I===u}):c;if(g.length===0)f[l]=0;else if(s&&g.length===1){const p=g[0].src,I=r(p),u=r(l);I!==u?f[l]=f[p]??0:f[l]=(f[p]??0)+1}else{let p=-1/0;for(const I of g)p=Math.max(p,(f[I.src]??0)+1);f[l]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(f=js(n,f)),e!=null&&e.ignoreCrossLaneEdges&&Us(n,f),{layers:cn(n,f,r),rankOf:f,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=Ie(t),s={...Ws(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:f,succs:a}=fn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const i=r(h.src),x=r(h.dst);if(i&&x&&i!==x)return!1}return!0}),l=_e(n)??[...n.nodes],c=[...l].reverse(),g=d((h,i)=>{let x=0;for(const v of f.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,i)),Math.min(Math.max(i,x),C)},"clampFeasible"),p=rn.GRAVITY_ITERATIONS,I=d(h=>{let i=!1;for(const x of h){const C=f.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,w)=>E+(s[w]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,w)=>E+(s[w]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),M=g(x,y);M!==s[x]&&(s[x]=M,i=!0)}return i},"relaxOrder");for(let h=0;h0){const x=Math.min(...i.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:So(n,l,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=Mo(t),n=bo(t);let o=Io(e);const s=[];for(;o.length>0;){const r=[];for(const f of o){s.push(f);for(const a of n.get(f)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((f,a)=>f.localeCompare(a))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?qs(n)??[...n.nodes].sort():_e(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),f=Object.create(null),a=new Map,l=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const I=xo(n,g);let u=0;if(I.length>0)for(const C of I){const b=C.src,v=f[b]??0;u=Math.max(u,v+l(b,g))}const h=r(g),i=a.get(h)??0,x=Math.max(u,i);f[g]=x,a.set(h,x+1)}return{layers:So(n,o,f,{skipGroups:!0}),rankOf:f,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let f=0;const a=new Map(n.nodeById),l=d(u=>{const h=`placeholder-${f++}`,i={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,i),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),c=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of c){const h=o[u.src]??0,i=o[u.dst]??0;if(i-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function qn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(qn,"median");function Jn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Jn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function Zn(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),f=ke(e),a=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&a.push({u:r.get(c.src),v:f.get(c.dst)});a.sort((c,g)=>c.u===g.u?c.v-g.v:c.u-g.u);const l=a.map(c=>c.v);return Co(l)}d(Zn,"countCrossingsBetweenAdjacent");function qe(t,e,n){return[...t].sort((o,s)=>{const r=qn(e.get(o)??[]),f=qn(e.get(s)??[]);return r===f?tr(o,s,n):isFinite(r)?isFinite(f)?r-f:-1:1})}d(qe,"sortByHeuristic");function Qn(t,e,n,o,s,r){const f=ke(t),a=ke(e),l=Qs(e,f,n,o);if(!s||!r||r.length===0)return qe(e,l,a);const c=new Map;for(const I of e){const u=s(I),h=c.get(u)??[];h.push(I),c.set(u,h)}const g=[];for(const I of r){const u=c.get(I);if(!u||u.length===0)continue;const h=qe(u,l,a);g.push(...h)}const p=c.get(null);if(p&&p.length>0){const I=qe(p,l,a);for(const u of I){const h=Jn(l.get(u)??[]);let i=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Jn(l.get(C)??[]);if(hf.has(i.src)&&a.has(i.dst)),g=l?n.filter(i=>a.has(i.src)&&l.has(i.dst)):void 0,p=d(i=>{let x=Zn(t,i,c);return g&&o&&(x+=Zn(i,o,g)),x},"crossingScore"),I=s?new Map:null;if(s&&I)for(const i of e)I.set(i,s(i));let u=!0,h=p(r);for(;u;){u=!1;for(let i=0;i+1[...a]),s=e.edges,r=ge(e),f=vo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let l=1;l=0;l--)o[l]=Qn(o[l+1],o[l],s,"up",r,f),o[l]=to(o[l+1],o[l],s,o[l-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=(n==null?void 0:n.layerGap)??_o.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??_o.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,f=(n==null?void 0:n.direction)??"TB",a=f==="LR"||f==="RL",l=t.layers,c=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),i=vo(e,n==null?void 0:n.laneOrder),x=l.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1Math.max(Mt,I(Ht)),0),H=l[O+1].reduce((Mt,Ht)=>Math.max(Mt,I(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of l)for(const k of O)b.add(h(k));const v=b.has(null),L=i.filter(O=>b.has(O)),y=[...v?[null]:[],...L],M=Object.create(null);for(const O of L)M[O]=0;v&&(M.null=0);for(const O of l){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+I(ft),0)+s*Math.max(0,G.length-1);M[P]=Math.max(M[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);M.null=Math.max(M.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?M.null:M[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;PI(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let _t=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];c[J]=_t+rt/2,g[J]=w+H/2,_t+=rt+s}}}const G=C[O]??0;w+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((c[H]??0)+(c[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(c[tt]=G)}}return{x:c,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function eo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:f}of e){const a=n.get(s),l=n.get(r);a==null||l==null||(o+=f*Math.abs(a-l))}return o}d(eo,"laneArrangementCost");function ar(t){const e=dn(t);if(e.length<2)return[];const n=new Map(e.map((r,f)=>[r,f])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const f=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!f||!a||!t.nodeById.has(f)||!t.nodeById.has(a))continue;const l=o(f),c=o(a);if(!l||!c||l===c)continue;const g=n.get(l),p=n.get(c);if(g==null||p==null)continue;const[I,u]=g<=p?[l,c]:[c,l],h=`${I}\0${u}`,i=s.get(h);i?i.weight++:s.set(h,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function no(t,e,n){const o=[...t];let s=eo(o,e),r=!0,f=0;const a=Math.max(1,o.length);for(;r&&fs.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:f})=>`${s}:${r}:${f}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=dn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((a,l)=>[a,l]));let r=no(n,o,s);const f=Math.max(0,e.restarts??or);for(let a=0;alt&&l*3>=a?f>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(oo,"chooseOrthogonalSide");function so(t,e){return Math.abs(t.to-e.from)m.isGroup&&!m.parentId);for(const m of c){const S={id:m.id},A=d(T=>{f.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(A)},"assignLane");A(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,A=m.height??10,T=m.x??0,N=m.y??0,D=Dr;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-A/2-D,maxY:N+A/2+D,visualXHalfExtent:l?A/2+D:S/2+D}}),p=d((m,S,A,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:A,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,A),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),I=d((m,S)=>{const A=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-A/2,y:D};case"right":return{x:N+A/2,y:D}}},"portForSide"),u=d((m,S,A)=>I(m,oo(m,S,A?"bottom":"top")),"getOrthogonalPort"),h=[],i=[],x=new Set,C=1e3,b=d((m,S,A)=>{if(h.length===0)return 0;const T=Math.abs(S.y-A.y)U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,A.y)-lt,U=Math.max(S.y,A.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coordU||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const A=r.get(m.start),T=r.get(m.end),N=f.get(m.start),D=f.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=A&&T?Math.abs((T.x??0)-(A.x??0)):0,U=A&&T?Math.abs((T.y??0)-(A.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const A=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(A-T)>1?A-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,A,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>A&&z.nodeId===A||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minYm.y&&z.maxX>N&&z.minXm.x&&z.maxY>W&&z.minYoo(m,S,"bottom"),"determineSide"),w=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const N=(T.x??0)-(A.x??0),D=(T.y??0)-(A.y??0);w.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(A,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:A.x??0,y:A.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of w.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of w.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,A)=>{const T=B(S),N=B(A);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-A.edgeIdx});for(let S=1;S=N||(H.set(P(A.srcId,A.srcSide),N-1),H.set(P(A.srcId,T),D+1),A.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of w.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of w.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const A=O(m);if(S.has(A)||(H.get(P(m.srcId,A))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,A),1),m.srcSide=A}for(const m of w.values()){const{edgeIdx:S,srcId:A,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(A),ot=r.get(T),U=`${A}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((wt,Gt)=>wt.oppositeCoord-Gt.oppositeCoord);const A=m.split(":"),T=A.slice(0,-2).join(":"),N=A[A.length-2],D=A[A.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[wt,Gt]of S.entries()){const ee=Bt+wt*st,mn=`${Gt.edgeIdx}:${D}`;tt.set(mn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:A})=>Mt(A))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:A})=>Mt(A)):!1,"faceHasLabelNode"),_t=d((m,S,A)=>S==="top"||S==="bottom"?{x:m.x+A,y:m.y}:{x:m.x,y:m.y+A},"applyPortOffset"),nt=d((m,S,A)=>{const T=w.get(m),N={x:A.x??0,y:A.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(A,D);let U=T?I(S,T.srcSide):u(S,N,!0),z=T?I(A,T.dstSide):u(A,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=_t(U,W,bt)),dt!==void 0&&(z=_t(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(i[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,A,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(A.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(A.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.xQ.minY&&X.y{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],wt=ct(U,Bt);if(wt.inside&&wt.obstacle){const X=wt.obstacle;if(bt){const $=st(N,A,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,A,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,A,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,A,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)1||Ct>1,kt=M.get(S.start??"")??0,mt=M.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const mn=p("vertical",U.x,U.y,U.y);U.x=mn.coord;const pr=p("vertical",z.x,z.y,z.y);z.x=pr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,Ae=Math.min(U.y,z.y)-50,we=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX$&&X.minYht&&(ye=Math.min(ye,X.minX-We),pe=Math.max(pe,X.maxX+We),Ae=Math.min(Ae,X.minY-We),we=Math.max(we,X.maxY+We))}for(const X of g){if(X.maxXpe||X.maxYwe)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,Ae,we),p("vertical",X.maxX+Q,Ae,we)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const xr=a.filter(X=>X.orientation==="horizontal"&&X.coord>=Ae&&X.coord<=we),br=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),De=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),He=De(U.x,U.y),Eo=De(z.x,z.y),Xe=new Map,yn=new Map,pn=new Map,Ye=new Set,Se=[];Xe.set(He,0),pn.set(He,"n"),Se.push({key:He,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ye.add(He);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),xn={x:z.x,y:U.y},Mr=xe(U,xn),Ir=xe(xn,z),Sr=Mr||Ir,bn={x:U.x,y:z.y},Cr=xe(U,bn),vr=xe(bn,z);if(Sr?Cr||vr||(Math.abs(U.x-z.x)0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ye.delete(X.key),X.key===Eo){let mt=Eo,Vt=z;for($t=[Vt];yn.has(mt);){const re=yn.get(mt);$t.unshift(re),Vt=re,mt=De(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=br.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=xr.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rtne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minYQ&&ne.maxX>Vt&&ne.minX$&&ne.maxY>Dt&&ne.minY10&&Mn<-5||Re<-10&&Mn>5)&&(Et=Math.abs(Mn)*100),(Zt>10&&Ge<-5||Zt<-10&&Ge>5)&&(Et+=Math.abs(Ge)*50);let To=0;const Ao=pn.get(X.key)??"n",wo=Math.abs(Ge)>lt?"h":"v";Ao!=="n"&&Ao!==wo&&(To=50);const Lr=Ut+Lt+Et+To,$e=(Xe.get(X.key)??1/0)+Lr,Ro=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if($e<(Xe.get(vt)??1/0))if(yn.set(vt,X.pt),Xe.set(vt,$e),pn.set(vt,wo),!Ye.has(vt))Se.push({key:vt,f:$e+Ro,pt:mt}),Ye.add(vt);else{const ne=Se.findIndex(Er=>Er.key===vt);ne!==-1&&(Se[ne].f=$e+Ro)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=QLt.minXjt&&Lt.minYFt);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(Ft=>Ft.minXMath.min(X.y,$.y));if(jt.length>0){let Ft=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;Ft=Math.min(Ft,Lt)}Q=Ft}}}const mt=d(Dt=>{const jt=$.y>X.y,Ft=g.filter(Lt=>{const Et=Math.min(X.x,$.x)Lt.minX,Zt=Math.min(X.y,$.y)Lt.minY;return Et&&Zt});let vt=Ft;if(l&&Ft.length>0){const Lt=Ft.filter(Et=>Et.minXDt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),Ft={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,Ft),Et=xe(Ft,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;Xm.from{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!A.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=A.index,A.segments=[...A.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const A=m.pipe.tracks[m.trackIndex];A.segments=A.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const A=i[m.edgeIndex];for(const T of A){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),At=d(m=>{const S=i[m.edgeIndex],A=S.indexOf(h.indexOf(m)),T=[];return A>0&&T.push(h[S[A-1]]),A{if(m.orientation===S.orientation)return!1;const A=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>A.from&&T.pipe.coordT.from&&A.pipe.coord{for(const A of m.tracks)if(!A.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return A.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const A=At(m),T=At(S);return A.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,A)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);A(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let A=0;A{if(me.has(m))return me.get(m);const S=i[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;otMath.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),un=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())i[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const A=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=A(D),bt=A(W);if(Math.abs(z-bt)>1)return bt-z;const dt=i[D].length,ct=i[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=i[D][0],It=i[W][0];if(h[st]&&h[It]){const Bt=h[st],wt=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(wt.to-wt.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[i[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),hn=d(()=>{let m=0;const S=new Map;for(const[A,T]of s.entries())i[A].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(A));for(const A of S.values()){A.sort((N,D)=>{const W=d(z=>{const bt=i[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=A.map(N=>h[i[N][i[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),gn=d(()=>{let m=0;for(const S of a){const A=[];for(const T of S.tracks)for(const N of T.segments){const D=i[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&A.push(h[D])}A.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const A=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;DN.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const wt=x.has(Bt.edgeIndex)?m.coord:It;_.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,wt)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*vn);if(U.length===0&&N.size>0){const st=[...N].sort((wt,Gt)=>Math.abs(D.get(wt)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*vn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*vn)}}for(const[m,S]of s.entries()){const A=i[m]??[];if(A.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=A.map(dt=>{const ct=h[dt],st=_.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dtlt&&T.push(ve(ct,It)),Gt&&wt.orient===ct.orient)if(Math.abs(ct.coord-wt.coord)>lt){const ee=ct.orient==="vertical"?(It+wt.from)/2:so(ct,wt);T.push(ve(ct,ee),ve(wt,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,so(ct,wt)));else if(Gt)T.push(ve(ct,wt.coord));else{const ee=Math.abs(ct.from-It)lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dtlt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const A=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=A-N/2,ot=A+N/2,U=T-D/2,z=T+D/2;if(m.xot||m.yz)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const A=m.start,T=m.end,N=A?r.get(A):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function mr(t){var g,p,I,u,h;const e=Jo(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((I=t.config.swimlane)==null?void 0:I.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,f=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=gr(t),{ordered:l,coordinates:c}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:f,direction:a});Zo(e,l,c,{nodeGap:n,layerGap:o});for(const i of t.edges??[])delete i.points;hr(t,a);for(const i of t.edges??[])(!i.curve||i.curve==="basis")&&(i.curve="rounded");return Rs(t,a),ws(t),a}d(mr,"runSwimlaneLayoutCore");function yr(t){qo(t);const e=Qo(t);t.nodes=e.nodes,t.edges=e.edges}d(yr,"prepareSwimlaneLayout");var $r=Tr({prepareLayout:yr,runLayoutCore:mr,afterPaint:Wo});export{$r as render}; diff --git a/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js b/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js new file mode 100644 index 000000000..ecf1a757f --- /dev/null +++ b/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js @@ -0,0 +1,8 @@ +import{c as r,s as e}from"./flowDiagram-HODETNUW-Bfis7KwQ.js";import{_ as a}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-5VM5RSS4-XkKVGNmc.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./channel-CSv1n6Zd.js";var o=a(t=>`${e(t)} + .swimlane.cluster rect { + stroke: ${t.clusterBorder} !important; + } + [data-look="neo"].cluster rect { + filter: none; + } +`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-DNn1qeTZ.js b/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-DNn1qeTZ.js deleted file mode 100644 index 6f5217967..000000000 --- a/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-DNn1qeTZ.js +++ /dev/null @@ -1,8 +0,0 @@ -import{c as r,s as e}from"./flowDiagram-HODETNUW-DrKzI2V6.js";import{_ as a}from"./mermaid.core-CDlaSEyP.js";import"./chunk-5VM5RSS4-DlVFuaV7.js";import"./chunk-XXDRQBXY-BvgnYF8f.js";import"./chunk-POPQ4Y6H-fljvmLmW.js";import"./chunk-F27PBJKO-D9qW0VD2.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";import"./channel-BqsL4B4X.js";var o=a(t=>`${e(t)} - .swimlane.cluster rect { - stroke: ${t.clusterBorder} !important; - } - [data-look="neo"].cluster rect { - filter: none; - } -`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/amplifier_web/static/assets/timeline-definition-24CTP7MA-CD71W6Ad.js b/amplifier_web/static/assets/timeline-definition-24CTP7MA-Ck5GR00U.js similarity index 99% rename from amplifier_web/static/assets/timeline-definition-24CTP7MA-CD71W6Ad.js rename to amplifier_web/static/assets/timeline-definition-24CTP7MA-Ck5GR00U.js index a3d7859bc..8752aed1e 100644 --- a/amplifier_web/static/assets/timeline-definition-24CTP7MA-CD71W6Ad.js +++ b/amplifier_web/static/assets/timeline-definition-24CTP7MA-Ck5GR00U.js @@ -1,4 +1,4 @@ -import{_ as l,y as pt,U as Wt,V as Pt,W as Bt,c as gt,l as S,D as Vt,L as Ft,X as ft,j as J,t as zt,Y as Gt,p as Ot}from"./mermaid.core-CDlaSEyP.js";import{d as ot}from"./arc-DXFEdbiI.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var X="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?X="Parse error on line "+(M+1)+`: +import{_ as l,y as pt,U as Wt,V as Pt,W as Bt,c as gt,l as S,D as Vt,L as Ft,X as ft,j as J,t as zt,Y as Gt,p as Ot}from"./mermaid.core-BQ5lTCZr.js";import{d as ot}from"./arc-CxD3pp7w.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var X="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?X="Parse error on line "+(M+1)+`: `+_.showPosition()+` Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":X="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,C=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},q&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,C,M,R.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/vennDiagram-4TSXK5OY-BWkGFFy0.js b/amplifier_web/static/assets/vennDiagram-4TSXK5OY-kVi8iDPL.js similarity index 99% rename from amplifier_web/static/assets/vennDiagram-4TSXK5OY-BWkGFFy0.js rename to amplifier_web/static/assets/vennDiagram-4TSXK5OY-kVi8iDPL.js index d05b7c516..63b1eca59 100644 --- a/amplifier_web/static/assets/vennDiagram-4TSXK5OY-BWkGFFy0.js +++ b/amplifier_web/static/assets/vennDiagram-4TSXK5OY-kVi8iDPL.js @@ -1,4 +1,4 @@ -import{b1 as Gt,s as Kt,g as Ht,o as Yt,n as Xt,a as Zt,b as Jt,_ as S,y as St,D as Qt,j as rt,am as $t,U as te,V as ee,W as ne,d as se,p as ie,A as re,B as oe}from"./mermaid.core-CDlaSEyP.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let h=e[e.length-1];for(let u=0;uy.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(h)ct(n))}function tt(t,n){let s=0;for(let e=0;ev.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx=1)break;for(let f=1;fl+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a{const p={};for(let d=0;dxt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;ul===h?0:lr.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;dp.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;mt[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function q(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function U(I){return C=>{const W=I.sets.map(J=>{let G=V[J],X=k[J];return G||(G={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:G.x*(1-C)+X.x*C,y:G.y*(1-C)+X.y*C,radius:G.radius*(1-C)+X.radius*C}});return wt(W,y)}}const A=B.selectAll(".venn-area").data(f,I=>I.sets),j=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),F=j.append("path"),L=j.append("text").attr("class","label").text(I=>q(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(F.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",U)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const D=_.selectAll("text").filter(I=>I.sets in R).text(I=>q(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in D?D.on("end",ot(k,q)):D.each("end",ot(k,q)):D.each(ot(k,q)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",U);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),Y.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:j,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` +import{b1 as Gt,s as Kt,g as Ht,o as Yt,n as Xt,a as Zt,b as Jt,_ as S,y as St,D as Qt,j as rt,am as $t,U as te,V as ee,W as ne,d as se,p as ie,A as re,B as oe}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let h=e[e.length-1];for(let u=0;uy.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(h)ct(n))}function tt(t,n){let s=0;for(let e=0;ev.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx=1)break;for(let f=1;fl+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a{const p={};for(let d=0;dxt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;ul===h?0:lr.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;dp.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;mt[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function q(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function U(I){return C=>{const W=I.sets.map(J=>{let G=V[J],X=k[J];return G||(G={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:G.x*(1-C)+X.x*C,y:G.y*(1-C)+X.y*C,radius:G.radius*(1-C)+X.radius*C}});return wt(W,y)}}const A=B.selectAll(".venn-area").data(f,I=>I.sets),j=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),F=j.append("path"),L=j.append("text").attr("class","label").text(I=>q(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(F.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",U)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const D=_.selectAll("text").filter(I=>I.sets in R).text(I=>q(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in D?D.on("end",ot(k,q)):D.each("end",ot(k,q)):D.each(ot(k,q)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",U);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),Y.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:j,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` M`,t,n),e.push(` m`,-s,0),e.push(` a`,s,s,0,1,0,s*2,0),e.push(` diff --git a/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-DixAstWQ.js b/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js similarity index 99% rename from amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-DixAstWQ.js rename to amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js index 0f7740fc8..e70842c0d 100644 --- a/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-DixAstWQ.js +++ b/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js @@ -1,4 +1,4 @@ -import{p as zt}from"./chunk-JWPE2WC7-DxHQQjxU.js";import{s as Lt,g as Tt,o as At,n as Xt,a as Et,b as Yt,_ as y,E as It,y as Bt,A as Q,l as et,D as Ft,d as Rt,p as Ot,c as V}from"./mermaid.core-CDlaSEyP.js";import{p as Wt}from"./cynefin-OW5HDTMX-BZuqA1Xc.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map +import{p as zt}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{s as Lt,g as Tt,o as At,n as Xt,a as Et,b as Yt,_ as y,E as It,y as Bt,A as Q,l as et,D as Ft,d as Rt,p as Ot,c as V}from"./mermaid.core-BQ5lTCZr.js";import{p as Wt}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map `+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),L=v.getDiagramTitle(),M=((J=g.size)==null?void 0:J.width)??r.width,k=((K=g.size)==null?void 0:K.height)??r.height,N=Ft(o);N.selectAll("*").remove(),Rt(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const B=M-r.padding*2,F=k-r.padding*2;L&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(L);const T=y(t=>r.padding+t/100*B,"projectX"),A=y(t=>k-r.padding-t/100*F,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+B/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+F/2})`).text(bt);const R=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(R.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===R.length){let i=0;n.forEach(h=>{s.push({start:i,end:h}),i=h})}else{const i=1/R.length;R.forEach((h,l)=>{s.push({start:l*i,end:(l+1)*i})})}R.forEach((i,h)=>{const l=s[h],x=r.padding+l.start*B,f=r.padding+l.end*B,u=(x+f)/2;h>0&&t.append("line").attr("x1",x).attr("x2",x).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+B*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-F*s).attr("y2",k-r.padding-F*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:T(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f{const u=c.get(f);u&&(h=Math.min(h,u.x),l=Math.max(l,u.x),x=u.y)}),h!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=x-u/2,S=c.get(s.nodeId);if(S){const z=(h+l)/2;S.x=z,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",w).attr("width",l-h+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.x+l/f*h}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.y+x/f*h}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.x+l/f*h}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.y+x/f*h}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=s.y-n.y,l=s.x-n.x,x=Math.sqrt(l*l+h*h),f=8,u=h/x;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,h=s.x-n.x,l=s.y-n.y,x=Math.sqrt(h*h+l*l),f=8,u=-h/x;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=(n.y+s.y)/2,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x),u=8,w=x/f,S=-l/f,z=i+w*u,W=h+S*u;let Y=Math.atan2(x,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${z} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=T(t.targetX),i=A(t.targetY),h=s-n.x,l=i-n.y,x=Math.sqrt(h*h+l*l),f=r.nodeRadius+2,u=x>f?s-h/x*f:s,w=x>f?i-l/x*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:T(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i{const h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=T(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,h=16,l=11,x=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const z=x.append("text").attr("x",n+i).attr("y",s+i+(S+1)*h).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(z)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const z=w+i*2+105,W=f.length*h+i*2+S/2,Y=r.padding,Pt=M-r.padding-z,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*h)}),x.insert("rect","text").attr("x",n).attr("y",s).attr("width",z).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=T(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=T(n.x),i=A(n.y),h=60,l=30,x=20,f=` M ${s} ${i-l/2} L ${s+h-x} ${i-l/2} diff --git a/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DgwC-FOX.js b/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js similarity index 99% rename from amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DgwC-FOX.js rename to amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js index bd5b29ec4..320c0b9b1 100644 --- a/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DgwC-FOX.js +++ b/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js @@ -1,4 +1,4 @@ -import{s as pi,g as mi,o as $t,n as yi,a as bi,b as wi,_ as a,l as Ut,D as Ai,d as Ci,p as Si,y as Dt,i as Ri,A as Gt,B as _i,E as ki,aB as Ti,Q as Xt}from"./mermaid.core-CDlaSEyP.js";import{i as Di}from"./init-Gi6I4Gst.js";import{o as Pi}from"./ordinal-Cboi1Yqb.js";import{l as Nt}from"./linear-DE4AveAz.js";import"./app-W22-ExtL.js";import"./client-BPXDbY79.js";import"./defaultLocale-DX6XiGOO.js";function vi(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s"u"&&(P.yylloc={});var wt=P.yylloc;r.push(wt);var xi=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(B){d.length=d.length-2*B,_.length=_.length-B,r.length=r.length-B}a(fi,"popStack");function Ft(){var B;return B=x.pop()||P.lex()||Vt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=g.symbols_[B]||B),B}a(Ft,"lex");for(var I,U,V,At,j={},xt,Y,Wt,ft;;){if(U=d[d.length-1],this.defaultActions[U]?V=this.defaultActions[U]:((I===null||typeof I>"u")&&(I=Ft()),V=lt[U]&<[U][I]),typeof V>"u"||!V.length||!V[0]){var Ct="";ft=[];for(xt in lt[U])this.terminals_[xt]&&xt>ui&&ft.push("'"+this.terminals_[xt]+"'");P.showPosition?Ct="Parse error on line "+(dt+1)+`: +import{s as pi,g as mi,o as $t,n as yi,a as bi,b as wi,_ as a,l as Ut,D as Ai,d as Ci,p as Si,y as Dt,i as Ri,A as Gt,B as _i,E as ki,aB as Ti,Q as Xt}from"./mermaid.core-BQ5lTCZr.js";import{i as Di}from"./init-Gi6I4Gst.js";import{o as Pi}from"./ordinal-Cboi1Yqb.js";import{l as Nt}from"./linear-BcEdwvr4.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./defaultLocale-DX6XiGOO.js";function vi(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s"u"&&(P.yylloc={});var wt=P.yylloc;r.push(wt);var xi=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(B){d.length=d.length-2*B,_.length=_.length-B,r.length=r.length-B}a(fi,"popStack");function Ft(){var B;return B=x.pop()||P.lex()||Vt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=g.symbols_[B]||B),B}a(Ft,"lex");for(var I,U,V,At,j={},xt,Y,Wt,ft;;){if(U=d[d.length-1],this.defaultActions[U]?V=this.defaultActions[U]:((I===null||typeof I>"u")&&(I=Ft()),V=lt[U]&<[U][I]),typeof V>"u"||!V.length||!V[0]){var Ct="";ft=[];for(xt in lt[U])this.terminals_[xt]&&xt>ui&&ft.push("'"+this.terminals_[xt]+"'");P.showPosition?Ct="Parse error on line "+(dt+1)+`: `+P.showPosition()+` Expecting `+ft.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Ct="Parse error on line "+(dt+1)+": Unexpected "+(I==Vt?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Ct,{text:P.match,token:this.terminals_[I]||I,line:P.yylineno,loc:wt,expected:ft})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+I);switch(V[0]){case 1:d.push(I),_.push(P.yytext),r.push(P.yylloc),d.push(V[1]),I=null,Ot=P.yyleng,m=P.yytext,dt=P.yylineno,wt=P.yylloc;break;case 2:if(Y=this.productions_[V[1]][1],j.$=_[_.length-Y],j._$={first_line:r[r.length-(Y||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(Y||1)].first_column,last_column:r[r.length-1].last_column},xi&&(j._$.range=[r[r.length-(Y||1)].range[0],r[r.length-1].range[1]]),At=this.performAction.apply(j,[m,Ot,dt,$.yy,V[1],_,r].concat(di)),typeof At<"u")return At;Y&&(d=d.slice(0,-1*Y*2),_=_.slice(0,-1*Y),r=r.slice(0,-1*Y)),d.push(this.productions_[V[1]][0]),_.push(j.$),r.push(j._$),Wt=lt[d[d.length-2]][d[d.length-1]],d.push(Wt);break;case 3:return!0}}return!0},"parse")},ht=(function(){var W={EOF:1,parseError:a(function(g,d){if(this.yy.parser)this.yy.parser.parseError(g,d);else throw new Error(g)},"parseError"),setInput:a(function(l,g){return this.yy=g||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var g=l.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:a(function(l){var g=l.length,d=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===x.length?this.yylloc.first_column:0)+x[x.length-d.length].length-d[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(l){this.unput(this.match.slice(l))},"less"),pastInput:a(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var l=this.pastInput(),g=new Array(l.length+1).join("-");return l+this.upcomingInput()+` diff --git a/amplifier_web/static/build.json b/amplifier_web/static/build.json index aad93b4db..8ea50ebbb 100644 --- a/amplifier_web/static/build.json +++ b/amplifier_web/static/build.json @@ -1 +1 @@ -{"version":"0.20.45","id":"c3304b45fe6d541f"} +{"version":"0.20.45","id":"b48fe668835544e3"} diff --git a/amplifier_web/static/index.html b/amplifier_web/static/index.html index 5272ddf76..2f6cdea0f 100644 --- a/amplifier_web/static/index.html +++ b/amplifier_web/static/index.html @@ -16,7 +16,7 @@ Amplifier - +
diff --git a/amplifier_web/update_diagnostics.py b/amplifier_web/update_diagnostics.py index 439933ca6..a3a5dcfd8 100644 --- a/amplifier_web/update_diagnostics.py +++ b/amplifier_web/update_diagnostics.py @@ -45,7 +45,8 @@ def probe_record(output): if isinstance(value.get('reason'),str) and value['reason'] in RECOVERY_REASONS:safe['reason']=value['reason'] for key in ('version','pythonVersion'): if isinstance(value.get(key),str) and re.fullmatch(r'\d+\.\d+\.\d+',value[key]):safe[key]=value[key] - if type(value.get('elapsedMs')) is int and value['elapsedMs']>=0:safe['elapsedMs']=value['elapsedMs'] + for key in ('elapsedMs', 'sources', 'packages', 'resolverTransactions'): + if type(value.get(key)) is int and value[key]>=0:safe[key]=value[key] if 'ok' in safe:records.append(safe) return records[-1] if records else None diff --git a/amplifier_web/update_inventory_index.py b/amplifier_web/update_inventory_index.py new file mode 100644 index 000000000..1c6c3c351 --- /dev/null +++ b/amplifier_web/update_inventory_index.py @@ -0,0 +1,92 @@ +"""Bounded inventory reuse; installation always repeats source preflight. + +Status reads never build a runtime. A generation/configuration change or newly +materialized source invalidates the index. Periodic reconciliation discovers +out-of-band edits; cached availability is never permission to overwrite them. +""" + +from __future__ import annotations + +import hashlib +import json +import time +from pathlib import Path + +RECONCILE_SECONDS = 4 * 3600 + + +def signature(manager): + from .session_files import amplifier_home + from .updates import active_release, foundation_home + + home = Path(manager.home) + base = foundation_home(home) + paths = [ + home / "config", + amplifier_home() / "settings.yaml", + home / "config/settings.yaml", + base / "registry.json", + base / "cache", + base / "cache/.source-bindings", + Path(__file__).with_name("runtime_deps") / "pyproject.toml", + ] + stamps = [] + for path in paths: + try: + value = path.stat() + stamps.append((str(path), value.st_mtime_ns, value.st_size)) + except FileNotFoundError: + stamps.append((str(path), None)) + # Connection/settings edits publish their own revision without reading keys. + selection = manager.service.state.get("settings", {}) + smart = getattr(manager.service, "smart_tools", None) + tools = smart.update_sources() if smart else [] + return hashlib.sha256( + json.dumps( + [ + active_release(home), + stamps, + tools, + selection.get("bundle"), + selection.get("workspace"), + selection.get("revision"), + ], + sort_keys=True, + ).encode() + ).hexdigest() + + +async def inventory(manager, scan): + from .host.config import write_private + + path = manager.directory / "inventory-index.json" + key = signature(manager) + now = time.time() + try: + saved = json.loads(path.read_text()) + if ( + saved.get("schema") == 1 + and saved["signature"] == key + and 0 <= now - saved["scannedAt"] < RECONCILE_SECONDS + ): + rows = saved["rows"] + if not isinstance(rows, list) or any( + not isinstance(row, dict) for row in rows + ): + raise ValueError("Invalid component index") + manager.inventory_evidence = { + "source": "index", + "scannedAt": saved["scannedAt"], + } + return rows + except (OSError, ValueError, KeyError, TypeError): + pass + rows = await scan() + # A concurrent registry edit must not be blessed with the new signature. + if signature(manager) == key: + write_private( + path, + json.dumps({"schema": 1, "signature": key, "scannedAt": now, "rows": rows}), + ) + manager.inventory_evidence = {"source": "reconciliation", "scannedAt": now} + return rows diff --git a/amplifier_web/update_plan.py b/amplifier_web/update_plan.py new file mode 100644 index 000000000..1d10db8b8 --- /dev/null +++ b/amplifier_web/update_plan.py @@ -0,0 +1,142 @@ +"""Explicit qualification plans and reusable generation receipts. + +Unknown sources require full worker qualification. Data-only reuse requires an +allowlisted data contract, an exact before/after tree comparison, and a previously +qualified environment. Repository names alone never grant the fast path. +""" + +from __future__ import annotations + +import asyncio +import json +import shutil +from pathlib import Path + +SCHEMA = 1 +CATALOG = "https://github.com/microsoft/amplifier-smart-tools-catalog" + + +def catalog_data(path): + path = Path(path) + return ( + path.name + in {"README.md", "LICENSE", "SECURITY.md", "SUPPORT.md", "CODE_OF_CONDUCT.md"} + and len(path.parts) == 1 + or path.parts[0] == "tools" + and path.name in {"SMART_TOOL.md", "source.json", "provenance.json"} + or path.as_posix() == "catalog.json" + ) + + +async def tree(root): + from .updates import process + + records = await process("git", "ls-tree", "-rz", "HEAD", cwd=root, raw=True) + return { + row.split(b"\t", 1)[1].decode(): row.split(b"\t", 1)[0].decode() + for row in records.split(b"\0") + if row + } + + +async def build(manager, stage, candidates): + from .runtime_environment import receipt_directory + from .updates import active_release, foundation_home, source_key + + previous = active_release(manager.home).get("current") + receipt = receipt_directory(manager.home, previous) + mode, reason = "worker", "Changed runtime or bundle inputs need preparation" + reusable = (receipt / "runtime-project.json").is_file() and ( + receipt / "runtime-installed.json" + ).is_file() + descriptor = receipt / "profiles-qualified.json" + if reusable and descriptor.is_file(): + from .bundles import offered_profiles + from .host.config import read_config + from .runtime_profiles import configuration_key + + workspace = stage / "qualification-workspace" + workspace.mkdir(exist_ok=True) + config = read_config( + workspace, home=stage, shared_home=stage / "shared-config", global_only=True + ) + offered = json.loads(descriptor.read_text()) + reusable = offered.get("configuration") == configuration_key( + config.settings, manager.home, stage + ) and offered.get("profiles") == offered_profiles(config) + else: + reusable = False # Legacy qualification did not freeze all offered profiles. + data_only = reusable and bool(candidates) + changed = [] + for row in candidates: + if ( + row.get("kind") + in {"runtime dependency", "runtime environment", "included source"} + or not row.get("url") + or source_key(row["url"], row.get("ref") or "HEAD")[0] != CATALOG + ): + data_only = False + break + if row.get("sharedSource"): + from amplifier_foundation.sources.shared import SharedSourceStore + + from .update_sources import store_environment + + store = SharedSourceStore( + store_environment(manager.home)["AMPLIFIER_SOURCE_STORE"] + ) + before = store.checkout(row["url"], row["current"]) + after = store.checkout(row["url"], row["latest"]) + else: + before, after = ( + foundation_home(manager.home) / row["path"], + stage / "foundation" / row["path"], + ) + old, new = await asyncio.gather(tree(before), tree(after)) + paths = { + path for path in old.keys() | new.keys() if old.get(path) != new.get(path) + } + # Symlinks, executables and unknown formats require normal preparation. + if not paths or any( + not catalog_data(path) + or new.get(path, "100644 blob").split()[0] != "100644" + for path in paths + ): + data_only = False + break + for path in paths: + if path in new and path.endswith(".json"): + json.loads((after / path).read_text()) + changed.extend(sorted(paths)) + if data_only: + mode, reason = ( + "data", + "Only catalog data changed; reuse the qualified worker environment", + ) + return { + "schema": SCHEMA, + "mode": mode, + "reason": reason, + "previous": previous, + "changedFiles": sorted(set(changed)), + "activation": "per-worker", + "workerProtocol": 1, + } + + +async def reuse_runtime(manager, stage, plan): + from .runtime_environment import project_path, receipt_directory + from .runtime_qualification import verify_recorded + + previous = plan["previous"] + source = receipt_directory(manager.home, previous) + project = project_path(manager.home, previous) + await asyncio.to_thread(verify_recorded, project, source) + # No installer and no mounting synthetic workers for a catalog edit. + # Copy small evidence files; all generations refer to the same immutable venv. + for path in source.glob("runtime*"): + if path.is_file(): + shutil.copy2(path, stage / path.name) + for name in ("profiles.json", "profiles-qualified.json"): + if (source / name).is_file(): + shutil.copy2(source / name, stage / name) diff --git a/amplifier_web/update_probe.py b/amplifier_web/update_probe.py index c16403f02..348d52d5a 100644 --- a/amplifier_web/update_probe.py +++ b/amplifier_web/update_probe.py @@ -20,20 +20,36 @@ async def main(): parser.add_argument("--refresh-dependencies", action="store_true") parser.add_argument("--install-overrides", type=Path) parser.add_argument("--read-only", action="store_true") + parser.add_argument("--profiles", type=Path) + parser.add_argument("--global-only", action="store_true") + parser.add_argument("--runtime-plan", type=Path) args = parser.parse_args() + runtime_plan = json.loads(args.runtime_plan.read_text()) if args.runtime_plan else None started = time.monotonic() async def deny(*args): return 'deny' facts={'ok':False,'stage':'prepare'} session=None try: - if args.refresh_dependencies: + if args.profiles: + from amplifier_foundation.modules.batch import DependencyBatch from amplifier_web.host.session import prepare_dependencies - await prepare_dependencies(args.workspace,bundle=args.bundle,install_overrides=args.install_overrides) + batch = DependencyBatch() + profiles = json.loads(args.profiles.read_text()) + if not isinstance(profiles, list) or not profiles or any(not isinstance(p, str) for p in profiles): + raise ValueError('Invalid qualification profiles') + for profile in profiles: + await prepare_dependencies(args.workspace, bundle=profile, + install_overrides=args.install_overrides, dependency_batch=batch, global_only=True, runtime_plan=runtime_plan) + report = await batch.install() + facts.update(ok=True, stage='prepared', dependenciesPrepared=True, **report) + elif args.refresh_dependencies: + from amplifier_web.host.session import prepare_dependencies + await prepare_dependencies(args.workspace,bundle=args.bundle,install_overrides=args.install_overrides, global_only=args.global_only, runtime_plan=runtime_plan) facts.update(ok=True,stage='prepared',dependenciesPrepared=True) else: from amplifier_web.host.session import prepare_manager session,runtime,report=await prepare_manager(args.workspace,bundle=args.bundle,resume=False,ask=deny, - install_overrides=args.install_overrides, qualification_readonly=args.read_only) + install_overrides=args.install_overrides, qualification_readonly=args.read_only, global_only=args.global_only, runtime_plan=runtime_plan) facts.update(stage='capabilities',standalone=bool(report.get('standalone')),providersPresent=bool(report.get('providers'))) if not facts['standalone'] or not facts['providersPresent']:raise RuntimeError('Incomplete staged runtime') facts['cliAbsent']=not any(importlib.util.find_spec(name) for name in ('amplifier_app_cli','amplifier_loop_live_cli','amplifier_workspace')) diff --git a/amplifier_web/update_retention.py b/amplifier_web/update_retention.py index 371b79d7e..ad9fbdfca 100644 --- a/amplifier_web/update_retention.py +++ b/amplifier_web/update_retention.py @@ -61,7 +61,7 @@ async def reclaim(manager): from .updates import active_release, process state = manager.service.state["updates"] - if manager.busy() or manager.awaiting_restart(): + if manager.awaiting_restart(): return {"removed": 0, "retained": 0} try: references = await asyncio.to_thread(process_references, manager.home) @@ -79,7 +79,33 @@ async def reclaim(manager): state.get("pendingRelease"), state.get("pendingRollback"), } + from .generation_leases import references as worker_references + try: + protected.update(worker_references(manager.home)) + for path in (Path(manager.home)/'updates/profiles').glob('*.json'): + entry = json.loads(path.read_text()) + if entry.get('parentGeneration') in protected: + protected.add(entry['generation']) + except (OSError, ValueError, KeyError, TypeError): + return {'removed': 0, 'retained': 0, 'reason': 'Worker references could not be verified.'} root = Path(manager.directory) / "releases" + # A retained environment may contain an explicit editable source from an + # earlier generation. Follow those edges before deleting any source tree. + # Shared immutable store objects are outside generation deletion entirely. + changed = True + while changed: + changed = False + for identity in tuple(protected): + if not identity: + continue + graph = root / identity / 'runtime-installed.json' + if not graph.exists(): + continue + text = graph.read_text() + for source in re.findall(re.escape(str(root)) + r'/([a-f0-9]{32})/', text): + if source not in protected: + protected.add(source) + changed = True removed, retained = 0, 0 candidates = [] for folder in sorted(root.iterdir()) if root.exists() else []: @@ -104,7 +130,8 @@ async def reclaim(manager): ): raise TypeError("Unknown generation receipt") project = project_path(manager.home, folder.name) - if str(project) in references or project.is_symlink(): + modern = data.get("generationSchema") == 1 + if (not modern and (manager.busy() or str(project) in references)) or project.is_symlink(): raise ValueError("Runtime remains referenced") # Exact qualification still has to hold before retiring its files. if not (folder / "runtime-installed.json").exists(): @@ -161,8 +188,14 @@ async def reclaim(manager): for folder, project in candidates: # No new work is admitted by the caller's lifecycle lock. Recheck busy # before each removal. Never delete baseline, shared sources or uv tools. - if manager.busy(): - break + # Legacy generations have no explicit worker leases. Modern generations + # can retire while unrelated workers remain busy on other generations. + modern = json.loads((folder/'validated.json').read_text()).get('generationSchema') == 1 + if not modern and manager.busy(): + continue + if folder.name in worker_references(manager.home): + retained += 1 + continue await asyncio.to_thread(shutil.rmtree, folder) if ( project.resolve() not in surviving_projects diff --git a/amplifier_web/updates.py b/amplifier_web/updates.py index 471b028d3..2a5d0af0e 100644 --- a/amplifier_web/updates.py +++ b/amplifier_web/updates.py @@ -43,9 +43,19 @@ def active_release(home): return value +def selected_release(home): + # Workers capture their source generation at spawn; the serving host follows + # the current pointer. Never change a running worker's resolver underneath it. + selected = os.environ.get('AMPLIFIER_UNIFIED_RELEASE') + identity = (selected or None) if selected is not None else active_release(home).get('current') + if identity is not None and not re.fullmatch(r'[a-f0-9]{32}', identity): + raise ValueError('Invalid worker source generation') + return identity + + def foundation_home(home): home = Path(home) - identity = active_release(home).get('current') + identity = selected_release(home) return home / 'updates' / 'releases' / identity / 'foundation' if identity else home / 'foundation' @@ -145,23 +155,24 @@ def issue(reason, *, workspace=None, session_id=None, reference=None, historical selections = {(state['settings']['workspace'], state['settings']['bundle'], None)} # Native child/legacy history can be viewable without a resumable identity. # Its workspace is still inspected below; it is not a broken root selection. - selections.update((s['workspace'], s['bundle'], s.get('runtimeSessionId') or s.get('nativeIdentity') or s['id']) - for s in state['sessions'] - if not (s.get('historyManaged') and s.get('historyReadOnlyReason'))) - for workspace in state.get('workspaces', []): - # Native history retains an unavailable, pathless workspace placeholder. - # It is not a source-selection error, unlike malformed workspace rows. - if (isinstance(workspace, Mapping) - and isinstance(workspace.get('nativeProject'), str) - and workspace.get('nativeProject') - and 'path' in workspace and workspace['path'] is None - and workspace.get('available') is False): - continue - path = workspace.get('path') if isinstance(workspace, Mapping) else None - if not isinstance(path, str) or not path.strip(): - incomplete = True - continue - selections.add((path, None, None)) + if not getattr(service, 'app_only', False): + selections.update((s['workspace'], s['bundle'], s.get('runtimeSessionId') or s.get('nativeIdentity') or s['id']) + for s in state['sessions'] + if not (s.get('historyManaged') and s.get('historyReadOnlyReason'))) + for workspace in state.get('workspaces', []): + # Native history retains an unavailable, pathless workspace placeholder. + # It is not a source-selection error, unlike malformed workspace rows. + if (isinstance(workspace, Mapping) + and isinstance(workspace.get('nativeProject'), str) + and workspace.get('nativeProject') + and 'path' in workspace and workspace['path'] is None + and workspace.get('available') is False): + continue + path = workspace.get('path') if isinstance(workspace, Mapping) else None + if not isinstance(path, str) or not path.strip(): + incomplete = True + continue + selections.add((path, None, None)) for workspace, selected, session_id in selections: try: @@ -169,7 +180,8 @@ def issue(reason, *, workspace=None, session_id=None, reference=None, historical # history. Their unavailable directories are not configuration errors. if not workspace:continue if not Path(workspace).expanduser().is_dir():continue - config = read_config(workspace, home=home, session_id=session_id, settings_cache=settings_cache) + config = read_config(workspace, home=home, session_id=session_id, settings_cache=settings_cache, + global_only=getattr(service, "app_only", False)) # Use the same settings authority as session startup. Retained # imported registry aliases must not masquerade as configured use. registrations = dict(config.registrations) @@ -198,7 +210,13 @@ def resolve(reference, evidence, seen=frozenset()): issue('This bundle name is not registered. Choose an available bundle in this conversation, or restore its source in workspace settings.', workspace=workspace, session_id=session_id, reference=reference, historical=evidence == 'Selected bundle') # Do not walk added/registered bundle lists: those are catalogs. - resolve(selected or config.active_bundle, 'Selected bundle') + if getattr(service, 'app_only', False): + from .bundles import offered_profiles + for profile in offered_profiles(config): + resolve(profile, 'Offered app profile') + resolve(selected or config.active_bundle, 'Selected app profile') + else: + resolve(selected or config.active_bundle, 'Selected bundle') for reference in config.app_bundles: resolve(reference, 'Enabled app bundle') for reference in config.module_sources.values(): @@ -490,7 +508,14 @@ def busy(self): if any(w.get('status') in {'starting','running','stopping','queued'} or (w.get('persistent') and w.get('status') == 'idle') for w in session.get('workers',[])): return True return False - async def inventory_sources(self): + async def inventory_sources(self, *, indexed=False): + """Checks use the app index; an explicit audit also inspects saved scopes.""" + if not indexed: + return await self._scan_inventory() + from .update_inventory_index import inventory + return await inventory(self, lambda: self._scan_inventory(app_only=True)) + + async def _scan_inventory(self, *, app_only=False): base = foundation_home(self.home) # Capture only selection metadata before yielding. The history catalog # can change while filesystem/settings reads run outside the event loop. @@ -506,6 +531,7 @@ async def inventory_sources(self): if isinstance(row, Mapping) else row for row in state.get('workspaces', [])], }) + snapshot.app_only = app_only snapshot.source_issues = [] snapshot.settings_cache = self.settings_cache configured, incomplete = await asyncio.to_thread(configured_sources, snapshot) @@ -647,8 +673,8 @@ async def _check(self, *, tier='application', install=False): return tier = 'included' started = time.monotonic() - rows = await self.inventory_sources() - await self.publish(inventoryTimingMs=round((time.monotonic()-started)*1000)) + rows = await self.inventory_sources(indexed=True) + await self.publish(inventoryTimingMs=round((time.monotonic()-started)*1000), inventoryEvidence=getattr(self, 'inventory_evidence', None)) remote_tasks = {} from .update_checks import git_revision async def remote(url, ref): @@ -786,6 +812,10 @@ async def install(self): elif original.is_file():await asyncio.to_thread(shutil.copy2,original,shared_stage/name) for config_file in (stage/'config').rglob('*.yaml'): config_file.write_text(config_file.read_text().replace(str(source),str(stage/'foundation'))) + shared_settings = shared_stage/'settings.yaml' + if shared_settings.exists(): + write_private(shared_settings, shared_settings.read_text().replace(str(source),str(stage/'foundation')) + .replace(str(self.home/'foundation'),str(stage/'foundation'))) registry=stage/'foundation/registry.json' if registry.exists(): registry.write_text(registry.read_text().replace(str(source),str(stage/'foundation'))) # Snapshot shared configuration, never CLI registry or caches. @@ -822,11 +852,18 @@ async def install(self): meta.write_text(json.dumps(data)) await self.publish(phase='validating',detail='Preparing dependencies in a separate runtime…') phase='ecosystem-validation' - await self.validate(stage,release) - write_private(stage/'validated.json',json.dumps({'createdAt':time.time(),'sources':len(candidates),'hostVersion':__import__('amplifier_web').__version__, 'updateTier': self.service.state['updates'].get('sequence', {}).get('stage')})) + from .update_plan import build, reuse_runtime + plan = await build(self, stage, candidates) + write_private(stage/'plan.json', json.dumps(plan)) + await self.publish(plan={key: plan[key] for key in ('mode', 'reason', 'activation')}) + if plan['mode'] == 'data': + await self.diagnostics.run('ecosystem-runtime-reuse', reuse_runtime, self, stage, plan) + else: + await self.validate(stage,release) + write_private(stage/'validated.json',json.dumps({'generationSchema': 1, 'workerProtocol': 1, 'createdAt':time.time(),'sources':len(candidates),'hostVersion':__import__('amplifier_web').__version__, 'updateTier': self.service.state['updates'].get('sequence', {}).get('stage')})) self.diagnostics.clear_failure() self.diagnostics.record('ecosystem-stage','succeeded',commandId=stage_id) - await self.publish(phase='staged',pendingRelease=release,detail='Update validated; waiting for conversations and calls to be idle.') + await self.publish(phase='staged',pendingRelease=release,detail='Update prepared; making it available to new conversation work.') except BaseException as error: from .update_diagnostics import exception_type interrupted=isinstance(error,asyncio.CancelledError) @@ -849,12 +886,21 @@ async def validate(self,stage,release): fresh=not (receipt/'runtime.lock').exists() project=await stage_runtime(self, release, [row for row in self.inventory if row.get('eligible') and (row.get('status') == 'update' or (row.get('kind') == 'runtime dependency' and row.get('status') == 'current'))], finalize=not fresh) - state=self.service.get_state() - # Browsing historical CLI projects does not opt their old bundles into - # this application's update validation or mount missing workspaces. - configs={(s['workspace'],s['bundle']) for s in state['sessions'] - if not s.get('historyManaged') and s.get('workspace') and s.get('bundle')} - configs.add((state['settings']['workspace'],state['settings']['bundle'])) + # Profile preparation follows the current app offering. Saved chats and + # workspace-specific overlays qualify lazily when explicitly resumed. + # Scanning historical workspace/bundle pairs made a catalog-only update + # run dozens of identical dependency installers. Do not restore that loop. + from .bundles import offered_profiles + from .host.config import read_config + workspace = stage / 'qualification-workspace' + workspace.mkdir(exist_ok=True) + config = read_config(workspace, home=stage, shared_home=stage/'shared-config', global_only=True) + profiles = offered_profiles(config) + if not profiles: + raise ValueError('No app-level conversation profiles are configured') + configs = [(str(workspace), profile) for profile in profiles] + profiles_file = stage / 'profiles.json' + write_private(profiles_file, json.dumps(profiles)) from .update_sources import store_environment, worker_supports_shared, adopt_clean_sources if fresh: # Materialize the candidate lock once, rather than uv-syncing before @@ -872,7 +918,13 @@ async def probe(project, *, refresh=False): overrides=await self.diagnostics.run('ecosystem-runtime-policy',prepare_overrides,project,receipt/'runtime-install-overrides.txt') if qualified else Path(__file__).parent/'runtime_deps/compatibility.txt' command=[shutil.which('uv'),'run','--locked','--no-sync','--project',str(project),'--python','3.13','python',str(Path(__file__).with_name('update_probe.py'))] flags=['--install-overrides',str(overrides)] if qualified else [] - if refresh:flags.append('--refresh-dependencies') + flags.append('--global-only') + if refresh: + # One collection pass and one resolver transaction for the shared + # graph, followed by fresh read-only compatibility processes. + await self.diagnostics.run('ecosystem-prepare', process, *command, str(workspace), profiles[0], + *flags, '--profiles', str(profiles_file), env={**env, 'UV_OVERRIDE': str(overrides)}, timeout=900) + return completed=0 progress={'attemptId':getattr(self.diagnostics,'state',{}).get('attemptId'), 'phase':'prepare' if refresh else 'compatibility','total':len(configs), @@ -907,9 +959,12 @@ async def run_one(workspace, bundle): project=await freeze(self,release,project) if (project/'.venv').exists(): verify_recorded(project,receipt) - await self.publish(detail=f'Checking compatibility for {len(configs)} workspace/bundle configurations…') + await self.publish(detail=f'Checking {len(configs)} offered conversation profiles…') await probe(project) verify_recorded(project,receipt) + from .runtime_profiles import configuration_key + write_private(stage/'profiles-qualified.json', json.dumps({'profiles': profiles, + 'configuration': configuration_key(config.settings, self.home, stage)})) async def activate(self, rollback=False): async with self.service.runtime_lifecycle(): @@ -937,10 +992,12 @@ async def _activate(self, rollback=False): await self.validate(self.directory/'releases'/target,target) marker['hostVersion']=__import__('amplifier_web').__version__ write_private(self.directory/'releases'/target/'validated.json',json.dumps(marker)) + hot = bool(target and marker.get('generationSchema') == 1 and marker.get('workerProtocol') == 1 + and callable(getattr(self.service.runtime, 'promote_generation', None))) async with self.service.lock: if self.service.closed: return - if self.busy(): + if not hot and self.busy(): self.service.state['updates'].update(detail='Waiting for active work and calls to finish. Try rollback again when idle.' if rollback else 'Update ready; it will activate when work and calls finish.') self.service._publish() return @@ -957,7 +1014,7 @@ async def _activate(self, rollback=False): # durable. The pointer is committed only after replacement # construction succeeds, and the live manager is replaced before # its terminal close can leave this host unable to admit work. - candidate = self.service.runtime_candidate() + candidate = None if hot else self.service.runtime_candidate() # A promotion may have committed before a runtime replacement # or state publication failed. Its durable pointer already # retains the rollback identity, so finish it without @@ -971,7 +1028,13 @@ async def _activate(self, rollback=False): async with self.service.lock: self.service.state['updates'].pop('pendingRollback', None) self.service._publish() - await self.service.replace_runtime(candidate) + if hot: + def protected(sid): + voice = self.service.state.get('voice', {}) + return voice.get('sessionId') == sid and voice.get('status') not in {None, 'idle', 'ended', 'error', 'disconnected'} + self.service.runtime.promote_generation(target, protected=protected) + else: + await self.service.replace_runtime(candidate) if rollback: async with self.service.lock: self.service.state['settings']['updates']['autoInstall'] = False @@ -993,7 +1056,7 @@ async def _activate(self, rollback=False): sequence.update(stage='complete', install=False, other=tier_summary) await self.publish(phase='installed',release=target,pendingRelease=None,canRollback=True,items=items,error=None, **({'sequence': sequence} if sequence else {}), - available=sum(row.get('status')=='update' for row in items),installedAt=time.time(),detail='Previous ecosystem restored. Automatic installation is now off.' if rollback else 'Update installed. Conversations will resume with the new ecosystem.') + available=sum(row.get('status')=='update' for row in items),installedAt=time.time(),detail='Previous ecosystem restored. Automatic installation is now off.' if rollback else 'Update ready for new work. Active conversations adopt it after their current work finishes.') if rollback or 'pendingRollback' in self.service.state['updates']: async with self.service.lock: self.service.state['updates'].pop('pendingRollback', None) @@ -1091,6 +1154,13 @@ async def tick(self): settings=self.service.state['settings'].get('updates',{}) state=self.service.state['updates'] if self.awaiting_restart():return + usage = getattr(self.service.runtime, 'generation_usage', lambda: [])() + adoption = {'activeWorkers': len(usage), 'pendingWorkers': sum(row['updatePending'] for row in usage)} + if state.get('adoption') != adoption: + if state.get('adoption', {}).get('pendingWorkers') and not adoption['pendingWorkers']: + if not self.cleanup_task or self.cleanup_task.done(): + self.cleanup_task = asyncio.create_task(self.retire_storage()) + await self.publish(adoption=adoption) if state.get('pendingSmartTools'): if state.get('phase') != 'error': await self.activateSmartTools() return @@ -1131,13 +1201,13 @@ async def loop(self): await asyncio.sleep(delay) async def retire_storage(self): - # Storage maintenance is outside the critical activation request. Wait - # for an idle window and preserve everything if new work has started. + # Storage maintenance is outside the activation request. Worker leases + # protect active generations; unrelated work need not delay reclamation. await asyncio.sleep(10) - if self.closed or self.busy() or self.awaiting_restart(): + if self.closed or self.awaiting_restart(): return async with self.service.runtime_lifecycle(): - if self.closed or self.busy() or self.awaiting_restart(): + if self.closed or self.awaiting_restart(): return try: from .update_retention import reclaim diff --git a/docs/UPDATES.md b/docs/UPDATES.md index adb4c1cbe..dbf8ce129 100644 --- a/docs/UPDATES.md +++ b/docs/UPDATES.md @@ -12,13 +12,21 @@ Caches without that evidence have `usage: unknown`. They may be transitive depen Shared remote/ref lookups join across application and worker checks, with bounded concurrency/timeouts. Sibling refs for the same repository use one Git request. Manual checks bypass saved availability results; automatic checks can reuse successful results within the configured interval. Credential/access identity changes invalidate reuse, and a failed fresh lookup invalidates its earlier success. A failed source stays **Check failed**, never **Current**, regardless of usage. Missing workspace directories retained for history are skipped without creating a warning; existing directories are checked even if a saved availability flag is stale. Unresolvable selected names or unreadable configuration produce a separate classification warning without hiding cache failures or blocking otherwise eligible updates. Installation checks source identity, revision and local changes again in staging, without gating on usage. Local edits and SHA/version pins are not automatically replaced. The check distinguishes real source edits from tracked Python bytecode rewritten on import and symlinks flattened by an earlier cache migration. Only verified generated changes are exempted; normalization happens in the isolated staging copy, never the active cache. Tracked source changes carry an explanatory diagnostic: builds can also modify tracked files, so their origin is not assumed to be a person. A version filename or generated-file comment alone never exempts an edit. The exact wiki-weaver version output is recognized only with its reviewed build-hook hash, matching build configuration, unchanged index and a consistent commit identity; unknown hooks and genuine edits remain protected. New migrations preserve symlinks. Missing, not-yet-prepared bundles are outside the cached-source inventory; their normal first preparation still resolves them through Foundation. -Installation copies the source cache into a new private generation, fetches the exact checked revisions, and prepares configured conversation bundles plus the default bundle in an independent Python runtime. The probe creates fresh non-user sessions, denies approval requests, verifies required host capabilities and absence of CLI libraries, and never calls `session.execute`. Preparation can run module initialization hooks; it does not establish live-model compatibility for every tool. +Installation stages changed source bindings and prepares the **currently offered app profiles** with the enabled app behaviors. Saved chats and historical workspace/bundle combinations do not expand this qualification set. A single dependency batch collects selected modules and bundle-root packages, resolves their union once in an isolated environment, freezes the graph, and mounts each offered profile in a fresh process. These checks deny approval requests, verify required host capabilities and absence of CLI libraries, and never execute a model turn. Module initialization hooks still run. -Only a validated generation can be activated. Activation waits for active turns, persistent workers, calls, accepted Smart Tool work and feedback submissions to finish, closes idle processes, and switches an atomic pointer. Conversation transcripts remain in the original app session store and are resumed normally. No interrupted jobs are automatically replayed. The previous source generation remains available for rollback; rollback turns automatic installation off to avoid immediately reinstalling the reverted update. Failed staged validation leaves the active pointer unchanged. A host crash during staging leaves the old generation active; a validated pending generation can activate after restart. Component changes apply to the next runtime preparation; installing components does not mark an outstanding application release installed. +A proven catalog-data-only change reuses an already qualified runtime. This requires an exact tree comparison, an allowlisted data contract and unchanged app-profile inputs. Unknown files, code, dependency or profile changes take the qualification path. Failed qualification leaves the active pointer unchanged. + +Qualified component generations use per-worker activation. Promotion atomically changes the generation selected by new starts. Running workers retain their source generation and environment; after they park with no active jobs, queued input, approval or uncertain operation, the existing retirement handshake releases them. The next explicit work starts a fresh worker on the current generation and resumes native history. Active voice protects its worker. The updater does not interrupt a turn, automatically replay an operation, or add another checkpoint format. Application replacements, incompatible worker protocols and legacy generations retain the coordinated restart boundary. + +Custom workspace/session dependency overrides qualify a separate environment on explicit execution, coalesced by effective configuration and source content. Browsing a chat does not prepare it. Identical qualified graphs share immutable environments; provider keys, connection IDs, model selection and prompt text do not define a dependency graph. Conflicting distribution sources in an offered union fail candidate qualification instead of silently choosing one. Local overrides retain their explicit source semantics. + +The logical roles are candidate, current and previous. Physical generations remain while live workers, custom profiles, recorded environments or explicit source references need them. Private worker leases protect admission and process lifetime. Cleanup retires only proven, unreferenced owned generations and environments; uncertain data and shared source objects are retained. A busy worker on one generation does not block cleanup of an unrelated unused generation. Rollback promotes the previous qualified generation through the same adoption boundary and disables automatic installation. + +Availability checks reuse a private inventory index, invalidated by generation, registry and configuration changes, with periodic full reconciliation. Remote-ref requests retain coalescing and bounded cached availability; a manual refresh refreshes remote availability. Every installation repeats exact source preflight, so cached availability cannot authorize overwriting an intervening local edit. Unified owns its registry, source store and runtimes. CLI caches and registries remain separate; shared settings, credentials and native projects/history authorities are unchanged. Core, Foundation's host library, the streaming engine and loop-live track their configured `@main` sources. Provider/tool modules also follow their configured mutable sources. Candidate preparation resolves exact revisions in an isolated runtime and records them as validation evidence; these receipts do not replace branch-tracking configuration with commit pins. Activation still requires the candidate runtime checks described above. Application releases come from the private `microsoft/amplifier-unified` GitHub repository. Checks use the signed-in GitHub CLI and resolve the release tag to an exact commit. Installation first builds a separate uv tool environment and checks the host import, packaged frontend assets and package version. This validates packaging, not every provider account or live audio connection. Once idle, the host installs that exact revision into its normal uv tool location and restarts on the same port, workspace and data directory. Restart output is retained privately in `updates/restart.log`; the prior Git install reference is recorded in `updates/previous-app.json` for manual recovery. Ecosystem rollback does not roll back application code. If there is no accessible release or GitHub sign-in, the UI reports a failed check rather than claiming the application is current. -Local data: `updates/inventory.json` (private source details), `updates/releases//` (staged sources/configuration), `updates/active.json` (current/previous pointer), and per-generation runtime environments. Sources and dependency environments are retained for rollback; automatic disk cleanup is a follow-up. State shown to the UI/agent contains credential-safe source labels and commit IDs, not credential-bearing remote URLs. +Local data: `updates/inventory.json` (private source details), `updates/releases//` (staged sources/configuration), `updates/active.json` (current/previous pointer), and per-generation runtime environments. Previous and referenced generations remain available for rollback and active workers; unreferenced, verified owned generations and environments are reclaimed. Shared source objects are retained pending complete proof that no references remain. State shown to the UI/agent contains credential-safe source labels and commit IDs, not credential-bearing remote URLs. Application activation also verifies that the running host and the executable on PATH belong to the same uv tool installation. A development checkout or a different launcher cannot replace another installed tool. Candidate and installed-package probes use isolated Python imports, reject packages outside that environment, and cannot accidentally validate a checkout from the launch directory or PYTHONPATH. The installed package is checked again after replacement; a failed check leaves the running host up for recovery. The restart helper uses the separate validated environment, and new work remains blocked until restart. It preserves the effective bind addresses, public origins, TLS certificate/key, session lifetime, port, workspace and data directory without writing CLI overrides into saved server settings. The replacement host acknowledges the pending restart only after an authenticated HTTP request to its live listener confirms the expected version, exact installed Git revision, data directory identity, and a different process instance. Package probes and application construction alone cannot acknowledge a restart. Smart Tool servers are reported disconnected after restart and can be reconnected explicitly. The recovery record stores the actual prior installation source when available, rather than assuming an older release tag exists. Repeated installation requests reuse a pending validated generation. Cache symlinks remain symlinks while staging; external workspace trees are not copied into the update. diff --git a/frontend/src/update-overview.js b/frontend/src/update-overview.js index 8fad310f1..412105368 100644 --- a/frontend/src/update-overview.js +++ b/frontend/src/update-overview.js @@ -17,13 +17,14 @@ export function updateOverview(updates={},options={}){ const result={stage,installable,blocked,busy:active||!!seq.nextStage||updates.pendingReplacement!=null,continuing:!!seq.install,currentBatch,currentProgress,completedBatches:(updates.diagnostics?.completedBatches||[]).slice(-5),title:'Check for updates',detail:'We’ll check Amplifier and the components it uses.',tone:'neutral'}; if(failed)return {...result,title:'Updates need attention',tone:'error',detail:updates.pendingReplacement!=null?'The installation needs verification before work can continue. Open details for the recovery steps.':updates.pendingRestart?'The app update needs help finishing its restart. Open details for the next step.':seq.included?.issues?'Some required components could not be updated. Your existing configuration is preserved. Review the issue below.':'The update could not finish. Review the issue below before trying again.'}; if(updates.pendingRestart)return {...result,title:updates.pendingRestart.requestStatus==='uncertain'?'Waiting for restart confirmation':'Restarting Amplifier',detail:'Waiting for a healthy restarted app before continuing with the remaining updates.',tone:'working'}; + if(updates.pendingRelease&&updates.plan?.activation==='per-worker')return {...result,title:'Making components available',detail:'New work will use the prepared components. Active conversations keep their current version until their work finishes.',tone:'working'}; if(updates.pendingApp||updates.pendingRelease||updates.pendingSmartTools?.length)return {...result,title:'Waiting for your work to finish',detail:'The update is ready. It will continue automatically when conversations, tools, and calls are idle.',tone:'working'}; if(active){ const progressDetail=currentProgress?`${currentProgress.phase==='prepare'?'Preparing':'Checking'} configurations: ${currentProgress.completed} of ${currentProgress.total} completed. Failed checks do not count as completed.`:null; return {...result,title:updates.phase==='checking'?'Checking for updates':currentBatch?.kind==='smart-tools'?'Updating Smart Tools':stage==='application'?'Updating Amplifier':stage==='included'?'Updating included components':'Updating other components',detail:progressDetail||updates.detail||(updates.phase==='checking'?(stage==='application'?'Checking for a new app version first.':stage==='included'?'Checking included components…':'Checking other components…'):'Preparing and verifying the update…'),tone:'working'}; } if(seq.nextStage||seq.install&&installable)return {...result,title:'Updating Amplifier',detail:stage==='included'?'Continuing with included components…':'Continuing with other components…',tone:'working'}; - if(installable)return {...result,title:'Updates available',detail:(appAvailable?(String(app.current||'').replace(/^v/,'')===String(app.latest||'').replace(/^v/,'')?'App component updates are ready. ':'A new app version is ready. '):'')+(components?`${components} component ${components===1?'update is':'updates are'} ${appAvailable?'also ':''}ready. `:'')+(options.autoInstall!==false?'They’ll install automatically when work is idle.':'One update request handles the app and all eligible components.'),tone:'available'}; + if(installable)return {...result,title:'Updates available',detail:(appAvailable?(String(app.current||'').replace(/^v/,'')===String(app.latest||'').replace(/^v/,'')?'App component updates are ready. ':'A new app version is ready. '):'')+(components?`${components} component ${components===1?'update is':'updates are'} ${appAvailable?'also ':''}ready. `:'')+(options.autoInstall!==false?'Component updates prepare automatically. App restarts wait for work to finish.':'One update request handles the app and all eligible components.'),tone:'available'}; if(issues.length||seq.included?.issues||seq.other?.issues)return {...result,title:'Some updates need attention',detail:'No installable updates remain, but some checks or local changes need review.',tone:'error'}; if(seq.stage==='complete')return {...result,title:'You’re up to date',detail:(seq.included?.protected||seq.other?.protected)?'All eligible updates are complete. Pinned versions and local overrides were kept.':'Amplifier and its eligible components are up to date.',tone:'ready'}; if(app.status==='release_channel_needed')return {...result,title:'Automatic app updates aren’t configured',detail:'This installation needs a release channel. Component updates and technical details are available below.'}; diff --git a/frontend/src/updates.jsx b/frontend/src/updates.jsx index 327b1c4dd..6932f93ee 100644 --- a/frontend/src/updates.jsx +++ b/frontend/src/updates.jsx @@ -70,8 +70,9 @@ export function UpdateSettings({state,act}){
{overview.installable&&(!overview.continuing||overview.tone==='error')&&}
{disabledReason&&

{disabledReason} {controlsBusy?'You can keep working; this page will update automatically.':''}

} -

One request handles everything in order. Updates wait for work and calls to finish; an app update may restart the server.

-

Install eligible app and component updates when work is idle. Existing pins and local edits are kept.

+ {updates.adoption?.pendingWorkers>0&&

{updates.adoption.pendingWorkers} active conversation workers will adopt the prepared update when their work finishes.

} +

One request handles everything in order. Prepared components are available to new work immediately. Active conversations finish their current work before switching; an app update waits for work and calls before restarting the server.

+

Prepare eligible components automatically. App restarts wait for work to finish. Existing pins and local edits are kept.

Update preferences
diff --git a/frontend/tests/updates.test.mjs b/frontend/tests/updates.test.mjs index fdb7184c6..540f9af67 100644 --- a/frontend/tests/updates.test.mjs +++ b/frontend/tests/updates.test.mjs @@ -127,7 +127,7 @@ test('application and component updates have separate effects and no duplicate a assert.match(html,/1 available/); assert.match(html,/Community bundle/); assert.match(html,/One request handles everything in order/); - assert.match(html,/an app update may restart the server/); + assert.match(html,/an app update waits for work and calls before restarting the server/); assert.match(html,/Show all 1 source/); }); @@ -380,7 +380,7 @@ test('main update box summarizes ordered component phases without the source inv assert.match(banner,/Included components/); assert.match(banner,/3 component updates are ready/); assert.match(banner,/Other components/); - assert.match(banner,/install automatically when work is idle/); + assert.match(banner,/Component updates prepare automatically/); assert.doesNotMatch(banner,/a-source-list/); assert.match(html,/Update Amplifier/); }); diff --git a/tests/conftest.py b/tests/conftest.py index 3ee3d723d..5a4b8ef0e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,6 +3,7 @@ @pytest.fixture(autouse=True) def isolated_shared_session_files(tmp_path, monkeypatch): + monkeypatch.setenv('AMPLIFIER_WEB_HOME', str(tmp_path / 'unified-home')) monkeypatch.setenv('AMPLIFIER_HOME', str(tmp_path / 'amplifier-home')) monkeypatch.setenv('AMPLIFIER_SESSION_STATE_HOME', str(tmp_path / 'shared-session-state')) monkeypatch.setenv('AMPLIFIER_TERMINAL_HOME', str(tmp_path / 'terminal-home')) diff --git a/tests/test_runtime_qualification.py b/tests/test_runtime_qualification.py index 3a30498ad..fb23e950f 100644 --- a/tests/test_runtime_qualification.py +++ b/tests/test_runtime_qualification.py @@ -41,7 +41,7 @@ async def run(self, phase, function, *command, **kwargs): calls.append('runtime-sync') return assert command[command.index('--project') + 1] in {str(first), str(frozen)} - calls.append(('probe', '--refresh-dependencies' in command)) + calls.append(('probe', '--profiles' in command)) monkeypatch.setattr(runtime_environment, 'stage', stage) monkeypatch.setattr(runtime_qualification, 'freeze', freeze) monkeypatch.setattr(runtime_qualification, 'prepare_overrides', overrides) @@ -49,7 +49,7 @@ async def run(self, phase, function, *command, **kwargs): manager = SimpleNamespace(home=tmp_path, inventory=[], diagnostics=Diagnostics(),publish=AsyncMock(), service=SimpleNamespace(get_state=lambda: {'sessions': [], 'settings': {'workspace': str(tmp_path), 'bundle': 'work'}})) await UpdateManager.validate(manager, receipt, release) - assert calls == ['stage', 'runtime-sync', ('overrides', first), ('probe', True), 'freeze', 'verify', ('overrides', frozen), ('probe', False), 'verify'] + assert calls == ['stage', 'runtime-sync', ('overrides', first), ('probe', True), 'freeze', 'verify', ('overrides', frozen), ('probe', False), ('probe', False), ('probe', False), 'verify'] async def test_historical_receipt_never_gets_refresh_or_new_foundation_arguments(tmp_path, monkeypatch): @@ -218,7 +218,7 @@ def test_loop_mount_uses_the_exact_installed_runtime_source(tmp_path, monkeypatc @pytest.mark.parametrize('fail', [False, True]) -async def test_preparation_serial_and_readonly_checks_bounded_parallel(tmp_path, monkeypatch, fail): +async def test_one_batch_and_readonly_offered_profiles_exclude_history(tmp_path, monkeypatch, fail): import asyncio counts = {'prepare': 0, 'check': 0} peaks = dict(counts) @@ -240,7 +240,7 @@ async def run(self, phase, function, *command, **kwargs): key = 'prepare' if phase == 'ecosystem-prepare' else 'check' assert ('--read-only' in command) == (key == 'check') assert '--no-sync' in command # Both probes reuse the one-time sync. - assert ('--refresh-dependencies' in command) == (key == 'prepare') + assert ('--profiles' in command) == (key == 'prepare') counts[key] += 1 peaks[key] = max(peaks[key], counts[key]) try: @@ -261,13 +261,31 @@ async def publish(**values):published.append(values) with pytest.raises(ValueError, match='incompatible'): await UpdateManager.validate(manager, receipt, release) else: await UpdateManager.validate(manager, receipt, release) - assert completed.count('check') == 8 and peaks['check'] == 4 - assert completed.count('prepare') == 8 and peaks['prepare'] == 1 + assert completed.count('check') == 3 and peaks['check'] == 3 + assert completed.count('prepare') == 1 and peaks['prepare'] == 1 assert completed.count('sync')==1 assert counts == {'prepare': 0, 'check': 0} # No orphan probes after a failure. preparation=[row['probeProgress'] for row in published if row.get('probeProgress',{} ) is not None and row.get('probeProgress',{}).get('phase')=='prepare'] checks=[row['probeProgress'] for row in published if row.get('probeProgress',{}) is not None and row.get('probeProgress',{}).get('phase')=='compatibility'] - assert [row['completed'] for row in preparation]==list(range(9)) - assert all(row['total']==8 for row in preparation+checks) - assert checks[-1]['completed']==(0 if fail else 8) + assert not preparation # One dependency batch, no historical preparation loop. + assert all(row['total']==3 for row in checks) + assert checks[-1]['completed']==(0 if fail else 3) assert str(tmp_path) not in json.dumps(preparation+checks) + + +def test_package_payload_verification_keeps_content_and_symlink_boundaries(tmp_path): + from amplifier_web.runtime_qualification import package_content + root=tmp_path/'.venv/lib/python3.13/site-packages';root.mkdir(parents=True) + metadata=root/'fixture-1.dist-info';metadata.mkdir() + (metadata/'METADATA').write_text('Metadata-Version: 2.1\nName: fixture\nVersion: 1\n') + payload=root/'fixture';payload.mkdir() + (payload/'code.py').write_text('version=1') + outside=tmp_path/'outside';outside.mkdir() + (outside/'ignored.py').write_text('external=1') + (payload/'external').symlink_to(outside,target_is_directory=True) + (metadata/'RECORD').write_text('fixture/code.py,,\nfixture/external/ignored.py,,\n') + first=package_content(tmp_path) + (outside/'ignored.py').write_text('external=2') + assert package_content(tmp_path)==first + (payload/'code.py').write_text('version=2') + assert package_content(tmp_path)!=first diff --git a/tests/test_update_generations.py b/tests/test_update_generations.py new file mode 100644 index 000000000..3092ca913 --- /dev/null +++ b/tests/test_update_generations.py @@ -0,0 +1,363 @@ +"""Generation activation preserves work and shares prepared artifacts.""" + +import asyncio +import json +import os +import subprocess +import sys +from pathlib import Path +from types import SimpleNamespace +from unittest.mock import AsyncMock + +import pytest +from test_runtime_retention import SCRIPT + +from amplifier_web.runtime import RuntimeManager +from amplifier_web.updates import foundation_home + + +@pytest.fixture +async def manager(tmp_path): + events = [] + + async def emit(kind, data): + events.append((kind, data)) + + manager = RuntimeManager(command=[sys.executable, "-c", SCRIPT]) + manager.home = tmp_path / "app" + manager.home.mkdir() + manager.retention.wake = lambda: None + manager.emit = emit + manager.events = events + yield manager + await manager.close() + + +def promote(manager, value): + root = manager.home / "updates" + root.mkdir(exist_ok=True) + (root / "active.json").write_text(json.dumps({"current": value})) + manager.promote_generation(value) + + +async def test_running_work_keeps_generation_idle_adopts_before_send(manager): + session = {"id": "chat", "workspace": "/tmp"} + await manager.send(session, "first", "one", manager.emit) + first = manager.workers["chat"]["process"] + promote(manager, "a" * 32) + await manager.retention.sweep() + assert first.returncode is None + assert manager.generation_usage()[0]["updatePending"] + await manager._request("chat", "park") + # No periodic sweep: admission itself must observe the pending generation. + assert (await manager.send(session, "second", "two", manager.emit))["accepted"] + assert first.returncode == 0 + assert manager.workers["chat"]["generation"] == "a" * 32 + assert not manager.generation_usage()[0]["updatePending"] + + +async def test_active_voice_defers_only_its_worker(manager): + for sid in ("voice", "idle"): + await manager.prewarm({"id": sid, "workspace": "/tmp"}, manager.emit) + voice = manager.workers["voice"]["process"] + idle = manager.workers["idle"]["process"] + promote(manager, "b" * 32) + manager.retention.protected = lambda sid: sid == "voice" + await manager.retention.sweep() + assert voice.returncode is None and idle.returncode == 0 + manager.retention.protected = lambda sid: False + await manager.retention.sweep() + assert voice.returncode == 0 + + +async def test_lease_exists_until_acknowledged_retirement(manager): + from amplifier_web.generation_leases import references + + promote(manager, "a" * 32) + await manager.prewarm({"id": "chat", "workspace": "/tmp"}, manager.emit) + assert references(manager.home) == {"a" * 32} + promote(manager, "b" * 32) + await manager.retention.sweep() + assert references(manager.home) == set() + + +def test_pinned_worker_sources_ignore_new_host_pointer(tmp_path, monkeypatch): + (tmp_path / "updates").mkdir() + (tmp_path / "updates/active.json").write_text(json.dumps({"current": "b" * 32})) + monkeypatch.setenv("AMPLIFIER_UNIFIED_RELEASE", "a" * 32) + assert ( + foundation_home(tmp_path) + == tmp_path / "updates/releases" / ("a" * 32) / "foundation" + ) + monkeypatch.setenv("AMPLIFIER_UNIFIED_RELEASE", "") + assert foundation_home(tmp_path) == tmp_path / "foundation" + + +async def test_inventory_reuses_index_and_invalidates_on_configuration_change( + tmp_path, monkeypatch +): + from amplifier_web.update_inventory_index import inventory + + home = tmp_path / "app" + (home / "updates").mkdir(parents=True) + manager = SimpleNamespace( + home=home, + directory=home / "updates", + service=SimpleNamespace(state={"settings": {"bundle": "work"}}), + ) + scan = AsyncMock(return_value=[{"id": "one"}]) + assert await inventory(manager, scan) == [{"id": "one"}] + assert await inventory(manager, scan) == [{"id": "one"}] + assert scan.await_count == 1 and manager.inventory_evidence["source"] == "index" + shared = Path(os.environ["AMPLIFIER_HOME"]) + shared.mkdir(exist_ok=True) + (shared / "settings.yaml").write_text("bundle: {active: foundation}") + await inventory(manager, scan) + assert scan.await_count == 2 + + +def test_offered_profiles_ignore_history_and_behavior_names(tmp_path): + from amplifier_web.bundles import offered_profiles + + config = SimpleNamespace( + registry_home=tmp_path, + registrations={"work": "source", "foundation": "source", "addon": "source"}, + settings={ + "bundle": {"added": {"custom": "file:///bundle"}, "app": []}, + "web_bundles": { + "entries": [ + {"name": "foundation", "role": "standalone", "enabled": False} + ] + }, + }, + ) + assert offered_profiles(config, {"work": {}, "old-chat-only": {}, "addon": {}}) == [ + "custom", + "work", + ] + + +@pytest.mark.parametrize( + "changed,expected", + [ + ("tools/example/source.json", "data"), + ("scripts/install.py", "worker"), + ("bundle.md", "worker"), + ], +) +async def test_only_proven_catalog_data_bypasses_preparation( + tmp_path, changed, expected +): + from amplifier_web.update_plan import CATALOG, build + + home = tmp_path / "app" + old = "a" * 32 + stage = home / "updates/releases" / ("b" * 32) + receipt = home / "updates/releases" / old + before = receipt / "foundation/cache/catalog" + after = stage / "foundation/cache/catalog" + for folder in (before, after): + folder.mkdir(parents=True) + (home / "updates/active.json").write_text(json.dumps({"current": old})) + (receipt / "runtime-project.json").write_text("{}") + (receipt / "runtime-installed.json").write_text("[]") + from amplifier_web.runtime_profiles import configuration_key + + (receipt / "profiles-qualified.json").write_text( + json.dumps( + { + "profiles": ["anchors", "foundation", "work"], + "configuration": configuration_key({}), + } + ) + ) + + def git(folder, *args): + return subprocess.check_output( + ["git", *args], cwd=folder, text=True, stderr=subprocess.DEVNULL + ).strip() + + for folder, value in ((before, "{}"), (after, '{"new":true}')): + git(folder, "init", "-b", "main") + git(folder, "config", "user.email", "test@example.invalid") + git(folder, "config", "user.name", "Fixture") + target = folder / changed + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(value) + git(folder, "add", ".") + git(folder, "commit", "-m", "fixture") + row = { + "url": CATALOG, + "ref": "main", + "kind": "bundle / module", + "path": "cache/catalog", + } + plan = await build(SimpleNamespace(home=home), stage, [row]) + assert plan["mode"] == expected + + +def test_runtime_configuration_key_ignores_credentials_models_and_connection_ids(): + from amplifier_web.runtime_profiles import configuration_key + + def settings(identity, key, model): + return { + "config": { + "providers": [ + { + "module": "provider-openai", + "id": identity, + "config": {"api_key": key, "default_model": model}, + } + ] + } + } + + assert configuration_key(settings("one", "old", "first")) == configuration_key( + settings("two", "new", "second") + ) + assert configuration_key( + {"sources": {"modules": {"tool-one": "new"}}} + ) != configuration_key({}) + + +async def test_offered_profile_reuses_generation_after_host_pointer_changes( + tmp_path, monkeypatch +): + from amplifier_web import runtime_profiles + from amplifier_web.host import config as config_module + + home = tmp_path / "app" + generation = "a" * 32 + receipt = home / "updates/releases" / generation + receipt.mkdir(parents=True) + (receipt / "profiles-qualified.json").write_text( + json.dumps( + { + "profiles": ["work"], + "configuration": runtime_profiles.configuration_key({}), + } + ) + ) + captured = {} + + def read(workspace, **kwargs): + captured.update(kwargs) + return SimpleNamespace( + settings={}, + workspace=tmp_path, + home=home, + registry_home=kwargs["registry_home"], + config_home=tmp_path / "shared", + active_bundle="work", + module_sources={}, + bundle_sources={}, + ) + + monkeypatch.setattr(config_module, "read_config", read) + # A later host promotion cannot silently redirect this admission's registry. + (home / "updates/active.json").write_text(json.dumps({"current": "b" * 32})) + assert ( + await runtime_profiles.ensure( + home, generation, {"id": "chat", "workspace": str(tmp_path)} + ) + == generation + ) + assert captured["registry_home"] == receipt / "foundation" + + +async def test_custom_profile_qualification_is_coalesced_and_installed_outside_serving_runtime( + tmp_path, monkeypatch +): + from amplifier_web import ( + runtime_environment, + runtime_profiles, + runtime_qualification, + updates, + ) + from amplifier_web.host import config as config_module + + home = tmp_path / "app" + generation = "a" * 32 + receipt = home / "updates/releases" / generation + (receipt / "foundation").mkdir(parents=True) + (receipt / "profiles-qualified.json").write_text( + json.dumps( + { + "profiles": ["work"], + "configuration": runtime_profiles.configuration_key({}), + } + ) + ) + parent = home / "runtime" / ("q-" + "b" * 32) + parent.mkdir(parents=True) + (parent / "pyproject.toml").write_text("project = {}") + (parent / "uv.lock").write_text("version = 1") + (receipt / "runtime-project.json").write_text(json.dumps({"project": parent.name})) + shared = tmp_path / "shared" + shared.mkdir() + + def read(workspace, **kwargs): + return SimpleNamespace( + settings={ + "sources": { + "modules": { + "tool-example": "git+https://example.invalid/module@main" + } + } + }, + workspace=tmp_path, + home=home, + config_home=shared, + active_bundle="work", + module_sources={}, + bundle_sources={}, + ) + + monkeypatch.setattr(config_module, "read_config", read) + calls = [] + + async def process(*args, **kwargs): + calls.append(args) + await asyncio.sleep(0.01) + return "" + + monkeypatch.setattr(updates, "process", process) + + async def overrides(project, path): + path.write_text("") + return path + + monkeypatch.setattr(runtime_qualification, "prepare_overrides", overrides) + + async def freeze(manager, selected, project): + final = home / "runtime" / ("q-" + selected) + final.mkdir() + target = runtime_environment.receipt_directory(home, selected) + (target / "runtime-project.json").write_text( + json.dumps({"project": final.name}) + ) + return final + + monkeypatch.setattr(runtime_qualification, "freeze", freeze) + monkeypatch.setattr(runtime_qualification, "verify_recorded", lambda *args: None) + session = { + "id": "chat", + "runtimeSessionId": "native-chat", + "workspace": str(tmp_path), + } + edit = home / "sessions/native-chat/configuration.json" + edit.parent.mkdir(parents=True) + edit.write_text(json.dumps({"changes": []})) + first, second = await asyncio.gather( + *(runtime_profiles.ensure(home, generation, session) for _ in range(2)) + ) + assert first == second and first != generation + assert len(calls) == 3 # One uv sync, one union install, one read-only mount. + assert str(parent) not in calls[0] + assert "--runtime-plan" in calls[1] and "--runtime-plan" in calls[2] + assert "--read-only" in calls[2] + assert json.loads( + (home / "updates/releases" / first / "runtime-plan.json").read_text() + ) == {"changes": []} + assert await runtime_profiles.ensure(home, generation, session) == first + assert len(calls) == 3 diff --git a/tests/test_update_readiness.py b/tests/test_update_readiness.py index d4d2b2e6d..c35623b3e 100644 --- a/tests/test_update_readiness.py +++ b/tests/test_update_readiness.py @@ -398,7 +398,7 @@ async def test_old_legacy_failure_does_not_permanently_block_repairs(tmp_path,mo async def handle(request):return web.json_response(health(manager)) runner,site,sock=await listener(manager,handle) calls=[] - async def inventory():calls.append('inventory');return [] + async def inventory(**kwargs):calls.append('inventory');return [] async def application():return {'id':'application','current':__version__,'status':'current'} monkeypatch.setattr(manager,'inventory_sources',inventory) monkeypatch.setattr('amplifier_web.app_updates.check',application) diff --git a/tests/test_update_retention.py b/tests/test_update_retention.py index 79b9a8769..4ab651543 100644 --- a/tests/test_update_retention.py +++ b/tests/test_update_retention.py @@ -50,3 +50,28 @@ def unavailable(home): (manager.directory / 'releases' / names[3] / 'validated.json').write_text('unknown receipt') assert (await retention.reclaim(manager))['removed'] == 0 assert project.exists() + + +async def test_live_generation_lease_prevents_cleanup_while_unrelated_work_continues(tmp_path, monkeypatch): + import os + from amplifier_web.generation_leases import acquire + manager, names, project = manager_fixture(tmp_path, monkeypatch) + manager.busy = lambda: True + folder=manager.directory/'releases'/names[3] + marker=json.loads((folder/'validated.json').read_text()) + marker['generationSchema']=1 + (folder/'validated.json').write_text(json.dumps(marker)) + lease=acquire(manager.home,names[3],os.getpid()) + assert (await retention.reclaim(manager))['removed']==0 + lease.unlink() + assert (await retention.reclaim(manager))['removed']==1 + assert project.exists() + + +async def test_retained_environment_keeps_earlier_editable_sources(tmp_path, monkeypatch): + manager,names,project=manager_fixture(tmp_path,monkeypatch) + current=manager.directory/'releases'/names[0] + earlier=manager.directory/'releases'/names[3] + (current/'runtime-installed.json').write_text(json.dumps([{'path':str(earlier/'foundation/cache/module')}])) + assert (await retention.reclaim(manager))['removed']==0 + assert earlier.exists() diff --git a/tests/test_update_sequence.py b/tests/test_update_sequence.py index 975491b41..f3d5a7ee3 100644 --- a/tests/test_update_sequence.py +++ b/tests/test_update_sequence.py @@ -34,7 +34,7 @@ def source(tier, current='a'*40): async def test_app_is_checked_before_any_component_inventory(manager, monkeypatch, status): events=[] async def application():events.append('app');return {'id':'application','status':status} - async def inventory():pytest.fail('The old app must not inspect component declarations') + async def inventory(**kwargs):pytest.fail('The old app must not inspect component declarations') monkeypatch.setattr(app_updates,'check',application) monkeypatch.setattr(manager,'inventory_sources',inventory) await manager.check() @@ -46,7 +46,7 @@ async def inventory():pytest.fail('The old app must not inspect component declar @pytest.mark.parametrize('included_changed',[False, True]) async def test_check_skips_current_tiers_but_stops_at_included_updates(manager, monkeypatch, included_changed): calls=[] - async def inventory():return [source('included'),source('other')] + async def inventory(**kwargs):return [source('included'),source('other')] async def process(*args,**kwargs): calls.append(args[2].rsplit('/',1)[-1]) return ('b' if included_changed or calls[-1]=='other' else 'a')*40+' refs/heads/main' @@ -62,7 +62,7 @@ async def process(*args,**kwargs): async def test_included_check_error_does_not_install_or_check_optional_sources(manager,monkeypatch): calls=[] - async def inventory():return [source('included'),source('other')] + async def inventory(**kwargs):return [source('included'),source('other')] async def process(*args,**kwargs):calls.append(args[2]);raise RuntimeError('offline') monkeypatch.setattr(manager,'inventory_sources',inventory) monkeypatch.setattr(updates,'process',process) diff --git a/tests/test_updates.py b/tests/test_updates.py index 8bc7a87e6..a2276ef2c 100644 --- a/tests/test_updates.py +++ b/tests/test_updates.py @@ -287,6 +287,8 @@ async def test_runtime_lifecycle_preserves_dispatch_across_update_repair_reset_a bridge = app.app_bridge runtime = RuntimeManager(bridge, command=[sys.executable, '-c', script, str(log)], startup_timeout=3, progress_interval=.01) + # Exercise the coordinated-restart path for a host without generation adoption. + runtime.promote_generation = None await app.install_runtime(runtime) session = app.state['sessions'][0] assert (await app.dispatch('conversation.send', {'text': 'before update'}, command_id='before-update'))['delivery'] == 'accepted' @@ -634,7 +636,7 @@ async def validate(stage, release): await manager.tick() assert app.state['updates']['sequence']['nextStage']=='other' assert git(foundation_home(app.data_dir)/'cache/optional','rev-parse','HEAD')==repo[1] - async def inventory():return [other.copy()] + async def inventory(**kwargs):return [other.copy()] monkeypatch.setattr(manager,'inventory_sources',inventory) from amplifier_web import updates original=updates.process From ec39e9718f935db65d269053a9e25dd56443fd3c Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Fri, 2 Oct 2026 12:22:19 -0700 Subject: [PATCH 2/3] Keep verification off the serving loop and preserve baseline runtimes --- amplifier_web/runtime_qualification.py | 45 +++++++++++++++++--------- amplifier_web/updates.py | 4 +-- tests/test_runtime_updates.py | 15 +++++++++ 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/amplifier_web/runtime_qualification.py b/amplifier_web/runtime_qualification.py index 603801b98..70a0f2a72 100644 --- a/amplifier_web/runtime_qualification.py +++ b/amplifier_web/runtime_qualification.py @@ -5,6 +5,7 @@ import asyncio import hashlib import json +import os from pathlib import Path import shutil import subprocess @@ -68,25 +69,33 @@ def package_content(project): for root in roots: if not root.is_dir(): continue - resolved_root = root.resolve() + resolved_root = os.path.realpath(root) for dist in importlib.metadata.distributions(path=[str(root)]): for entry in dist.files or (): - file = dist.locate_file(entry) - if file.suffix == '.pyc' or file.name in {'RECORD', 'direct_url.json', 'INSTALLER', 'REQUESTED'}: + file = os.fspath(dist.locate_file(entry)) + if file.endswith('.pyc') or os.path.basename(file) in {'RECORD', 'direct_url.json', 'INSTALLER', 'REQUESTED'}: continue # RECORD can list tens of thousands of files. Resolving every # ancestor for every entry turned this check into repeated # filesystem walks. Resolve each containing directory once; # still resolve file symlinks and reject external payloads. - parent = resolved_parents.get(file.parent) + directory = os.path.dirname(file) + parent = resolved_parents.get(directory) if parent is None: - parent = resolved_parents[file.parent] = file.parent.resolve() - actual = file.resolve() if file.is_symlink() else parent / file.name - if not actual.is_relative_to(resolved_root): + parent = resolved_parents[directory] = os.path.realpath(directory) + actual = os.path.realpath(file) if os.path.islink(file) else os.path.join(parent, os.path.basename(file)) + try: + contained = os.path.commonpath((actual, resolved_root)) == resolved_root + except ValueError: # Different Windows drives cannot share a root. + contained = False + if not contained: continue - files[str(file.relative_to(root))] = file + files[os.path.relpath(file, root)] = file for name, file in sorted(files.items()): - digest.update(name.encode() + b'\0' + file.read_bytes()) + digest.update(name.encode() + b'\0') + with open(file, 'rb') as stream: + for chunk in iter(lambda: stream.read(1024 * 1024), b''): + digest.update(chunk) return digest.hexdigest() @@ -260,7 +269,9 @@ async def freeze(manager, generation, project): receipt = environments.receipt_directory(manager.home, generation) if (receipt / 'runtime.lock').exists(): raise ValueError('A recorded worker generation cannot be refreshed.') - graph = installed_graph(project) + # Filesystem scans and payload hashing must not stall the serving event + # loop while existing conversations continue on their pinned generation. + graph = await asyncio.to_thread(installed_graph, project) policies = {} for row in graph: vcs = row.get('directUrl', {}).get('vcs_info', {}) @@ -299,7 +310,7 @@ def identity(rows): python_config = Path(project) / '.venv/pyvenv.cfg' python_version = next((line.partition('=')[2].strip() for line in python_config.read_text().splitlines() if line.partition('=')[0].strip() == 'version'), None) if python_config.exists() else None - payload = package_content(project) + payload = await asyncio.to_thread(package_content, project) contract = {'manifest': content.decode(), 'graph': identity(graph), 'payload': payload, 'python': python_version or list(sys.version_info[:2]), 'platform': platform.system(), 'machine': platform.machine()} key = hashlib.sha256(json.dumps(contract, sort_keys=True).encode()).hexdigest()[:32] @@ -311,9 +322,10 @@ def identity(rows): if marker.exists() and not final.is_symlink(): try: saved = json.loads(marker.read_text()) + actual = await asyncio.to_thread(installed_graph, final) reusable = (saved.get('key') == key and (final / 'pyproject.toml').read_bytes() == content - and identity(installed_graph(final)) == identity(graph) - and package_content(final) == payload + and identity(actual) == identity(graph) + and await asyncio.to_thread(package_content, final) == payload and saved.get('lockSha256') == hashlib.sha256((final / 'uv.lock').read_bytes()).hexdigest()) except (OSError, ValueError, KeyError, TypeError, AttributeError, subprocess.SubprocessError): reusable = False # Preserve uncertain environments and qualify a fresh one. @@ -328,14 +340,13 @@ def identity(rows): shutil.copy2(Path(project) / 'uv.lock', final / 'uv.lock') await manager.diagnostics.run('ecosystem-runtime-freeze', process, uv, 'lock', '--project', str(final), '--python', '3.13', timeout=900) await manager.diagnostics.run('ecosystem-runtime-freeze-install', process, uv, 'sync', '--locked', '--project', str(final), '--python', '3.13', timeout=900) - actual = installed_graph(final) - if identity(actual) != identity(graph) or package_content(final) != payload: + actual = await asyncio.to_thread(installed_graph, final) + if identity(actual) != identity(graph) or await asyncio.to_thread(package_content, final) != payload: raise ValueError('The frozen worker installation differs from its prepared source graph.') from .deployment import write_private write_private(final / 'qualification.json', json.dumps({'key': key, 'lockSha256': hashlib.sha256((final / 'uv.lock').read_bytes()).hexdigest()})) else: - actual = installed_graph(final) manager.diagnostics.record('ecosystem-runtime-reuse', 'succeeded') from .deployment import write_private write_private(receipt / 'runtime-project.json', json.dumps({'project': final.name})) @@ -351,6 +362,8 @@ def identity(rows): original = Path(project) if (original != final and not original.is_symlink() and original.parent.resolve() == (Path(manager.home) / 'runtime').resolve() + and original != environments.project_path(manager.home) + and not original.name.startswith('q-') and str(original.resolve()) not in json.dumps(actual)): await asyncio.to_thread(shutil.rmtree, original) return final diff --git a/amplifier_web/updates.py b/amplifier_web/updates.py index 2a5d0af0e..46b982a05 100644 --- a/amplifier_web/updates.py +++ b/amplifier_web/updates.py @@ -958,10 +958,10 @@ async def run_one(workspace, bundle): await self.publish(detail='Recording and verifying the exact worker dependencies…',probeProgress=None) project=await freeze(self,release,project) if (project/'.venv').exists(): - verify_recorded(project,receipt) + await asyncio.to_thread(verify_recorded,project,receipt) await self.publish(detail=f'Checking {len(configs)} offered conversation profiles…') await probe(project) - verify_recorded(project,receipt) + await asyncio.to_thread(verify_recorded,project,receipt) from .runtime_profiles import configuration_key write_private(stage/'profiles-qualified.json', json.dumps({'profiles': profiles, 'configuration': configuration_key(config.settings, self.home, stage)})) diff --git a/tests/test_runtime_updates.py b/tests/test_runtime_updates.py index 54b96fcf6..411dcc8ca 100644 --- a/tests/test_runtime_updates.py +++ b/tests/test_runtime_updates.py @@ -283,6 +283,7 @@ async def test_freeze_captures_post_preparation_graph_and_preserves_future_branc before = installed_graph(current) final = await freeze(manager, generation, current) verify_recorded(final, receipt) + assert current.exists() # The baseline is a rollback target, not disposable. assert json.loads((receipt / 'runtime-installed.json').read_text()) == installed_graph(final) assert before and final != current (manager.home / 'updates/active.json').write_text(json.dumps({'current': generation})) @@ -391,6 +392,20 @@ async def test_nonprefixed_installed_override_blocks_stale_git_lock_staging(envi assert not active_release(manager.home) +async def test_successful_freeze_reclaims_only_its_disposable_preparation(installed_transitive): + from amplifier_web.runtime_qualification import freeze, verify_recorded + manager, current, *_ = installed_transitive + generation = 'ab' * 16 + receipt = environments.receipt_directory(manager.home, generation) + receipt.mkdir(parents=True) + preparation = current.with_name('prepare-' + generation) + current.rename(preparation) + final = await freeze(manager, generation, preparation) + assert not preparation.exists() + assert final.exists() + verify_recorded(final, receipt) + + async def test_identical_qualified_graph_reuses_environment_without_reinstallation(installed_transitive, monkeypatch): from amplifier_web.runtime_qualification import freeze, verify_recorded manager, current, row, old, new, repo = installed_transitive From af9b1e13048bd80b4d876d84eb109d7e9c5048f7 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Fri, 2 Oct 2026 12:36:09 -0700 Subject: [PATCH 3/3] Preserve shared source update policy and prepare release 0.20.46 --- amplifier_web/__init__.py | 2 +- amplifier_web/release-notes.json | 19 ++++ amplifier_web/runtime_environment.py | 55 ++++++++++- amplifier_web/runtime_qualification.py | 2 +- ...Bc.js => abnfDiagram-VCTEODGH-DkzoDDgP.js} | 2 +- .../{app-zsnl1T1T.js => app-DmCHnbVO.js} | 6 +- .../{arc-CxD3pp7w.js => arc-D2jKxjLS.js} | 2 +- ... architectureDiagram-5GKGNRK7-yUitYCC3.js} | 2 +- ...T.js => blockDiagram-I7D4REHJ-DIqSOQsY.js} | 2 +- ...wEv8.js => c4Diagram-7LVT6UL2-CyJ-OjiV.js} | 2 +- .../static/assets/channel-BcBgmgAp.js | 1 + .../static/assets/channel-CSv1n6Zd.js | 1 - ...DR5XPUmF.js => chunk-2Q5K7J3B-Ca-MXWFO.js} | 2 +- ...XkKVGNmc.js => chunk-5VM5RSS4-DuWyxJ-G.js} | 2 +- ...35QGDevQ.js => chunk-F27PBJKO-2GmsQB4U.js} | 2 +- ...D_IoXv7y.js => chunk-IMKFNOWR-qeP8E-nc.js} | 2 +- ...wq4F1yC9.js => chunk-JWPE2WC7-DQLdNA-f.js} | 2 +- ...C_hQ_kWj.js => chunk-POPQ4Y6H-OaNnn-K8.js} | 2 +- ...DegBQCYH.js => chunk-SVP7TREG-Wjd95MYc.js} | 2 +- ...-YXzYqRv.js => chunk-TICWLB2K-CXDwtwC7.js} | 2 +- ...DdE0HtLo.js => chunk-XXDRQBXY-CEoTwp0p.js} | 2 +- .../assets/classDiagram-ZZMXUADV-D0wKCQxK.js | 1 - .../assets/classDiagram-ZZMXUADV-DGoLhpgF.js | 1 + .../classDiagram-v2-VYDZK3BY-D0wKCQxK.js | 1 - .../classDiagram-v2-VYDZK3BY-DGoLhpgF.js | 1 + ...v.js => cose-bilkent-JH36ORCC-g-PZ3PJZ.js} | 2 +- ...aohCXI.js => cynefin-OW5HDTMX-r2gVnQsI.js} | 2 +- ...js => cynefinDiagram-5FMLGOSQ-DM3cCVfa.js} | 2 +- ...DqSq41IB.js => dagre-GXQ25YYZ-BZfaRacC.js} | 2 +- ...n2u9og.js => diagram-S7CK7UJ4-x7ODN_Fr.js} | 2 +- ...DpBRwj.js => diagram-UQ7AKVKN-De0fNkzZ.js} | 2 +- ...FQwR9c.js => diagram-VSXAHHWV-D-4K2Uv-.js} | 2 +- ...KyI2lv.js => diagram-VX7I27RA-B3oZVKXq.js} | 2 +- ...wRZKVi.js => diagram-Z3DM3KII-WNIFVi0Q.js} | 2 +- ...kH.js => ebnfDiagram-PWID7BFC-DyIJUwiI.js} | 2 +- ...776D.js => erDiagram-RLTQ6QDP-sS227ewn.js} | 2 +- ...wQ.js => flowDiagram-HODETNUW-BRjqrD7u.js} | 2 +- ...s.js => ganttDiagram-EL5Y4UJY-Dr_9OMcR.js} | 2 +- ...s => gitGraphDiagram-WWUBYQGX-CKFZpt0Z.js} | 2 +- ...oO.js => infoDiagram-27XIBGKW-CR9oYlVY.js} | 2 +- ...s => ishikawaDiagram-5VMMS53U-BQdVBYth.js} | 2 +- ...js => journeyDiagram-3NMN7TZE-B118or3e.js} | 2 +- ...=> kanban-definition-UXKFOSKX-B4aZ932z.js} | 2 +- ...{layout-xx7K6ykp.js => layout-B_w7f5cg.js} | 2 +- ...{linear-BcEdwvr4.js => linear-61bSIS_K.js} | 2 +- ...e-BQ5lTCZr.js => mermaid.core-YRnlneqM.js} | 10 +- ...> mindmap-definition-YA3MSWOX-DYGePCnN.js} | 2 +- ...BP1.js => pegDiagram-XKGWAZYB-CosznoAs.js} | 2 +- ...OYb.js => pieDiagram-E7YTZNPT-COMLqW9-.js} | 2 +- ...s => quadrantDiagram-AXDQQJYC-B0v9e3iH.js} | 2 +- ...s => railroadDiagram-O6MQD6OU-nUeJW8RG.js} | 2 +- ...> requirementDiagram-BXWQKSXE-Cb83i4fD.js} | 2 +- ....js => sankeyDiagram-P5KCCOFB-Dv0jV2ka.js} | 2 +- ...s => sequenceDiagram-WJ2MYXX4-D69Gj_rf.js} | 2 +- ...cH.js => sizeCapture-INFHLROL-Bt4UpecU.js} | 2 +- ...f.js => stateDiagram-D77RDMKH-BaS0tICg.js} | 2 +- .../stateDiagram-v2-MP3YSRHH-BRTKjL6-.js | 1 - .../stateDiagram-v2-MP3YSRHH-CtqGz6p6.js | 1 + ...nuS-.js => swimlanes-42K2YHIH-BcKWWDjF.js} | 2 +- .../swimlanesDiagram-VR7AAH4N-BWEneQLP.js | 8 ++ .../swimlanesDiagram-VR7AAH4N-CLgWPzHj.js | 8 -- ... timeline-definition-24CTP7MA-tqGUvpOH.js} | 2 +- ...PL.js => vennDiagram-4TSXK5OY-pcfAD8hQ.js} | 2 +- ...js => wardleyDiagram-VM6X3IG4-Ck_DXu78.js} | 2 +- ...js => xychartDiagram-S5SC5T6Z-BMGpkbBF.js} | 2 +- amplifier_web/static/build.json | 2 +- amplifier_web/static/index.html | 2 +- amplifier_web/update_inventory_index.py | 2 + pyproject.toml | 2 +- tests/test_runtime_shared_policy.py | 96 +++++++++++++++++++ tests/test_update_generations.py | 3 + uv.lock | 2 +- 72 files changed, 245 insertions(+), 80 deletions(-) rename amplifier_web/static/assets/{abnfDiagram-VCTEODGH-Bfs8g8Bc.js => abnfDiagram-VCTEODGH-DkzoDDgP.js} (86%) rename amplifier_web/static/assets/{app-zsnl1T1T.js => app-DmCHnbVO.js} (99%) rename amplifier_web/static/assets/{arc-CxD3pp7w.js => arc-D2jKxjLS.js} (98%) rename amplifier_web/static/assets/{architectureDiagram-5GKGNRK7-BMtIY0MM.js => architectureDiagram-5GKGNRK7-yUitYCC3.js} (99%) rename amplifier_web/static/assets/{blockDiagram-I7D4REHJ-JIRyk-UT.js => blockDiagram-I7D4REHJ-DIqSOQsY.js} (99%) rename amplifier_web/static/assets/{c4Diagram-7LVT6UL2-DdetwEv8.js => c4Diagram-7LVT6UL2-CyJ-OjiV.js} (99%) create mode 100644 amplifier_web/static/assets/channel-BcBgmgAp.js delete mode 100644 amplifier_web/static/assets/channel-CSv1n6Zd.js rename amplifier_web/static/assets/{chunk-2Q5K7J3B-DR5XPUmF.js => chunk-2Q5K7J3B-Ca-MXWFO.js} (66%) rename amplifier_web/static/assets/{chunk-5VM5RSS4-XkKVGNmc.js => chunk-5VM5RSS4-DuWyxJ-G.js} (83%) rename amplifier_web/static/assets/{chunk-F27PBJKO-35QGDevQ.js => chunk-F27PBJKO-2GmsQB4U.js} (96%) rename amplifier_web/static/assets/{chunk-IMKFNOWR-D_IoXv7y.js => chunk-IMKFNOWR-qeP8E-nc.js} (99%) rename amplifier_web/static/assets/{chunk-JWPE2WC7-wq4F1yC9.js => chunk-JWPE2WC7-DQLdNA-f.js} (78%) rename amplifier_web/static/assets/{chunk-POPQ4Y6H-C_hQ_kWj.js => chunk-POPQ4Y6H-OaNnn-K8.js} (87%) rename amplifier_web/static/assets/{chunk-SVP7TREG-DegBQCYH.js => chunk-SVP7TREG-Wjd95MYc.js} (99%) rename amplifier_web/static/assets/{chunk-TICWLB2K--YXzYqRv.js => chunk-TICWLB2K-CXDwtwC7.js} (99%) rename amplifier_web/static/assets/{chunk-XXDRQBXY-DdE0HtLo.js => chunk-XXDRQBXY-CEoTwp0p.js} (72%) delete mode 100644 amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js create mode 100644 amplifier_web/static/assets/classDiagram-ZZMXUADV-DGoLhpgF.js delete mode 100644 amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js create mode 100644 amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-DGoLhpgF.js rename amplifier_web/static/assets/{cose-bilkent-JH36ORCC-BYWhn9Rv.js => cose-bilkent-JH36ORCC-g-PZ3PJZ.js} (99%) rename amplifier_web/static/assets/{cynefin-OW5HDTMX-C5aohCXI.js => cynefin-OW5HDTMX-r2gVnQsI.js} (99%) rename amplifier_web/static/assets/{cynefinDiagram-5FMLGOSQ-T6cXmRvG.js => cynefinDiagram-5FMLGOSQ-DM3cCVfa.js} (98%) rename amplifier_web/static/assets/{dagre-GXQ25YYZ-DqSq41IB.js => dagre-GXQ25YYZ-BZfaRacC.js} (98%) rename amplifier_web/static/assets/{diagram-S7CK7UJ4-Bhn2u9og.js => diagram-S7CK7UJ4-x7ODN_Fr.js} (96%) rename amplifier_web/static/assets/{diagram-UQ7AKVKN-CsDpBRwj.js => diagram-UQ7AKVKN-De0fNkzZ.js} (95%) rename amplifier_web/static/assets/{diagram-VSXAHHWV-BPFQwR9c.js => diagram-VSXAHHWV-D-4K2Uv-.js} (98%) rename amplifier_web/static/assets/{diagram-VX7I27RA-DYKyI2lv.js => diagram-VX7I27RA-B3oZVKXq.js} (98%) rename amplifier_web/static/assets/{diagram-Z3DM3KII-C7wRZKVi.js => diagram-Z3DM3KII-WNIFVi0Q.js} (94%) rename amplifier_web/static/assets/{ebnfDiagram-PWID7BFC-CsupTakH.js => ebnfDiagram-PWID7BFC-DyIJUwiI.js} (87%) rename amplifier_web/static/assets/{erDiagram-RLTQ6QDP-DV4h776D.js => erDiagram-RLTQ6QDP-sS227ewn.js} (99%) rename amplifier_web/static/assets/{flowDiagram-HODETNUW-Bfis7KwQ.js => flowDiagram-HODETNUW-BRjqrD7u.js} (99%) rename amplifier_web/static/assets/{ganttDiagram-EL5Y4UJY-BU9eWm2s.js => ganttDiagram-EL5Y4UJY-Dr_9OMcR.js} (99%) rename amplifier_web/static/assets/{gitGraphDiagram-WWUBYQGX-BkBjc4gg.js => gitGraphDiagram-WWUBYQGX-CKFZpt0Z.js} (99%) rename amplifier_web/static/assets/{infoDiagram-27XIBGKW-D1rVSJoO.js => infoDiagram-27XIBGKW-CR9oYlVY.js} (68%) rename amplifier_web/static/assets/{ishikawaDiagram-5VMMS53U-B42RhGud.js => ishikawaDiagram-5VMMS53U-BQdVBYth.js} (99%) rename amplifier_web/static/assets/{journeyDiagram-3NMN7TZE-CkgASPQL.js => journeyDiagram-3NMN7TZE-B118or3e.js} (98%) rename amplifier_web/static/assets/{kanban-definition-UXKFOSKX-C_T9GYcq.js => kanban-definition-UXKFOSKX-B4aZ932z.js} (99%) rename amplifier_web/static/assets/{layout-xx7K6ykp.js => layout-B_w7f5cg.js} (99%) rename amplifier_web/static/assets/{linear-BcEdwvr4.js => linear-61bSIS_K.js} (98%) rename amplifier_web/static/assets/{mermaid.core-BQ5lTCZr.js => mermaid.core-YRnlneqM.js} (99%) rename amplifier_web/static/assets/{mindmap-definition-YA3MSWOX-CnwxkU_o.js => mindmap-definition-YA3MSWOX-DYGePCnN.js} (99%) rename amplifier_web/static/assets/{pegDiagram-XKGWAZYB-C77gkBP1.js => pegDiagram-XKGWAZYB-CosznoAs.js} (87%) rename amplifier_web/static/assets/{pieDiagram-E7YTZNPT-DYkXhOYb.js => pieDiagram-E7YTZNPT-COMLqW9-.js} (94%) rename amplifier_web/static/assets/{quadrantDiagram-AXDQQJYC-DHRSmvLk.js => quadrantDiagram-AXDQQJYC-B0v9e3iH.js} (99%) rename amplifier_web/static/assets/{railroadDiagram-O6MQD6OU-ByMdCyuE.js => railroadDiagram-O6MQD6OU-nUeJW8RG.js} (84%) rename amplifier_web/static/assets/{requirementDiagram-BXWQKSXE-DEA-5bvx.js => requirementDiagram-BXWQKSXE-Cb83i4fD.js} (99%) rename amplifier_web/static/assets/{sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js => sankeyDiagram-P5KCCOFB-Dv0jV2ka.js} (99%) rename amplifier_web/static/assets/{sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js => sequenceDiagram-WJ2MYXX4-D69Gj_rf.js} (99%) rename amplifier_web/static/assets/{sizeCapture-INFHLROL-CKc8uScH.js => sizeCapture-INFHLROL-Bt4UpecU.js} (87%) rename amplifier_web/static/assets/{stateDiagram-D77RDMKH-sy7Rfo0f.js => stateDiagram-D77RDMKH-BaS0tICg.js} (96%) delete mode 100644 amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js create mode 100644 amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CtqGz6p6.js rename amplifier_web/static/assets/{swimlanes-42K2YHIH-1QzInuS-.js => swimlanes-42K2YHIH-BcKWWDjF.js} (99%) create mode 100644 amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-BWEneQLP.js delete mode 100644 amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js rename amplifier_web/static/assets/{timeline-definition-24CTP7MA-Ck5GR00U.js => timeline-definition-24CTP7MA-tqGUvpOH.js} (99%) rename amplifier_web/static/assets/{vennDiagram-4TSXK5OY-kVi8iDPL.js => vennDiagram-4TSXK5OY-pcfAD8hQ.js} (99%) rename amplifier_web/static/assets/{wardleyDiagram-VM6X3IG4-xeAzTPpE.js => wardleyDiagram-VM6X3IG4-Ck_DXu78.js} (99%) rename amplifier_web/static/assets/{xychartDiagram-S5SC5T6Z-DF_x_q58.js => xychartDiagram-S5SC5T6Z-BMGpkbBF.js} (99%) create mode 100644 tests/test_runtime_shared_policy.py diff --git a/amplifier_web/__init__.py b/amplifier_web/__init__.py index 57e7fff49..5ec4ec10f 100644 --- a/amplifier_web/__init__.py +++ b/amplifier_web/__init__.py @@ -1,2 +1,2 @@ """Amplifier's local web host.""" -__version__ = "0.20.45" +__version__ = "0.20.46" diff --git a/amplifier_web/release-notes.json b/amplifier_web/release-notes.json index e85011808..265084f8f 100644 --- a/amplifier_web/release-notes.json +++ b/amplifier_web/release-notes.json @@ -1,6 +1,25 @@ { "schemaVersion": 1, "releases": [ + { + "version": "0.20.46", + "title": "Prepare shared component generations and adopt updates between work", + "changes": [ + "Prepare the currently offered app profiles together in one dependency installation, then check each profile in a fresh process. Historical chats and workspace combinations no longer multiply routine update preparation.", + "Reuse indexed source inventories and coalesced availability checks. Proven catalog-data-only changes reuse a qualified runtime; code, dependency and configuration changes still receive isolated qualification.", + "Share qualified component environments and exact source revisions across compatible conversation workers. Custom configurations prepare separately when first used, and conflicting requirements stop a candidate without changing the running environment.", + "Make compatible component updates available to new workers immediately. Active workers finish on their existing generation and adopt the update after safe retirement; active voice, queued input, approvals and uncertain operations remain protected.", + "Retain rollback and referenced generations, and reclaim only proven unused owned environments. Application updates still use the coordinated restart boundary. CLI caches and registries remain separate, and native history is preserved without replay." + ], + "notices": [ + { + "id": "shared-component-generations", + "title": "Use shared component generations", + "detail": "Component updates now prepare the current app offerings together. Already running conversation workers keep their loaded version until their work can safely retire.", + "action": "Let the included-components update finish once after installing this release. New work then uses the qualified generation automatically; application updates still require their normal restart." + } + ] + }, { "version": "0.20.45", "title": "Save changed conversation records and reuse unaffected client views", diff --git a/amplifier_web/runtime_environment.py b/amplifier_web/runtime_environment.py index 3239dc4ba..305073698 100644 --- a/amplifier_web/runtime_environment.py +++ b/amplifier_web/runtime_environment.py @@ -121,7 +121,47 @@ def installed_sources(project, *, graph=None, tracked=()): return result -def inventory(home, *, installed=None): +def shared_build_policies(home, generation, graph): + """A shared build's commit marker is identity, not its update policy. + + Restore only an unambiguous binding in this generation, for an owned clean + build view at that exact revision. Never infer a branch from a package name, + the app default, another generation, or a user's ordinary local checkout. + """ + from .update_sources import store_environment + environment = store_environment(home) + if not environment: + return {} + builds = Path(environment['AMPLIFIER_SOURCE_STORE']).resolve() / 'builds' + bindings = {} + base = receipt_directory(home, generation) / 'foundation/cache/.source-bindings' + for path in base.glob('*.json'): + if path.is_symlink(): + raise ValueError('External shared source binding') + data = json.loads(path.read_text()) + bindings.setdefault((data['git_url'], data['commit']), set()).add(data['ref']) + result = {} + for record in graph: + cached = record.get('cacheSource') + if not cached or cached.get('dirty') or not record.get('path'): + continue + root = Path(record['path']).resolve() + for _ in Path(cached['subdirectory']).parts: + root = root.parent + if root.parent != builds or root.is_symlink(): + continue + metadata = json.loads((root / '.amplifier_cache_meta.json').read_text()) + if not metadata.get('buildInput'): + continue + refs = bindings.get((cached['url'], cached['revision']), set()) + if len(refs) == 1: + result[record['name']] = {'url': cached['url'], 'ref': next(iter(refs)), + 'revision': cached['revision'], + 'subdirectory': '' if cached['subdirectory'] == '.' else cached['subdirectory']} + return result + + +def inventory(home, *, installed=None, graph=None): from .updates import active_release, safe_label, pinned generation = active_release(home).get('current') project = project_path(home, generation) @@ -131,6 +171,11 @@ def inventory(home, *, installed=None): sources = {package_name(name): source for name, source in sources.items()} policies = receipt_directory(home, generation) / 'runtime-sources.json' recorded_policies = json.loads(policies.read_text()) if policies.exists() else {} + from .runtime_qualification import installed_graph + graph = installed_graph(project) if graph is None else graph + # Earlier shared-build receipts did not preserve branch policy. Recover it + # from their exact private binding without rewriting the recorded graph. + effective_policies = {**shared_build_policies(home, generation, graph), **recorded_policies} observed = {} for name, resolved in locked.items(): name = package_name(name) @@ -143,10 +188,10 @@ def inventory(home, *, installed=None): 'ref': policy.get('ref') or next(iter(query.get('branch') or query.get('rev') or query.get('tag') or ['']), '') or source.get('branch') or source.get('rev') or '', 'current': resolved.fragment, 'subdirectory': next(iter(query.get('subdirectory', [''])), ''), 'provenance': 'worker resolution lock'} - for name, source in (installed_sources(project, tracked=locked) if installed is None else installed).items(): + for name, source in (installed_sources(project, graph=graph, tracked=locked) if installed is None else installed).items(): resolved = locked.get(name) - policy = recorded_policies.get(name) - if (policy and resolved and source.get('current') == resolved.fragment + policy = effective_policies.get(name) + if (policy and source.get('current') == (policy.get('revision') or (resolved.fragment if resolved else None)) and source.get('url') == policy.get('url') and source.get('subdirectory', '') == policy.get('subdirectory', '')): source['ref'] = policy['ref'] observed[name] = source @@ -252,7 +297,7 @@ async def update_inventory(home): raise ProtectedRuntimeSource('', 'runtime-source-changed') if active_release(home).get('current') != generation: raise ProtectedRuntimeSource('', 'runtime-source-changed') - return inventory(home, installed=policy) + return inventory(home, installed=policy, graph=graph) async def update_manifest(home): diff --git a/amplifier_web/runtime_qualification.py b/amplifier_web/runtime_qualification.py index 70a0f2a72..d773579a9 100644 --- a/amplifier_web/runtime_qualification.py +++ b/amplifier_web/runtime_qualification.py @@ -272,7 +272,7 @@ async def freeze(manager, generation, project): # Filesystem scans and payload hashing must not stall the serving event # loop while existing conversations continue on their pinned generation. graph = await asyncio.to_thread(installed_graph, project) - policies = {} + policies = environments.shared_build_policies(manager.home, generation, graph) for row in graph: vcs = row.get('directUrl', {}).get('vcs_info', {}) if vcs.get('vcs') == 'git': diff --git a/amplifier_web/static/assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js b/amplifier_web/static/assets/abnfDiagram-VCTEODGH-DkzoDDgP.js similarity index 86% rename from amplifier_web/static/assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js rename to amplifier_web/static/assets/abnfDiagram-VCTEODGH-DkzoDDgP.js index ca631415f..244175c80 100644 --- a/amplifier_web/static/assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js +++ b/amplifier_web/static/assets/abnfDiagram-VCTEODGH-DkzoDDgP.js @@ -1 +1 @@ -import{g as p,r as u,d as a}from"./chunk-SVP7TREG-DegBQCYH.js";import{p as f}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as n,l as o}from"./mermaid.core-BQ5lTCZr.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram}; +import{g as p,r as u,d as a}from"./chunk-SVP7TREG-Wjd95MYc.js";import{p as f}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{_ as n,l as o}from"./mermaid.core-YRnlneqM.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram}; diff --git a/amplifier_web/static/assets/app-zsnl1T1T.js b/amplifier_web/static/assets/app-DmCHnbVO.js similarity index 99% rename from amplifier_web/static/assets/app-zsnl1T1T.js rename to amplifier_web/static/assets/app-DmCHnbVO.js index 5e0a715e7..c6ab79ee3 100644 --- a/amplifier_web/static/assets/app-zsnl1T1T.js +++ b/amplifier_web/static/assets/app-DmCHnbVO.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BQ5lTCZr.js","assets/client-BPXDbY79.js","assets/index-D1m6Llf0.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-YRnlneqM.js","assets/client-BPXDbY79.js","assets/index-D1m6Llf0.js"])))=>i.map(i=>d[i]); var Ck=Object.defineProperty;var Nk=(e,t,a)=>t in e?Ck(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Ke=(e,t,a)=>Nk(e,typeof t!="symbol"?t+"":t,a);import{a as v,R as n,r as Mi,g as og,c as Rk}from"./client-BPXDbY79.js";const zi=v.createContext(null),_s=e=>{var t;return((t=e==null?void 0:e.view)==null?void 0:t.workSurface)||"chat"},Tk=(e,t=null)=>({workSurface:e,workWorkspaceId:t,workWorkspaceTab:"chats"});/** * @license lucide-react v0.468.0 - ISC * @@ -552,7 +552,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `))}function c(h,f,g,E){const y=g.enter("tableCell"),b=g.enter("phrasing"),S=g.containerPhrasing(h,{...E,before:i,after:i});return b(),y(),S}function u(h,f){return nT(h,{align:f,alignDelimiters:r,padding:a,stringLength:o})}function d(h,f,g){const E=h.children;let y=-1;const b=[],S=f.enter("table");for(;++y0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const iI={tokenize:hI,partial:!0};function sI(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:dI,continuation:{tokenize:pI},exit:mI}},text:{91:{name:"gfmFootnoteCall",tokenize:uI},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lI,resolveTo:cI}}}}function lI(e,t,a){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const c=r.events[o][1];if(c.type==="labelImage"){s=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!s||!s._balanced)return a(c);const u=Fa(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?a(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function cI(e,t){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...l),e}function uI(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return l;function l(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),c}function c(p){return p!==94?a(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(p){if(i>999||p===93&&!s||p===null||p===91||Bt(p))return a(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return o.includes(Fa(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(p)}return Bt(p)||(s=!0),i++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),i++,u):u(p)}}function dI(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,l;return c;function c(f){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(f){return f===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):a(f)}function d(f){if(s>999||f===93&&!l||f===null||f===91||Bt(f))return a(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=Fa(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Bt(f)||(l=!0),s++,e.consume(f),f===92?p:d}function p(f){return f===91||f===92||f===93?(e.consume(f),s++,d):d(f)}function m(f){return f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),o.includes(i)||o.push(i),Rt(e,h,"gfmFootnoteDefinitionWhitespace")):a(f)}function h(f){return t(f)}}function pI(e,t,a){return e.check(Hi,t,e.attempt(iI,t,a))}function mI(e){e.exit("gfmFootnoteDefinition")}function hI(e,t,a){const r=this;return Rt(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):a(i)}}function fI(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(s,l){let c=-1;for(;++c1?c(f):(s.consume(f),p++,h);if(p<2&&!a)return c(f);const E=s.exit("strikethroughSequenceTemporary"),y=bo(f);return E._open=!y||y===2&&!!g,E._close=!g||g===2&&!!y,l(f)}}}class gI{constructor(){this.map=[]}add(t,a,r){vI(this,t,a,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function vI(e,t,a,r){let o=0;if(!(a===0&&r.length===0)){for(;o-1;){const z=r.events[T][1].type;if(z==="lineEnding"||z==="linePrefix")T--;else break}const I=T>-1?r.events[T][1].type:null,F=I==="tableHead"||I==="tableRow"?x:c;return F===x&&r.parser.lazy[r.now().line]?a(k):F(k)}function c(k){return e.enter("tableHead"),e.enter("tableRow"),u(k)}function u(k){return k===124||(s=!0,i+=1),d(k)}function d(k){return k===null?a(k):tt(k)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),h):a(k):kt(k)?Rt(e,d,"whitespace")(k):(i+=1,s&&(s=!1,o+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),p(k)))}function p(k){return k===null||k===124||Bt(k)?(e.exit("data"),d(k)):(e.consume(k),k===92?m:p)}function m(k){return k===92||k===124?(e.consume(k),p):p(k)}function h(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(k):(e.enter("tableDelimiterRow"),s=!1,kt(k)?Rt(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):f(k))}function f(k){return k===45||k===58?E(k):k===124?(s=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),g):N(k)}function g(k){return kt(k)?Rt(e,E,"whitespace")(k):E(k)}function E(k){return k===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),y):k===45?(i+=1,y(k)):k===null||tt(k)?w(k):N(k)}function y(k){return k===45?(e.enter("tableDelimiterFiller"),b(k)):N(k)}function b(k){return k===45?(e.consume(k),b):k===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(k))}function S(k){return kt(k)?Rt(e,w,"whitespace")(k):w(k)}function w(k){return k===124?f(k):k===null||tt(k)?!s||o!==i?N(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(k)):N(k)}function N(k){return a(k)}function x(k){return e.enter("tableRow"),A(k)}function A(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),A):k===null||tt(k)?(e.exit("tableRow"),t(k)):kt(k)?Rt(e,A,"whitespace")(k):(e.enter("data"),C(k))}function C(k){return k===null||k===124||Bt(k)?(e.exit("data"),A(k)):(e.consume(k),k===92?O:C)}function O(k){return k===92||k===124?(e.consume(k),C):C(k)}}function wI(e,t){let a=-1,r=!0,o=0,i=[0,0,0,0],s=[0,0,0,0],l=!1,c=0,u,d,p;const m=new gI;for(;++aa[2]+1){const f=a[2]+1,g=a[3]-a[2]-1;e.add(f,g,[])}}e.add(a[3]+1,0,[["exit",p,t]])}return o!==void 0&&(i.end=Object.assign({},Xr(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function Ih(e,t,a,r,o){const i=[],s=Xr(t.events,a);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(a+1,0,i)}function Xr(e,t){const a=e[t],r=a[0]==="enter"?"start":"end";return a[1][r]}const kI={name:"tasklistCheck",tokenize:SI};function xI(){return{text:{91:kI}}}function SI(e,t,a){const r=this;return o;function o(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Bt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),s):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),s):a(c)}function s(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):a(c)}function l(c){return tt(c)?t(c):kt(c)?e.check({tokenize:CI},t,a)(c):a(c)}}function CI(e,t,a){return Rt(e,r,"whitespace");function r(o){return o===null?a(o):t(o)}}function NI(e){return ev([GT(),sI(),fI(e),yI(),xI()])}const RI={};function TI(e){const t=this,a=e||RI,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(NI(a)),i.push(ZT()),s.push(JT(a))}const II=new Set(["standard","document","email","chat_message","social_post"]);function AI(e,{offsets:t=!1}={}){const a=String(e||"").split(` `),r=[];let o=[],i=null,s=0,l=0;const c=a.map(p=>{const m=l;return l+=p.length+1,m}),u=(p,m)=>{o.length||(s=c[m]),o.push(p)},d=()=>{o.length&&(r.push({type:"text",text:o.join(` `),...t?{sourceOffset:s}:{}}),o=[])};for(let p=0;p=i.length&&(i=null):i=h[1],u(m,p);continue}const f=!i&&/^:::writing\{([^{}]*)\}\s*$/.exec(m);if(!f){u(m,p);continue}const g={},E=/([a-z]+)="([^"\r\n]*)"/g;let y;for(;y=E.exec(f[1]);)g[y[1]]=y[2];if(f[1].replace(E,"").trim()||!II.has(g.variant)||!/^\d{5}$/.test(g.id)||Object.keys(g).some(w=>!["variant","id","subject","recipient","cc","bcc"].includes(w))){u(m,p);continue}let S=p+1;for(;Sf("button",{type:"button",className:"a-soft",disabled:l,onClick:b,...S},y);async function E(){try{await navigator.clipboard.writeText(r),d("Copied writing.")}catch{d("Clipboard is unavailable. Select the text to copy it.")}}return f("section",{className:"a-selection-card a-writing-block","aria-label":"Reusable writing"},f("strong",null,e.subject||e.variant.replaceAll("_"," ")),...["recipient","cc","bcc"].filter(y=>e[y]).map(y=>f("p",{key:y},{recipient:"To",cc:"Cc",bcc:"Bcc"}[y]+": "+e[y])),i?f("textarea",{"aria-label":"Edit writing copy",rows:8,value:r,disabled:l,onChange:y=>o(y.target.value)}):a(r),f("div",{className:"a-dialog-actions"},g("Copy writing",E),g(i?"Preview copy":"Edit copy",()=>s(y=>!y)),t&&g("Save writing version",h,{className:"a-primary",disabled:l||!r.trim(),"data-action":"outputs.write"})),u&&f("p",{role:"status"},u))}function Wv(e){if(typeof e!="string"||e.length>600||!e.startsWith("amplifier-canvas://artifact/"))return null;try{const t=new URL(e),a=t.pathname.slice(1),r=t.searchParams.get("session"),o=t.searchParams.get("version");if(t.host!=="artifact"||t.username||t.password||t.hash||!/^[-\w]{1,100}$/.test(a)||!/^[-\w]{1,200}$/.test(r||"")||[...t.searchParams.keys()].sort().join(",")!=="session,version"||!/^\d+$/.test(o||""))return null;const i=Number(o);return!Number.isSafeInteger(i)||i<1?null:{id:a,sessionId:r,version:i}}catch{return null}}function PI({reference:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){if(!l.current){if(e.sessionId!==t.sessionId){s("This artifact belongs to another chat. Open the reference from its original chat.");return}l.current=!0,o(!0),s("");try{await t.act("canvas.select",e)}catch(u){s(u.message||"This saved artifact version is unavailable.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.select",title:"Open saved version "+e.version+" in Canvas",onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function js(e){if(typeof e!="string"||!e||e.length>4e3||/[\x00-\x1f\x7f]/.test(e)||e.startsWith("#")||e.startsWith("//"))return null;let t=e.replace(/:\d+(?::\d+)?$/,"");if(/^file:/i.test(t))try{const a=new URL(t);if(a.hostname&&a.hostname!=="localhost"||a.username||a.password)return null;t=a.pathname}catch{return null}else if(/^[a-z][a-z\d+.-]*:/i.test(t))return null;t=t.split(/[?#]/,1)[0];try{t=decodeURIComponent(t)}catch{return null}return/[\x00-\x1f\x7f\\]/.test(t)||t.startsWith("//")||/^www\./i.test(t)||/^[a-z][a-z\d+.-]*:/i.test(t)||(t=t.replace(/:\d+(?::\d+)?$/,""),!/[^/]\.[a-z\d_-]{1,20}$/i.test(t))?null:t}function OI({path:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){var u,d;if(!l.current){l.current=!0,o(!0),s("");try{const p=await t.act("canvas.openFile",{sessionId:t.sessionId,workspace:t.workspace,path:e});((u=p==null?void 0:p.result)==null?void 0:u.status)!=="opened"&&s(((d=p==null?void 0:p.result)==null?void 0:d.message)||"This file could not be opened.")}catch{s("This file could not be opened.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.openFile",title:"Open in Canvas: "+e,onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function MI(){return e=>{let t=100;function a(r){!r.children||["link","image","code","html"].includes(r.type)||(r.children=r.children.flatMap(o=>{if(!t)return[o];if(o.type==="inlineCode"){const i=js(o.value);if(i)return t--,[{type:"link",url:i,children:[o]}]}if(o.type==="text"){const i=[];let s=0;const l=new RegExp("(?s&&i.push({type:"text",value:o.value.slice(s,c.index)}),i.push({type:"link",url:u,children:[{type:"text",value:u}]}),s=c.index+u.length,t--)}if(s)return sn.createElement("a",{...r,href:t,target:t!=null&&t.startsWith("#")?void 0:"_blank",rel:"noopener noreferrer"},a),img:({src:e,alt:t})=>n.createElement("a",{href:e,target:"_blank",rel:"noopener noreferrer"},t?`Image: ${t}`:"Open image"),table:({node:e,...t})=>n.createElement("div",{className:"a-table-scroll"},n.createElement("table",t))},Jv=v.createContext(null);function zI({node:e,href:t,children:a,...r}){const o=v.useContext(Jv),i=o&&Wv(t),s=(o==null?void 0:o.workspace)&&js(t);return i?n.createElement(PI,{key:t,reference:i,context:o},a):s?n.createElement(OI,{key:JSON.stringify([o.sessionId,o.workspace,s]),path:s,context:o},a):n.createElement(Zv.a,{href:t,...r},a)}const ml=v.memo(function({text:t,className:a="",overrides:r={},writingContext:o,fileContext:i,mapSource:s=!1}){const l=!!(i!=null&&i.sessionId&&(i!=null&&i.act)),c=!!(l&&i.workspace),u=(d,p)=>n.createElement(gR,{remarkPlugins:[TI,...Number.isInteger(p)?[vS(d,p)]:[],...c?[MI]:[]],skipHtml:!0,urlTransform:m=>l&&Wv(m)||c&&js(m)?m:kv(m),components:{...Zv,...l?{a:zI}:{},...r}},d);return n.createElement(Jv.Provider,{value:l?i:null},n.createElement("div",{className:`a-markdown ${a}`.trim()},...AI(t,{offsets:s}).map((d,p)=>{const m=h=>u(h,h===d.text?d.sourceOffset:void 0);return d.type==="writing"?n.createElement(_I,{key:d.id+":"+p,part:d,context:o,render:m}):n.createElement(n.Fragment,{key:p},m(d.text))})))}),$s=(e,t,a)=>t("canvas.view",{id:e.id,patch:a});function vd(e,t,a="preview"){const r=v.useRef(t);return r.current=t,v.useMemo(()=>(o,i="")=>{e.id&&r.current("canvas.report",{id:e.id,part:a,status:o,message:String(i).slice(0,2e3)})},[e.id,a])}function LI(e){return t1.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:["foreignObject","script","image","a","use","animate","set"],FORBID_ATTR:["href","xlink:href"]})}let Ah;function Kv({kind:e,source:t,canvas:a,act:r,part:o="preview",embedded:i=!1}){var S,w;const s=v.useId().replace(/[^a-zA-Z0-9]/g,""),l=vd(a,r,o),[c,u]=v.useState({}),d=v.useRef(null),p=v.useRef(null),m=a.view||{},h=m.zoom||1,f=m.panX||0,g=m.panY||0;v.useEffect(()=>{let N=!0,x,A;u({}),l("pending");const C=O=>{N&&(clearTimeout(A),x==null||x.terminate(),u(O),l(O.error?"error":"ready",O.error||"Diagram rendered"))};if(t.length>5e4){C({error:"Diagrams must be 50,000 characters or smaller."});return}return e==="dot"?(x=new Worker(new URL("/assets/graphviz.worker-CZ5dJQ9S.js",import.meta.url),{type:"module"}),A=setTimeout(()=>C({error:"Diagram layout took too long. Simplify the graph and try again."}),15e3),x.onmessage=O=>C(O.data),x.onerror=O=>C({error:O.message||"Graph renderer failed"}),x.postMessage({source:t,engine:m.engine||"dot"})):(Ah||(Ah=zg(async()=>{const{default:O}=await import("./mermaid.core-BQ5lTCZr.js").then(k=>k.ca);return{default:O}},__vite__mapDeps([0,1])).then(({default:O})=>(O.initialize({startOnLoad:!1,securityLevel:"strict",maxTextSize:5e4,maxEdges:500,suppressErrorRendering:!0,theme:"default",flowchart:{htmlLabels:!1},htmlLabels:!1}),O))),Ah.then(O=>O.render(`canvas${s}`,t)).then(({svg:O})=>C({svg:O})).catch(O=>C({error:O.message||String(O)}))),()=>{N=!1,clearTimeout(A),x==null||x.terminate()}},[e,t,m.engine,s,l]);const E=v.useMemo(()=>c.svg?"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(LI(c.svg)):null,[c.svg]),y=N=>$s(a,r,N),b=(S=c.nodes)==null?void 0:S.find(N=>N.name===m.node);return n.createElement("div",{className:`a-diagram ${i?"embedded":""}`},!i&&n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom out","data-action":"canvas.view",onClick:()=>y({zoom:Math.max(.2,h-.2)})},n.createElement(kx,null)),n.createElement("span",null,Math.round(h*100),"%"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom in","data-action":"canvas.view",onClick:()=>y({zoom:Math.min(4,h+.2)})},n.createElement(wx,null)),n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.view",onClick:()=>y({zoom:1,panX:0,panY:0})},n.createElement(Gk,null),"Fit"),e==="dot"&&n.createElement("select",{"aria-label":"Graph layout","data-action":"canvas.view",value:m.engine||"dot",onChange:N=>y({engine:N.target.value,node:""})},["dot","neato","fdp","sfdp","circo","twopi"].map(N=>n.createElement("option",{key:N},N))))),c.error?n.createElement("div",{className:"a-canvas-result error",role:"alert"},n.createElement(zn,null),n.createElement("span",null,c.error)):E?n.createElement("div",{ref:p,className:"a-diagram-stage",tabIndex:0,"aria-label":"Diagram. Drag to pan; arrow keys move the view.",onKeyDown:N=>{const x={ArrowLeft:[-30,0],ArrowRight:[30,0],ArrowUp:[0,-30],ArrowDown:[0,30]};x[N.key]&&(N.preventDefault(),y({panX:f+x[N.key][0],panY:g+x[N.key][1]}))},onPointerDown:N=>{i||(d.current={x:N.clientX,y:N.clientY},N.currentTarget.setPointerCapture(N.pointerId))},onPointerUp:N=>{d.current&&(y({panX:Math.max(-1e4,Math.min(1e4,f+N.clientX-d.current.x)),panY:Math.max(-1e4,Math.min(1e4,g+N.clientY-d.current.y))}),d.current=null)}},n.createElement("img",{alt:a.title||"Diagram",draggable:"false",src:E,style:{transform:i?void 0:`translate(${f}px,${g}px) scale(${h})`}})):n.createElement("p",{role:"status"},"Drawing diagram…"),!i&&((w=c.nodes)==null?void 0:w.length)>0&&n.createElement("div",{className:"a-node-inspector"},n.createElement("label",null,"Inspect a node",n.createElement("select",{"aria-label":"Inspect graph node","data-action":"canvas.view",value:m.node||"",onChange:N=>y({node:N.target.value})},n.createElement("option",{value:""},"Choose a node…"),c.nodes.map(N=>n.createElement("option",{key:N.name,value:N.name},N.name)))),b&&n.createElement("dl",null,Object.entries(b).map(([N,x])=>n.createElement(n.Fragment,{key:N},n.createElement("dt",null,N),n.createElement("dd",null,typeof x=="object"?JSON.stringify(x):String(x)))))))}function DI({canvas:e,act:t}){const a=v.useMemo(()=>({pre:({children:r})=>n.createElement("div",{className:"a-canvas-code-block"},r),code:({className:r,children:o,node:i,...s})=>{var u,d,p;const l=(u=/language-(\w+)/.exec(r||""))==null?void 0:u[1],c=String(o).replace(/\n$/,"");return["mermaid","dot","graphviz"].includes(l)?n.createElement(Kv,{kind:l==="mermaid"?"mermaid":"dot",source:c,canvas:e,act:t,embedded:!0,part:`fence-${((p=(d=i==null?void 0:i.position)==null?void 0:d.start)==null?void 0:p.offset)||0}`}):n.createElement("code",{className:r,...s},o)}}),[e.id,t]);return n.createElement(ml,{text:e.content,overrides:a,mapSource:!0})}function lu({text:e}){const[t,a]=v.useState("");return v.useEffect(()=>{let r=!0;return a(""),e.length<1e5&&zg(async()=>{const{default:o}=await import("./index-D1m6Llf0.js");return{default:o}},__vite__mapDeps([2,1])).then(({default:o})=>{const i=o.highlightAuto(e).value;r&&a(i)}),()=>{r=!1}},[e]),t?n.createElement("pre",{className:"a-canvas-code"},n.createElement("code",{dangerouslySetInnerHTML:{__html:t}})):n.createElement("pre",{className:"a-canvas-code"},e)}function FI({canvas:e,act:t}){var N,x;const a=vd(e,t),r=e.view||{},o=e.content||"",i=!["text","image"].includes(e.kind),s=v.useRef(null),l=v.useRef(null),c=v.useRef(!1),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=["markdown","text"].includes(e.kind)&&!r.source;v.useEffect(()=>{if(d(null),f(""),!g)return;const A=()=>{var C;c.current||(C=l.current)!=null&&C.contains(document.activeElement)||(d(ES(s.current,window.getSelection(),o)),f(""))};return document.addEventListener("selectionchange",A),()=>document.removeEventListener("selectionchange",A)},[o,g,e.id,e.resourceRevision]);async function E(){var A,C;if(!(!(u!=null&&u.excerpt)||c.current)){c.current=!0,m(!0),f("");try{const O=await t("canvas.reference",{id:e.id,sessionId:e.sessionId,version:e.selectedVersion||e.revision||e.latestVersion,...u});((A=O==null?void 0:O.result)==null?void 0:A.status)==="referenced"&&(f("Reference added to your draft. Nothing was sent."),d(null),(C=window.getSelection())==null||C.removeAllRanges())}catch(O){f(O.message||"The reference could not be added.")}finally{c.current=!1,m(!1)}}}const y=v.useMemo(()=>{if(!["json","jsonl"].includes(e.kind))return{};try{return{value:e.kind==="json"?JSON.parse(o):o.split(` +`),...t?{sourceOffset:c[p+1]}:{},...g}),p=S}return d(),r}function _I({part:e,context:t,render:a}){const[r,o]=v.useState(e.text),[i,s]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(""),[p,m]=v.useState(null);async function h(){if(!l){c(!0),d("");try{const y=await t.act("outputs.write",{sessionId:t.sessionId,messageId:t.messageId,title:e.subject||e.variant.replaceAll("_"," "),variant:e.variant,content:r,...e.subject?{subject:e.subject}:{},...p?{parentId:p}:{}});if(!(y!=null&&y.accepted))throw Error("The writing version was not saved.");m(y.result.id),d("Saved a writing version."),s(!1)}catch(y){d(y.message)}finally{c(!1)}}}const f=n.createElement,g=(y,b,S={})=>f("button",{type:"button",className:"a-soft",disabled:l,onClick:b,...S},y);async function E(){try{await navigator.clipboard.writeText(r),d("Copied writing.")}catch{d("Clipboard is unavailable. Select the text to copy it.")}}return f("section",{className:"a-selection-card a-writing-block","aria-label":"Reusable writing"},f("strong",null,e.subject||e.variant.replaceAll("_"," ")),...["recipient","cc","bcc"].filter(y=>e[y]).map(y=>f("p",{key:y},{recipient:"To",cc:"Cc",bcc:"Bcc"}[y]+": "+e[y])),i?f("textarea",{"aria-label":"Edit writing copy",rows:8,value:r,disabled:l,onChange:y=>o(y.target.value)}):a(r),f("div",{className:"a-dialog-actions"},g("Copy writing",E),g(i?"Preview copy":"Edit copy",()=>s(y=>!y)),t&&g("Save writing version",h,{className:"a-primary",disabled:l||!r.trim(),"data-action":"outputs.write"})),u&&f("p",{role:"status"},u))}function Wv(e){if(typeof e!="string"||e.length>600||!e.startsWith("amplifier-canvas://artifact/"))return null;try{const t=new URL(e),a=t.pathname.slice(1),r=t.searchParams.get("session"),o=t.searchParams.get("version");if(t.host!=="artifact"||t.username||t.password||t.hash||!/^[-\w]{1,100}$/.test(a)||!/^[-\w]{1,200}$/.test(r||"")||[...t.searchParams.keys()].sort().join(",")!=="session,version"||!/^\d+$/.test(o||""))return null;const i=Number(o);return!Number.isSafeInteger(i)||i<1?null:{id:a,sessionId:r,version:i}}catch{return null}}function PI({reference:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){if(!l.current){if(e.sessionId!==t.sessionId){s("This artifact belongs to another chat. Open the reference from its original chat.");return}l.current=!0,o(!0),s("");try{await t.act("canvas.select",e)}catch(u){s(u.message||"This saved artifact version is unavailable.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.select",title:"Open saved version "+e.version+" in Canvas",onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function js(e){if(typeof e!="string"||!e||e.length>4e3||/[\x00-\x1f\x7f]/.test(e)||e.startsWith("#")||e.startsWith("//"))return null;let t=e.replace(/:\d+(?::\d+)?$/,"");if(/^file:/i.test(t))try{const a=new URL(t);if(a.hostname&&a.hostname!=="localhost"||a.username||a.password)return null;t=a.pathname}catch{return null}else if(/^[a-z][a-z\d+.-]*:/i.test(t))return null;t=t.split(/[?#]/,1)[0];try{t=decodeURIComponent(t)}catch{return null}return/[\x00-\x1f\x7f\\]/.test(t)||t.startsWith("//")||/^www\./i.test(t)||/^[a-z][a-z\d+.-]*:/i.test(t)||(t=t.replace(/:\d+(?::\d+)?$/,""),!/[^/]\.[a-z\d_-]{1,20}$/i.test(t))?null:t}function OI({path:e,context:t,children:a}){const[r,o]=v.useState(!1),[i,s]=v.useState(""),l=v.useRef(!1);async function c(){var u,d;if(!l.current){l.current=!0,o(!0),s("");try{const p=await t.act("canvas.openFile",{sessionId:t.sessionId,workspace:t.workspace,path:e});((u=p==null?void 0:p.result)==null?void 0:u.status)!=="opened"&&s(((d=p==null?void 0:p.result)==null?void 0:d.message)||"This file could not be opened.")}catch{s("This file could not be opened.")}finally{l.current=!1,o(!1)}}}return n.createElement("span",{className:"a-file-reference"},n.createElement("button",{type:"button",className:"a-link",disabled:r,"data-action":"canvas.openFile",title:"Open in Canvas: "+e,onClick:c},a),i&&n.createElement("span",{role:"status",className:"a-caption"}," "+i))}function MI(){return e=>{let t=100;function a(r){!r.children||["link","image","code","html"].includes(r.type)||(r.children=r.children.flatMap(o=>{if(!t)return[o];if(o.type==="inlineCode"){const i=js(o.value);if(i)return t--,[{type:"link",url:i,children:[o]}]}if(o.type==="text"){const i=[];let s=0;const l=new RegExp("(?s&&i.push({type:"text",value:o.value.slice(s,c.index)}),i.push({type:"link",url:u,children:[{type:"text",value:u}]}),s=c.index+u.length,t--)}if(s)return sn.createElement("a",{...r,href:t,target:t!=null&&t.startsWith("#")?void 0:"_blank",rel:"noopener noreferrer"},a),img:({src:e,alt:t})=>n.createElement("a",{href:e,target:"_blank",rel:"noopener noreferrer"},t?`Image: ${t}`:"Open image"),table:({node:e,...t})=>n.createElement("div",{className:"a-table-scroll"},n.createElement("table",t))},Jv=v.createContext(null);function zI({node:e,href:t,children:a,...r}){const o=v.useContext(Jv),i=o&&Wv(t),s=(o==null?void 0:o.workspace)&&js(t);return i?n.createElement(PI,{key:t,reference:i,context:o},a):s?n.createElement(OI,{key:JSON.stringify([o.sessionId,o.workspace,s]),path:s,context:o},a):n.createElement(Zv.a,{href:t,...r},a)}const ml=v.memo(function({text:t,className:a="",overrides:r={},writingContext:o,fileContext:i,mapSource:s=!1}){const l=!!(i!=null&&i.sessionId&&(i!=null&&i.act)),c=!!(l&&i.workspace),u=(d,p)=>n.createElement(gR,{remarkPlugins:[TI,...Number.isInteger(p)?[vS(d,p)]:[],...c?[MI]:[]],skipHtml:!0,urlTransform:m=>l&&Wv(m)||c&&js(m)?m:kv(m),components:{...Zv,...l?{a:zI}:{},...r}},d);return n.createElement(Jv.Provider,{value:l?i:null},n.createElement("div",{className:`a-markdown ${a}`.trim()},...AI(t,{offsets:s}).map((d,p)=>{const m=h=>u(h,h===d.text?d.sourceOffset:void 0);return d.type==="writing"?n.createElement(_I,{key:d.id+":"+p,part:d,context:o,render:m}):n.createElement(n.Fragment,{key:p},m(d.text))})))}),$s=(e,t,a)=>t("canvas.view",{id:e.id,patch:a});function vd(e,t,a="preview"){const r=v.useRef(t);return r.current=t,v.useMemo(()=>(o,i="")=>{e.id&&r.current("canvas.report",{id:e.id,part:a,status:o,message:String(i).slice(0,2e3)})},[e.id,a])}function LI(e){return t1.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:["foreignObject","script","image","a","use","animate","set"],FORBID_ATTR:["href","xlink:href"]})}let Ah;function Kv({kind:e,source:t,canvas:a,act:r,part:o="preview",embedded:i=!1}){var S,w;const s=v.useId().replace(/[^a-zA-Z0-9]/g,""),l=vd(a,r,o),[c,u]=v.useState({}),d=v.useRef(null),p=v.useRef(null),m=a.view||{},h=m.zoom||1,f=m.panX||0,g=m.panY||0;v.useEffect(()=>{let N=!0,x,A;u({}),l("pending");const C=O=>{N&&(clearTimeout(A),x==null||x.terminate(),u(O),l(O.error?"error":"ready",O.error||"Diagram rendered"))};if(t.length>5e4){C({error:"Diagrams must be 50,000 characters or smaller."});return}return e==="dot"?(x=new Worker(new URL("/assets/graphviz.worker-CZ5dJQ9S.js",import.meta.url),{type:"module"}),A=setTimeout(()=>C({error:"Diagram layout took too long. Simplify the graph and try again."}),15e3),x.onmessage=O=>C(O.data),x.onerror=O=>C({error:O.message||"Graph renderer failed"}),x.postMessage({source:t,engine:m.engine||"dot"})):(Ah||(Ah=zg(async()=>{const{default:O}=await import("./mermaid.core-YRnlneqM.js").then(k=>k.ca);return{default:O}},__vite__mapDeps([0,1])).then(({default:O})=>(O.initialize({startOnLoad:!1,securityLevel:"strict",maxTextSize:5e4,maxEdges:500,suppressErrorRendering:!0,theme:"default",flowchart:{htmlLabels:!1},htmlLabels:!1}),O))),Ah.then(O=>O.render(`canvas${s}`,t)).then(({svg:O})=>C({svg:O})).catch(O=>C({error:O.message||String(O)}))),()=>{N=!1,clearTimeout(A),x==null||x.terminate()}},[e,t,m.engine,s,l]);const E=v.useMemo(()=>c.svg?"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(LI(c.svg)):null,[c.svg]),y=N=>$s(a,r,N),b=(S=c.nodes)==null?void 0:S.find(N=>N.name===m.node);return n.createElement("div",{className:`a-diagram ${i?"embedded":""}`},!i&&n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom out","data-action":"canvas.view",onClick:()=>y({zoom:Math.max(.2,h-.2)})},n.createElement(kx,null)),n.createElement("span",null,Math.round(h*100),"%"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Zoom in","data-action":"canvas.view",onClick:()=>y({zoom:Math.min(4,h+.2)})},n.createElement(wx,null)),n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.view",onClick:()=>y({zoom:1,panX:0,panY:0})},n.createElement(Gk,null),"Fit"),e==="dot"&&n.createElement("select",{"aria-label":"Graph layout","data-action":"canvas.view",value:m.engine||"dot",onChange:N=>y({engine:N.target.value,node:""})},["dot","neato","fdp","sfdp","circo","twopi"].map(N=>n.createElement("option",{key:N},N))))),c.error?n.createElement("div",{className:"a-canvas-result error",role:"alert"},n.createElement(zn,null),n.createElement("span",null,c.error)):E?n.createElement("div",{ref:p,className:"a-diagram-stage",tabIndex:0,"aria-label":"Diagram. Drag to pan; arrow keys move the view.",onKeyDown:N=>{const x={ArrowLeft:[-30,0],ArrowRight:[30,0],ArrowUp:[0,-30],ArrowDown:[0,30]};x[N.key]&&(N.preventDefault(),y({panX:f+x[N.key][0],panY:g+x[N.key][1]}))},onPointerDown:N=>{i||(d.current={x:N.clientX,y:N.clientY},N.currentTarget.setPointerCapture(N.pointerId))},onPointerUp:N=>{d.current&&(y({panX:Math.max(-1e4,Math.min(1e4,f+N.clientX-d.current.x)),panY:Math.max(-1e4,Math.min(1e4,g+N.clientY-d.current.y))}),d.current=null)}},n.createElement("img",{alt:a.title||"Diagram",draggable:"false",src:E,style:{transform:i?void 0:`translate(${f}px,${g}px) scale(${h})`}})):n.createElement("p",{role:"status"},"Drawing diagram…"),!i&&((w=c.nodes)==null?void 0:w.length)>0&&n.createElement("div",{className:"a-node-inspector"},n.createElement("label",null,"Inspect a node",n.createElement("select",{"aria-label":"Inspect graph node","data-action":"canvas.view",value:m.node||"",onChange:N=>y({node:N.target.value})},n.createElement("option",{value:""},"Choose a node…"),c.nodes.map(N=>n.createElement("option",{key:N.name,value:N.name},N.name)))),b&&n.createElement("dl",null,Object.entries(b).map(([N,x])=>n.createElement(n.Fragment,{key:N},n.createElement("dt",null,N),n.createElement("dd",null,typeof x=="object"?JSON.stringify(x):String(x)))))))}function DI({canvas:e,act:t}){const a=v.useMemo(()=>({pre:({children:r})=>n.createElement("div",{className:"a-canvas-code-block"},r),code:({className:r,children:o,node:i,...s})=>{var u,d,p;const l=(u=/language-(\w+)/.exec(r||""))==null?void 0:u[1],c=String(o).replace(/\n$/,"");return["mermaid","dot","graphviz"].includes(l)?n.createElement(Kv,{kind:l==="mermaid"?"mermaid":"dot",source:c,canvas:e,act:t,embedded:!0,part:`fence-${((p=(d=i==null?void 0:i.position)==null?void 0:d.start)==null?void 0:p.offset)||0}`}):n.createElement("code",{className:r,...s},o)}}),[e.id,t]);return n.createElement(ml,{text:e.content,overrides:a,mapSource:!0})}function lu({text:e}){const[t,a]=v.useState("");return v.useEffect(()=>{let r=!0;return a(""),e.length<1e5&&zg(async()=>{const{default:o}=await import("./index-D1m6Llf0.js");return{default:o}},__vite__mapDeps([2,1])).then(({default:o})=>{const i=o.highlightAuto(e).value;r&&a(i)}),()=>{r=!1}},[e]),t?n.createElement("pre",{className:"a-canvas-code"},n.createElement("code",{dangerouslySetInnerHTML:{__html:t}})):n.createElement("pre",{className:"a-canvas-code"},e)}function FI({canvas:e,act:t}){var N,x;const a=vd(e,t),r=e.view||{},o=e.content||"",i=!["text","image"].includes(e.kind),s=v.useRef(null),l=v.useRef(null),c=v.useRef(!1),[u,d]=v.useState(null),[p,m]=v.useState(!1),[h,f]=v.useState(""),g=["markdown","text"].includes(e.kind)&&!r.source;v.useEffect(()=>{if(d(null),f(""),!g)return;const A=()=>{var C;c.current||(C=l.current)!=null&&C.contains(document.activeElement)||(d(ES(s.current,window.getSelection(),o)),f(""))};return document.addEventListener("selectionchange",A),()=>document.removeEventListener("selectionchange",A)},[o,g,e.id,e.resourceRevision]);async function E(){var A,C;if(!(!(u!=null&&u.excerpt)||c.current)){c.current=!0,m(!0),f("");try{const O=await t("canvas.reference",{id:e.id,sessionId:e.sessionId,version:e.selectedVersion||e.revision||e.latestVersion,...u});((A=O==null?void 0:O.result)==null?void 0:A.status)==="referenced"&&(f("Reference added to your draft. Nothing was sent."),d(null),(C=window.getSelection())==null||C.removeAllRanges())}catch(O){f(O.message||"The reference could not be added.")}finally{c.current=!1,m(!1)}}}const y=v.useMemo(()=>{if(!["json","jsonl"].includes(e.kind))return{};try{return{value:e.kind==="json"?JSON.parse(o):o.split(` `).filter(A=>A.trim()).map(A=>JSON.parse(A))}}catch(A){return{error:A.message}}},[e.kind,o]);v.useEffect(()=>{["html","babylon","image","dot","mermaid"].includes(e.kind)||a(y.error?"error":"ready",y.error||"Preview ready")},[e.id,e.kind,y.error,a]);const b=Object.values(e.renderReports||{}),S=b.find(A=>A.status==="error"),w=b.some(A=>A.status==="pending");return n.createElement("div",{className:"a-canvas-viewer"},n.createElement(yr,null,n.createElement("div",{className:"a-canvas-toolbar"},i&&n.createElement(n.Fragment,null,n.createElement("button",{type:"button",className:"a-soft","aria-pressed":!r.source,"data-action":"canvas.view",onClick:()=>$s(e,t,{source:!1})},n.createElement($k,null),"Preview"),n.createElement("button",{type:"button",className:"a-soft","aria-pressed":!!r.source,"data-action":"canvas.view",onClick:()=>$s(e,t,{source:!0})},n.createElement(jk,null),"Source")),n.createElement("span",{className:"a-canvas-format"},e.kind),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Copy canvas source","data-action":"canvas.copy",onClick:()=>t("canvas.copy",{id:e.id})},n.createElement(rr,null)),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Download canvas source","data-action":"canvas.download",onClick:()=>t("canvas.download",{id:e.id})},n.createElement(wa,null)))),g&&n.createElement("div",{className:"a-canvas-reference",ref:l},n.createElement("button",{type:"button",className:"a-soft","data-action":"canvas.reference",disabled:p||!(u!=null&&u.excerpt),onMouseDown:A=>A.preventDefault(),onClick:E},p?"Adding reference…":"Reference in chat"),n.createElement("span",{role:"status",className:"a-caption"},h||(u==null?void 0:u.error)||(u!=null&&u.excerpt?`${[...u.excerpt].length} characters selected`:"Select document text to quote in your draft."))),n.createElement("div",{className:"a-canvas-preview",ref:s,tabIndex:g?0:void 0,"aria-label":g?"Document text":void 0},r.source?e.contentResource?n.createElement(jI,{canvas:e}):n.createElement(lu,{text:o}):["html","babylon"].includes(e.kind)?n.createElement(UI,{canvas:e,act:t}):["mermaid","dot"].includes(e.kind)?n.createElement(Kv,{kind:e.kind,source:o,canvas:e,act:t}):e.kind==="markdown"?n.createElement(DI,{canvas:e,act:t}):e.kind==="image"?n.createElement("img",{className:"a-canvas-image",src:o,alt:e.title||"Workspace image",onLoad:()=>a("ready","Image loaded"),onError:()=>a("error","This image could not be decoded")}):["json","jsonl"].includes(e.kind)?y.error?n.createElement("div",{className:"a-canvas-result error",role:"alert"},y.error):n.createElement(qI,{value:y.value,canvas:e,act:t}):e.kind==="code"?n.createElement(lu,{text:o}):n.createElement("pre",{className:"a-canvas-plain"},n.createElement("span",{"data-canvas-source-start":"0","data-canvas-source-end":o.length,"data-canvas-literal":"true"},o))),n.createElement(yr,{inline:!!S||w},n.createElement("div",{className:`a-canvas-result ${S?"error":w?"":"success"}`,role:"status"},S?n.createElement(zn,null):w?null:n.createElement(Pt,null),n.createElement("span",null,S?S.message||"Preview needs attention":w?"Rendering…":((x=(N=e.renderReports)==null?void 0:N.clipboard)==null?void 0:x.message)||(["html","babylon"].includes(e.kind)?"Isolated HTML preview":"Ready")))))}function qI({value:e,canvas:t,act:a}){var s;const r=((s=t.view)==null?void 0:s.query)||"",o=Array.isArray(e)?e:[e],i=o.map((l,c)=>({v:l,i:c})).filter(({v:l})=>!r||JSON.stringify(l).toLowerCase().includes(r.toLowerCase()));return n.createElement("div",{className:"a-canvas-data"},n.createElement("input",{"aria-label":"Filter data records",type:"search",placeholder:"Filter records…",value:r,"data-action":"canvas.view",onChange:l=>$s(t,a,{query:l.target.value})}),n.createElement("small",null,i.length," of ",o.length," records"),i.slice(0,200).map(({v:l,i:c})=>n.createElement("pre",{key:c},JSON.stringify(l,null,2))),i.length>200&&n.createElement("p",null,"Showing the first 200 matches. Narrow the filter to see more."))}function UI({canvas:e,act:t}){const a=v.useRef(null),r=vd(e,t),o=v.useRef(t),i=v.useRef(null);return o.current=t,v.useEffect(()=>{r("pending","Loading HTML document");const s=l=>{var c,u;if(!(l.source!==((c=a.current)==null?void 0:c.contentWindow)||((u=l.data)==null?void 0:u.id)!==e.id)&&(l.data.type==="canvas-render"&&["ready","error"].includes(l.data.status)&&r(l.data.status,String(l.data.message||"").slice(0,2e3)),l.data.type==="canvas-snapshot")){const d=l.data.document;if(!d||typeof d.text!="string"||!Array.isArray(d.controls))return;const p={text:d.text.slice(0,16e3),controls:d.controls.slice(0,100).map(m=>({id:String(m.id||"").slice(0,100),tag:String(m.tag||"").slice(0,30),type:String(m.type||"").slice(0,30),label:String(m.label||"").slice(0,200),value:String(m.value||"").slice(0,4e3),disabled:!!m.disabled}))};o.current("canvas.snapshot",{id:e.id,document:p})}};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)},[e.id,r]),v.useEffect(()=>{var l,c;const s=e.interaction;s&&i.current!==s.requestId&&(i.current=s.requestId,(c=(l=a.current)==null?void 0:l.contentWindow)==null||c.postMessage({type:"canvas-interact",...s},"*"))},[e.interaction]),n.createElement("iframe",{ref:a,title:e.title||"Interactive canvas",className:"a-canvas-html",sandbox:"allow-scripts",referrerPolicy:"no-referrer",src:$i(`/api/canvas/${e.id}/document`+(e.viewId?"?"+new URLSearchParams({viewId:e.viewId,resourceId:e.id,resourceRevision:e.resourceRevision,generation:e.generation}):""))})}function jI({canvas:e}){const[t,a]=v.useState({});return v.useEffect(()=>{const r=new AbortController;return a({}),fetch($i(`/api/canvas/${e.id}/source?version=${e.selectedVersion??e.revision??1}`),{signal:r.signal}).then(async o=>{if(!o.ok)throw Error("The saved source could not be loaded.");return o.text()}).then(o=>a({text:o})).catch(o=>{o.name!=="AbortError"&&a({error:o.message})}),()=>r.abort()},[e.id,e.selectedVersion,e.revision]),t.error?n.createElement("p",{role:"alert"},t.error):t.text===void 0?n.createElement("p",{role:"status"},"Loading saved source…"):n.createElement(lu,{text:t.text})}var $I=Object.create,bd=Object.defineProperty,BI=Object.getOwnPropertyDescriptor,HI=Object.getOwnPropertyNames,VI=Object.getPrototypeOf,WI=Object.prototype.hasOwnProperty,ZI=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),JI=(e,t)=>{let a={};for(var r in e)bd(a,r,{get:e[r],enumerable:!0});return a},KI=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=HI(t),i=0,s=o.length,l;it[c]).bind(null,l),enumerable:!(r=BI(t,l))||r.enumerable});return e},YI=(e,t,a)=>(a=e!=null?$I(VI(e)):{},KI(bd(a,"default",{value:e,enumerable:!0}),e));const GI=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function QI(e){return typeof e=="string"&&GI.has(e.replace(/#$/,""))}function cu(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function _h(e,t="|"){return e.map(a=>eb(a)).join(t)}function uu(e,t){return typeof t=="bigint"?t.toString():t}class XI{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function hl(e){return new XI(e)}function e2(e){return e==null}function yd(e){const t=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(t,a)}function t2(e,t){const a=e/t,r=Math.round(a),o=4*Number.EPSILON*Math.max(Math.abs(a),1);return Math.abs(a-r){const l=t._zod.def.shape[i];return r?r(l,i):l}):Gv(e,i,r?r(s.value,i):s.value))}}function a2(e,t){for(const a of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,a);r.enumerable&&(r.get?Yv(e,a,()=>t[a]):Gv(e,a,r.value))}}function ya(...e){const t={};for(const a of e){const r=Object.getOwnPropertyDescriptors(a);Object.assign(t,r)}return Object.defineProperties({},t)}function r2(e){return JSON.stringify(e)}function o2(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Qv="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Si(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const i2=hl(()=>{var e;if(qa.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function yo(e){if(Si(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const a=t.prototype;return!(Si(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function Xv(e){return yo(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const s2=new Set(["string","number","symbol"]);function Eo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xr(e,t,a){const r=new e._zod.constr(t??e._zod.def);return(!t||a!=null&&a.parent)&&(r._zod.parent=e),r}function Ve(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function eb(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function l2(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const tb={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]},c2={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function u2(e,t){const a=e._zod.def,r=a.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return $r(i,e,fl(e,t)),xr(e,ya(a,{shape:i,checks:[]}))}function fl(e,t){var o;const a=ar(e),r=[];for(const i of Reflect.ownKeys(t)){if(!((o=Object.getOwnPropertyDescriptor(a,i))!=null&&o.enumerable))throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function d2(e,t){const a=e._zod.def,r=a.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(fl(e,t)),s={};return $r(s,e,Reflect.ownKeys(ar(e)).filter(l=>!i.has(l))),xr(e,ya(a,{shape:s,checks:[]}))}function p2(e,t){if(!yo(t))throw new Error("Invalid input to extend: expected a plain object");const a=e._zod.def.checks;if(a&&a.length>0){const o=ar(e);for(const i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xr(e,ya(e._zod.def,{shape:nb(e,t)}))}function nb(e,t){const a={};return $r(a,e,Reflect.ownKeys(ar(e))),a2(a,t),a}function m2(e,t){if(!yo(t))throw new Error("Invalid input to safeExtend: expected a plain object");return xr(e,ya(e._zod.def,{shape:nb(e,t)}))}function h2(e,t){var o,i;if(!((o=t==null?void 0:t._zod)!=null&&o.def))throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if((i=e._zod.def.checks)!=null&&i.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const a={};$r(a,e,Reflect.ownKeys(ar(e))),$r(a,t,Reflect.ownKeys(ar(t)));const r=ya(e._zod.def,{shape:a,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return xr(e,r)}function Oh(e,t,a,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const l=a?new Set(fl(t,a)):void 0,c={};return $r(c,t,Reflect.ownKeys(ar(t)),e&&((u,d)=>l&&!l.has(d)?u:new e({type:"optional",innerType:u}))),xr(t,ya(t._zod.def,{shape:c,checks:[]}))}function f2(e,t,a){const r=a?new Set(fl(t,a)):void 0,o={};return $r(o,t,Reflect.ownKeys(ar(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),xr(t,ya(t._zod.def,{shape:o}))}function er(e,t=0){var a;if(e.aborted===!0)return!0;for(let r=t;r{var r;return(r=a).path??(r.path=[]),a.path.unshift(e),a})}function Qo(e){return typeof e=="string"?e:e==null?void 0:e.message}function Mh(e,t,a){var r;for(let o=t;oe;return t[x2]=!0,t}var Lh;const C2=Object.freeze({status:"aborted"}),gc={value:void 0,enumerable:!1};let Dh="captureStackTrace"in Error?Error:null;function N2(e){const t=Dh;if(t){const a=t.stackTraceLimit;if(typeof a=="number"){try{t.stackTraceLimit=0}catch{return Dh=null,new e}try{return new e}finally{t.stackTraceLimit=a}}}return new e}function ce(e,t,a,r){const o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;const s=a,l=s&&new WeakSet;function c(m,h){if(!m._zod){gc.value=new i(h);try{Object.defineProperty(m,"_zod",gc)}finally{gc.value=void 0}}if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,h),l){const g=Object.getPrototypeOf(m),E=m._zod.constr.prototype;let y=g;for(;y&&y!==E;)y=Object.getPrototypeOf(y);const b=y??g;l.has(b)||(l.add(b),y2(b,s))}const f=p.prototype;for(const g in f)Object.prototype.hasOwnProperty.call(f,g)&&(g in m||(m[g]=f[g].bind(m)))}const u=(r==null?void 0:r.Parent)??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function p(m){var E;const h=r!=null&&r.Parent?N2(d):this;c(h,m);const f=h._zod.deferred;if(f){for(const y of f)y();h._zod.deferred=void 0}const g=(E=globalThis.__zod_globalConfig)==null?void 0:E.postProcessor;return g&&g(h),h}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:m=>{var h,f;return r!=null&&r.Parent&&m instanceof r.Parent?!0:(f=(h=m==null?void 0:m._zod)==null?void 0:h.traits)==null?void 0:f.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class zr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ob extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Lh=globalThis).__zod_globalConfig??(Lh.__zod_globalConfig={});const qa=globalThis.__zod_globalConfig;function Ka(e){return e&&Object.assign(qa,e),qa}function R2(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,uu,2)),e.message}function T2(e){this._zod.message=e}const I2={get:R2,set:T2,enumerable:!0,configurable:!0},vc={value:void 0,enumerable:!1},Fh=new WeakSet([Object.prototype,Error.prototype]),A2=(e,t)=>{e.name="$ZodError",vc.value=t,Object.defineProperty(e,"issues",vc),vc.value=void 0,Object.defineProperty(e,"message",I2);const a=Object.getPrototypeOf(e);Fh.has(a)||(Fh.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},_2=ce("$ZodError",A2);function P2(e,t,a){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:a(),writable:!0,enumerable:!0,configurable:!0}):e[t]=a()),e[t]}function O2(e,t=a=>a.message){const a={},r=[];for(const o of e.issues)o.path.length>0?P2(a,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:a}}function M2(e,t=a=>a.message){const a={_errors:[]},r=(o,i=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>r({issues:l},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{const l=[...i,...s.path];if(l.length===0)a._errors.push(t(s));else{let c=a,u=0;for(;u{const t=(a,r,o,i)=>{const s=o?{...o,async:!1}:{async:!1},l=a._zod.run({value:r,issues:[]},s);if(l instanceof Promise)throw new zr;if(l.issues.length){const c=new((i==null?void 0:i.Err)??e)(l.issues.map(u=>Er(u,s,Ka())));throw Qv(c,(i==null?void 0:i.callee)??t),c}return l.value};return t},Sd=e=>{const t=async(a,r,o,i)=>{const s=o?{...o,async:!0}:{async:!0};let l=a._zod.run({value:r,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const c=new((i==null?void 0:i.Err)??e)(l.issues.map(u=>Er(u,s,Ka())));throw Qv(c,(i==null?void 0:i.callee)??t),c}return l.value};return t},Cd=e=>(t,a,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:a,issues:[]},o);if(i instanceof Promise)throw new zr;return i.issues.length?ib(e,i.issues,o):{success:!0,data:i.value}};function ib(e,t,a){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>Er(o,a,Ka()))),t=void 0,a=void 0),r},set error(o){r=o,t=void 0,a=void 0}}}const Nd=e=>async(t,a,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:a,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?ib(e,i.issues,o):{success:!0,data:i.value}},z2=Symbol.for("zod.compile.invalid"),L2=Symbol.for("zod.compile.fallback"),D2=((e,t,a)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==z2)return!0;if(r.definite===!0&&a===void 0)return!1}return F2(e,t,a)});function F2(e,t,a){const r=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;let i;if(o?(r[L2]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new zr;return i.issues.length===0}const q2=async(e,t,a)=>{const r=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},U2=e=>{const t=xd(e),a=(r,o,i,s)=>{const l=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,l,gl(a,s))};return a},j2=e=>{const t=xd(e),a=(r,o,i,s)=>t(r,o,i,gl(a,s));return a},$2=e=>{const t=Sd(e),a=async(r,o,i,s)=>{const l=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,l,gl(a,s))};return a},B2=e=>{const t=Sd(e),a=async(r,o,i,s)=>await t(r,o,i,gl(a,s));return a},H2=e=>(t,a,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Cd(e)(t,a,o)},V2=e=>(t,a,r)=>Cd(e)(t,a,r),W2=e=>async(t,a,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Nd(e)(t,a,o)},Z2=e=>async(t,a,r)=>Nd(e)(t,a,r),J2=/^[cC][0-9a-z]{6,}$/,K2=/^[0-9a-z]+$/,Y2=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,G2=/^[0-9a-vA-V]{20}$/,Q2=/^[A-Za-z0-9]{27}$/,X2=/^[a-zA-Z0-9_-]{21}$/;function eA(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const tA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nA=/^([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})$/,qh=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,aA=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rA="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function oA(){return new RegExp(rA,"u")}const iA=/^(?:(?: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])$/,sA=/^(([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}|:))$/,lA=/^((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])$/,cA=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dA=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,pA=/^https?$/,mA=/^\+[1-9]\d{6,14}$/,sb="(?:(?:\\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])))";function hA(e){return new RegExp(`^${e}$`)}const fA=hA(sb);function du(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gA(e){return new RegExp(`^${du(e)}$`)}function vA(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${du({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${a}|${du({precision:e.precision})}`:a;return new RegExp(`^${sb}T(?:${r})$`)}const bA=/^[\s\S]{0,}$/,yA=/^-?\d+$/,Rd=/^-?\d+(?:\.\d+)?$/,EA=/^(?:true|false)$/i,wA=/^null$/i,kA=/^undefined$/i,xA=/^[^A-Z]*$/,SA=/^[^a-z]*$/,ca=ce("$ZodCheck",(e,t)=>{var a;e._zod??(e._zod={}),e._zod.def=t,(a=e._zod).onattach??(a.onattach=[])}),Td=e=>{const t=e.value;return!e2(t)&&t.length!==void 0},Bs={number:"number",bigint:"bigint",object:"date"},lb=ce("$ZodCheckLessThan",(e,t)=>{ca.init(e,t);const a=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{ca.init(e,t);const a=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Bs[typeof r.value]??a,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),CA=ce("$ZodCheckMultipleOf",(e,t)=>{ca.init(e,t),e._zod.check=a=>{if(typeof a.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?t.value!==BigInt(0)&&a.value%t.value===BigInt(0):t2(a.value,t.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:t.value,input:a.value,inst:e,continue:!t.abort})}}),NA=ce("$ZodCheckNumberFormat",(e,t)=>{var s;ca.init(e,t),t.format=t.format||"float64";const a=(s=t.format)==null?void 0:s.includes("int"),r=a?"int":"number",[o,i]=tb[t.format];e._zod.check=l=>{const c=l.value;if(a){if(!Number.isInteger(c)){l.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?l.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):l.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}ci&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),RA=ce("$ZodCheckMaxLength",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?wd(o):i)<=t.maximum)return;const l=kd(o);r.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),TA=ce("$ZodCheckMinLength",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i=t.minimum)return;const l=kd(o);r.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),IA=ce("$ZodCheckLengthEquals",(e,t)=>{var a;ca.init(e,t),(a=e._zod.def).when??(a.when=Td),e._zod.check=r=>{const o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?wd(o):i;if(s===t.length)return;const l=kd(o),c=s>t.length;r.issues.push({origin:l,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),vl=ce("$ZodCheckStringFormat",(e,t)=>{var a,r;ca.init(e,t),t.pattern?(a=e._zod).check??(a.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),AA=ce("$ZodCheckRegex",(e,t)=>{vl.init(e,t),e._zod.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_A=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xA),vl.init(e,t)}),PA=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=SA),vl.init(e,t)}),OA=ce("$ZodCheckIncludes",(e,t)=>{ca.init(e,t);const a=Eo(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${a}`:a);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),MA=ce("$ZodCheckStartsWith",(e,t)=>{ca.init(e,t);const a=new RegExp(`^${Eo(t.prefix)}.*`);t.pattern??(t.pattern=a),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),zA=ce("$ZodCheckEndsWith",(e,t)=>{ca.init(e,t);const a=new RegExp(`.*${Eo(t.suffix)}$`);t.pattern??(t.pattern=a),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),LA=ce("$ZodCheckOverwrite",(e,t)=>{ca.init(e,t),e._zod.check=a=>{a.value=t.tx(a.value)}});class DA{constructor(t=[],a={}){this.content=[],this.indent=0,this.args=t,this.closed=a}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(` `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,a=(this==null?void 0:this.content)??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) { ${a.join(` @@ -836,7 +836,7 @@ container holding the app. Specify either width or maxWidth, and either height o #amp-one .a-canvas-controls[hidden]{display:none!important} #amp-one .a-canvas-version-shortcut{white-space:nowrap;flex:0 0 auto;font-size:12px} #amp-one .a-canvas-unsaved{margin:0;padding:6px 14px;color:var(--a-muted);font-size:12px} -`;var Pf={version:"0.20.45",id:"b48fe668835544e3"};const Ru=typeof Pf>"u"?{version:"dev",id:"dev"}:Pf,Ei=new Map;let jw="unknown";function ti(e){jw=["connecting","open","reconnecting","closed"].includes(e)?e:"unknown"}function VL(){const e=Symbol();return Ei.set(e,Date.now()),()=>Ei.delete(e)}function $w(e,t=globalThis){var l,c,u,d,p,m,h;const a=t.navigator||{},r=a.userAgent||"",o=r.match(/(Edg)\/([0-9.]+)/)||r.match(/(Firefox)\/([0-9.]+)/)||r.match(/(Chrome)\/([0-9.]+)/)||r.match(/(Version)\/([0-9.]+)/),i=!!((l=t.matchMedia)!=null&&l.call(t,"(prefers-color-scheme: dark)").matches),s=["light","dark","system"].includes((c=e==null?void 0:e.view)==null?void 0:c.scheme)?e.view.scheme:"system";return{frontendVersion:Ru.version,frontendBuild:Ru.id,browser:o?{Edg:"Edge",Firefox:"Firefox",Chrome:"Chrome",Version:"Safari"}[o[1]]:"Other",browserVersion:(o==null?void 0:o[2])||"",deviceOS:/Android/.test(r)?"Android":/iPhone|iPad|iPod/.test(r)?"iOS":/Windows/.test(r)?"Windows":/Macintosh/.test(r)?"macOS":/Linux/.test(r)?"Linux":"Other",width:Math.min(32768,t.innerWidth||0),height:Math.min(32768,t.innerHeight||0),pixelRatio:Math.min(16,t.devicePixelRatio||1),colorPreference:i?"dark":"light",appearance:s,resolvedAppearance:s==="system"?i?"dark":"light":s,standalone:!!((u=t.matchMedia)!=null&&u.call(t,"(display-mode: standalone)").matches||a.standalone),secureContext:!!t.isSecureContext,online:a.onLine!==!1,eventStream:jw,serviceWorkerControlled:!!((d=a.serviceWorker)!=null&&d.controller),reducedMotion:!!((p=t.matchMedia)!=null&&p.call(t,"(prefers-reduced-motion: reduce)").matches),visible:((m=t.document)==null?void 0:m.visibilityState)!=="hidden",pageAgeSeconds:Math.min(31536e3,Math.floor((((h=t.performance)==null?void 0:h.now())||0)/1e3)),pendingActions:Ei.size,oldestPendingMs:Ei.size?Date.now()-Math.min(...Ei.values()):0}}function WL(e,t){const a=r=>typeof r=="string"&&/^[a-f0-9]{12,64}$/.test(r);return a(e==null?void 0:e.id)&&a(t==null?void 0:t.id)&&(e.id!==t.id||e.version!==t.version)}async function ZL({prepare:e,reload:t}){await e(),t()}const Bw=v.createContext(null);function JL({enabled:e,blocked:t,prepare:a}){const[r,o]=v.useState(null),[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(a);d.current=a,v.useEffect(()=>{if(!e)return;let m=!0,h=!1;const f=new AbortController,g=async()=>{if(!(h||document.hidden)){h=!0;try{const y=await fetch("/build.json",{cache:"no-store",credentials:"same-origin",signal:f.signal});if(y.ok){const b=await y.json();m&&o(WL(Ru,b)?b:null)}}catch{}finally{h=!1}}};g();const E=setInterval(g,6e4);return window.addEventListener("focus",g),window.addEventListener("amplifier-reconnected",g),document.addEventListener("visibilitychange",g),()=>{m=!1,f.abort(),clearInterval(E),window.removeEventListener("focus",g),window.removeEventListener("amplifier-reconnected",g),document.removeEventListener("visibilitychange",g)}},[e]);const p=async()=>{if(!(!r||t||u.current)){u.current=!0,s(!0),c("");try{await ZL({prepare:()=>d.current(),reload:()=>window.location.reload()})}catch(m){c(m.message||"Your changes could not be saved. Try again when connected."),u.current=!1,s(!1)}}};return{available:!!r,version:r==null?void 0:r.version,busy:i,blocked:t,error:l,reload:p}}function Hw(){const e=v.useContext(Bw);return e!=null&&e.available?n.createElement("aside",{className:"a-reload-notice","data-part":"app-reload","aria-label":"App update ready"},n.createElement(Mt,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,"Update ready—reload to finish"),n.createElement("p",null,e.blocked||"Load the updated app in this tab. Your chats and saved settings stay in place."),e.error&&n.createElement("p",{role:"alert"},e.error)),n.createElement("button",{type:"button",className:"a-primary",disabled:e.busy||!!e.blocked,onClick:e.reload},e.busy?"Saving before reload…":"Reload now")):null}const Kr=v.createContext({compact:!1,active:!0,footer:null});function Rn({children:e,active:t=!0,className:a=""}){const r=v.useContext(Kr);if(r.compact&&!t)return null;const o=n.createElement("div",{className:"a-dialog-actions "+a},e);return r.compact&&r.active&&r.footer&&t?Mi.createPortal(o,r.footer):o}function KL(e){const[t,a]=v.useState(()=>typeof window<"u"&&window.matchMedia("(max-width:959px)").matches);return v.useLayoutEffect(()=>{var s;const r=((s=e.current)==null?void 0:s.closest(".a-overlay"))||e.current;if(!r)return;const o=()=>a(r.clientWidth<960);o();const i=new ResizeObserver(o);return i.observe(r),()=>i.disconnect()},[]),t}function YL(e,t){v.useEffect(()=>{var l;const a=(l=e.current)==null?void 0:l.closest(".a-overlay"),r=window.visualViewport;if(!t||!a||!r)return;let o;const i=()=>{r.scale===1&&(a.style.setProperty("--a-settings-viewport-top",r.offsetTop+"px"),a.style.setProperty("--a-settings-viewport-height",r.height+"px"),cancelAnimationFrame(o),o=requestAnimationFrame(()=>{var m;const c=document.activeElement;if(!((m=e.current)!=null&&m.contains(c))||!c.matches("input,textarea,select"))return;const u=c.closest(".a-settings-content");if(!u)return;const d=c.getBoundingClientRect(),p=u.getBoundingClientRect();d.bottom>p.bottom-16?u.scrollTop+=d.bottom-p.bottom+16:d.top{cancelAnimationFrame(o),r.removeEventListener("resize",i),r.removeEventListener("scroll",i),s.removeEventListener("focusin",i),a.style.removeProperty("--a-settings-viewport-top"),a.style.removeProperty("--a-settings-viewport-height")}},[t])}function GL({compact:e,trail:t,view:a,act:r,close:o,body:i,navigationRef:s,confirmClose:l=()=>Promise.resolve(!0),hasUnsaved:c=()=>!1}){const u=v.useRef(null),d=v.useRef(null),p=v.useRef(new Map),m=v.useRef(null),h=v.useRef(!1),[f,g]=v.useState(!1),E=v.useRef(!1);u.current={trail:t,view:a,act:r,close:o,confirmClose:l};const y=t.at(-1),b=y.key,S=v.useRef(a.settingsRootVisit);v.useEffect(()=>{const A=S.current!==a.settingsRootVisit;S.current=a.settingsRootVisit,m.current=b,h.current=!0;const C=requestAnimationFrame(()=>{i.current&&(i.current.scrollTop=A?0:p.current.get(b)||0),h.current=!1});return()=>cancelAnimationFrame(C)},[b,a.settingsRootVisit]);const w=()=>{i.current&&!h.current&&p.current.set(m.current,i.current.scrollTop)};v.useLayoutEffect(()=>{var z;if(!e||typeof window>"u")return;const A=(z=history.state)==null?void 0:z.amplifierSettings,C=typeof(A==null?void 0:A.token)=="string"&&A.token.startsWith("settings-")&&Number.isInteger(A.index)&&A.index>0&&A.index<10?A:null,O=(C==null?void 0:C.token)||"settings-"+crypto.randomUUID(),k={...history.state};delete k.amplifierSettings;const T={token:O,entries:C?[...u.current.trail]:[],index:(C==null?void 0:C.index)||0,closing:!1};d.current=T;const I=q=>{T.entries.splice(T.index),T.entries.push(q),T.index=T.entries.length,history.pushState({...k,amplifierSettings:{token:O,index:T.index}},"")};C||u.current.trail.forEach(I);const F=async q=>{var P,G;const W=(P=q.state)==null?void 0:P.amplifierSettings;if((W==null?void 0:W.token)!==O){if(T.confirming)return;if(T.closing){u.current.close();return}T.confirming=!0,g(!0);const Z=await u.current.confirmClose();if(T.confirming=!1,Z)T.closing=!0,u.current.close();else for(let D=1;D<=T.index;D++)history.pushState({...k,amplifierSettings:{token:O,index:D}},"");g(!1);return}T.index=W.index;const X=T.entries[T.index-1];if(!X)return;const U=Object.keys(X.navigation).find(Z=>{var D;return((D=X.navigation[Z])==null?void 0:D.orderOpen)===!0});if(U&&!((G=u.current.view[U])!=null&&G.order)){history.back();return}const _={...X.navigation};for(const Z of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])_[Z]&&(_[Z]={...u.current.view[Z],..._[Z]});u.current.act("view.update",{patch:_})};return window.addEventListener("popstate",F),()=>{var q,W;window.removeEventListener("popstate",F),d.current=null,((W=(q=history.state)==null?void 0:q.amplifierSettings)==null?void 0:W.token)===O&&!T.closing&&history.go(-T.index)}},[e]),v.useLayoutEffect(()=>{const A=d.current;if(!e||!A||A.closing||A.confirming)return;const C=A.entries[A.index-1];if(t.forEach((O,k)=>{A.entries[k]=O}),A.index>t.length){history.go(t.length-A.index);return}if(A.index===t.length){(C==null?void 0:C.key)!==b&&history.replaceState({...history.state,amplifierSettings:{token:A.token,index:A.index}},"");return}for(;A.index{const A=d.current;if(A&&A.index>1)w(),history.back();else if(t.length>1){const C=t.at(-2),O={...C.navigation};for(const k of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])O[k]&&(O[k]={...a[k],...O[k]});r("view.update",{patch:O})}else x()},x=async()=>{if(E.current)return;E.current=!0;const A=d.current;A&&(A.confirming=!0),g(!0);const C=await u.current.confirmClose();A&&(A.confirming=!1),C&&(A&&!A.closing?(A.closing=!0,history.go(-A.index)):o()),E.current=!1,g(!1)};return v.useEffect(()=>(s&&(s.current={close:x,confirmClose:l,hasUnsaved:c}),()=>{s&&(s.current=null)})),{back:N,dismiss:x,rememberScroll:w}}function QL(e){const[t,a]=v.useState(()=>typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches);return v.useEffect(()=>{const r=matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e==="dark"||e==="system"&&t?"dark":"light"}function XL({root:e,state:t,shell:a,scheme:r,mode:o,preview:i,css:s}){var l,c;v.useLayoutEffect(()=>{var h,f,g,E,y;if(!e.current||!a.ready||i||(h=t==null?void 0:t.view)!=null&&h.themePreview||(f=a.data)!=null&&f.preview)return;const u=getComputedStyle(e.current),d={};try{Object.assign(d,(g=JSON.parse(sessionStorage.getItem("amplifier.appearance")||"null"))==null?void 0:g.colors)}catch{}d[o]={background:u.backgroundColor,foreground:u.color};const p=(y=(E=t==null?void 0:t.theme)==null?void 0:E.definition)==null?void 0:y.palette;if(p)for(const b of["light","dark"])d[b]={background:p[b].bg,foreground:p[b].ink};const m={version:1,scheme:["light","dark","system"].includes(r)?r:"light",colors:d};try{sessionStorage.setItem("amplifier.appearance",JSON.stringify(m))}catch{}document.documentElement.style.colorScheme=o,document.documentElement.style.setProperty("--boot-bg",d[o].background),document.documentElement.style.setProperty("--boot-ink",d[o].foreground)},[e,a.ready,(l=a.data)==null?void 0:l.preview,(c=t==null?void 0:t.view)==null?void 0:c.themePreview,t==null?void 0:t.theme,r,o,i,s])}function eD({shell:e,onError:t}){const a=e.composition.presentation.decorations!==!1,[r,o]=v.useState(!1),[i,s]=v.useState(a);v.useEffect(()=>{r||s(a)},[a,r]);async function l(c){const u=c.target.checked;s(u),o(!0);try{await e.setPresentation({decorations:u})}catch(d){s(a),t(d.message)}finally{o(!1)}}return n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:i,disabled:r,"data-action":"shell.changes.apply",onChange:l}),"Show decorative theme background")}const tD={bg:"#e9ecf5",surface:"#ffffff",ink:"#23304d",accent:"#6353c7",line:"#d7ddec"};function nD({item:e}){const t={...tD,...e.palette};return n.createElement("div",{className:"a-appearance-swatch","aria-hidden":"true",style:{"--sw-bg":t.bg,"--sw-surface":t.surface,"--sw-ink":t.ink,"--sw-accent":t.accent,"--sw-line":t.line,"--sw-radius":e.radius||"12px",backgroundImage:e.background||"none",fontFamily:e.heading||"inherit",backgroundSize:e.id==="builtin:graphite"?"16px 16px":"cover"}},n.createElement("div",{className:"a-swatch-header"},n.createElement("span",null,"◉ Amplifier"),n.createElement("span",null,"•••")),n.createElement("div",{className:"a-swatch-body"},n.createElement("div",{className:"a-swatch-nav"},n.createElement("i",null),n.createElement("i",null),n.createElement("i",null)),n.createElement("div",{className:"a-swatch-chat"},n.createElement("strong",null,"Room for ideas."),n.createElement("span",{className:"a-swatch-line"}),n.createElement("span",{className:"a-swatch-line short"}),n.createElement("div",{className:"a-swatch-prompt"},n.createElement("span",null,"Ask anything…"),n.createElement("b",null,"↑")))))}function aD({state:e,shell:t,act:a,name:r,css:o,preview:i,setName:s,setCss:l,setPreview:c,defaultSkin:u,simple:d=!1,advancedOnly:p=!1,onAdvanced:m}){var Ee,me,_e,Je,De;const{active:h}=v.useContext(Kr),[f,g]=v.useState(""),[E,y]=v.useState({items:[],errors:[],directory:""}),[b,S]=v.useState(null),[w,N]=v.useState(!1),[x,A]=v.useState(""),[C,O]=v.useState(""),[k,T]=v.useState(!1),I=v.useRef(a),F=v.useRef(!0),z=v.useRef(0),q=v.useRef(i);I.current=a,q.current=i;const W=t.composition.presentation,X=W.scheme||((Ee=e.view)==null?void 0:Ee.scheme)||"system";async function U(){var ye;const ue=await I.current("theme.list",{});if(!Array.isArray((ye=ue.result)==null?void 0:ye.items))throw Error("The appearance library is unavailable. Try reopening Settings.");F.current&&(y(ue.result),g(""))}v.useEffect(()=>{if(!h)return;F.current=!0,U().catch(ye=>g(ye.message));const ue=setInterval(()=>U().catch(()=>{}),5e3);return()=>{F.current=!1,z.current++,clearInterval(ue),q.current&&(c(!1),I.current("view.update",{patch:{themePreview:!1}}).catch(()=>{}))}},[h]);async function _(ue){N(!0),A(""),O("");try{await ue()}catch(ye){F.current&&A(ye.message)}finally{F.current&&N(!1)}}async function P(ue){const ye=++z.current;await _(async()=>{const{result:M}=await I.current("theme.read",{id:ue.id});if(!F.current||ye!==z.current)return;S(ue.id),s(M.name),l(M.css);const Y=await I.current(d?"theme.apply":"theme.preview",{name:M.name,css:M.css});if((Y==null?void 0:Y.accepted)===!1)throw Error(Y.error||"Could not save appearance.");c(!d),d&&O(M.name+" saved.")})}async function G(){await _(async()=>{await I.current("theme.apply",{name:r,css:o}),c(!1),O(r+" applied.")})}async function Z(){await _(async()=>{var ue,ye;i&&await I.current("theme.revert",{}),c(!1),s(((ue=e.theme)==null?void 0:ue.name)||"Amplifier Unified"),l(((ye=e.theme)==null?void 0:ye.css)||u),S(null)})}async function D(ue){"name"in ue&&s(ue.name),"css"in ue&&l(ue.css),S(null),c(!1),await I.current("view.update",{patch:{themeDraft:ue.css??o,themeDraftName:ue.name??r,themePreview:!1}})}async function ne(){await _(async()=>{const{result:ue}=await I.current("theme.save",{name:r,css:o});S(ue.id),await U(),O("Saved to your appearance library.")})}async function H(ue){if(!ue)return;if(ue.size>99e4)throw Error("Choose a CSS appearance smaller than 1 MB.");const ye=await ue.text(),M=ue.name.replace(/\.amplifier\.css$|\.css$/i,"").slice(0,100),{result:Y}=await I.current("theme.save",{name:M,css:ye});return await U(),O(M+" added to your library. Select it to preview."),Y}const j=b||(((me=e.theme)==null?void 0:me.name)==="Amplifier Unified"?"builtin:default":(_e=E.items.find(ue=>{var ye;return ue.name===((ye=e.theme)==null?void 0:ye.name)}))==null?void 0:_e.id),ie=ue=>_(()=>t.setPresentation(ue));return n.createElement("div",{className:"a-appearance-settings","data-appearance-simple":d,"data-appearance-advanced":p},n.createElement("div",{className:"a-appearance-intro"},n.createElement("div",null,d?n.createElement("p",null,"Choose a look. Your choice is saved automatically."):n.createElement(n.Fragment,null,n.createElement("p",null,"Make this space yours."),n.createElement("small",null,"Choose an appearance to try it. Apply when it feels right."))),!d&&n.createElement("span",{className:"a-appearance-current"},n.createElement(Bc,{size:14}),i?"Previewing "+r:((Je=e.theme)==null?void 0:Je.name)||"Amplifier")),d&&n.createElement("h4",{className:"a-appearance-label"},"Look & feel"),n.createElement("div",{className:"a-appearance-gallery","aria-label":"Appearance library"},E.items.map(ue=>n.createElement("button",{type:"button",key:ue.id,className:"a-appearance-card","aria-label":(d?"Use ":"Preview ")+ue.name,"aria-pressed":j===ue.id,disabled:w,"data-action":d?"theme.apply":"theme.preview",onClick:()=>P(ue)},n.createElement(nD,{item:ue}),n.createElement("div",{className:"a-appearance-card-caption"},n.createElement("div",null,n.createElement("strong",null,ue.name),!d&&n.createElement("small",null,ue.tag)),j===ue.id?n.createElement(Pt,null):n.createElement(Bc,null)),!d&&n.createElement("p",null,ue.description))),!E.items.length&&!f&&n.createElement("p",{role:"status"},"Loading appearances…")),i&&n.createElement("div",{className:"a-appearance-preview",role:"status"},n.createElement("span",null,i?"Previewing "+r:"Current appearance"),n.createElement("div",null,i&&n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:Z},"Cancel preview"),n.createElement("button",{type:"button",className:"a-primary",disabled:w||!i,"data-action":"theme.apply",onClick:G},n.createElement(Pt,null),d?"Apply appearance":"Use "+r))),(x||f)&&n.createElement("p",{role:"alert",className:"a-danger"},x||f),C&&n.createElement("p",{role:"status",className:"a-appearance-notice"},n.createElement(Pt,{size:15}),C),n.createElement("section",{className:"a-appearance-options"},d?n.createElement("div",{className:"a-appearance-color"},n.createElement("label",{htmlFor:"appearance-color-mode"},"Color mode"),n.createElement("select",{id:"appearance-color-mode",value:X,disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({scheme:ue.target.value})},n.createElement("option",{value:"system"},"Device"),n.createElement("option",{value:"light"},"Light"),n.createElement("option",{value:"dark"},"Dark"))):n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Color mode"),n.createElement("p",null,"Keep a favorite look throughout the day.")),n.createElement("div",{className:"a-appearance-modes",role:"group","aria-label":"Color mode"},[["light","Light",gx],["dark","Dark",nx],["system","Device",Lu]].map(([ue,ye,M])=>n.createElement("button",{type:"button",key:ue,disabled:w,"aria-pressed":X===ue,"data-action":"shell.changes.apply",onClick:()=>ie({scheme:ue})},n.createElement(M,null),ye)))),n.createElement("fieldset",{className:"a-detail-level"},n.createElement("legend",null,"How much would you like to see?"),n.createElement("p",null,"Choose a calmer workspace or keep more information at hand. You can always open details."),n.createElement("div",{className:"a-detail-choices"},[["minimal","Focused","Quiet lists and simple work summaries. Extra information stays in details."],["standard","Balanced","Useful context and work totals, with deeper details one click away."],["detailed","Everything","Work activity opens automatically. Counts and list actions stay visible."]].map(([ue,ye,M])=>n.createElement("label",{key:ue,"data-selected":(W.interfaceDetail||W.executionDetail||"standard")===ue},n.createElement("input",{type:"radio",name:"interface-detail",value:ue,checked:(W.interfaceDetail||W.executionDetail||"standard")===ue,disabled:w,"data-action":"shell.changes.apply",onChange:()=>ie({interfaceDetail:ue,executionDetail:ue})}),n.createElement("span",null,n.createElement("strong",null,ye),n.createElement("small",null,M)))))),n.createElement("details",{className:"a-everyday-disclosure",open:!d||void 0},n.createElement("summary",null,"Layout & background"),n.createElement("div",null,n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Background"),n.createElement("p",null,"Decorative artwork stays behind your content.")),n.createElement(eD,{shell:t,onError:A})),n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("label",{htmlFor:"layout"},"Layout"),n.createElement("p",null,"Choose where the conversation and Canvas sit.")),n.createElement("select",{id:"layout",value:W.layout||((De=e.view)==null?void 0:De.layout)||"balanced",disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({layout:ue.target.value})},n.createElement("option",{value:"balanced"},"Canvas on the right"),n.createElement("option",{value:"conversation"},"More room for conversation"),n.createElement("option",{value:"work"},"Canvas on the left")))))),!d&&n.createElement("section",{className:"a-appearance-import"},n.createElement("div",null,n.createElement("h3",null,n.createElement(mg,null),"Your appearance library"),n.createElement("p",null,"Upload a CSS appearance once. It will stay here across restarts and be available to every connected device.")),n.createElement(Cg,{id:"theme-import",accept:".css,text/css",action:"theme.save",label:"Upload appearance",hint:"Drop a CSS file here · up to 1 MB",onFile:H}),E.errors.map(ue=>n.createElement("p",{className:"a-danger",key:ue.name},ue.name,": ",ue.message)),n.createElement("details",{className:"a-appearance-folder"},n.createElement("summary",null,n.createElement(nr,null),"Theme folder"),n.createElement("p",null,"CSS files placed here appear in the library automatically."),n.createElement("code",null,E.directory))),!d&&n.createElement("details",{className:"a-appearance-advanced",open:k,onToggle:ue=>T(ue.currentTarget.open)},n.createElement("summary",null,"Advanced customization"),n.createElement("p",null,"Edit or export a complete, portable CSS appearance. Embedded images and fonts travel with it."),n.createElement("label",{htmlFor:"theme-name"},"Appearance name"),n.createElement("input",{id:"theme-name",value:r,"data-action":"view.update",onChange:ue=>D({name:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("label",{htmlFor:"theme-css"},"CSS"),n.createElement("textarea",{id:"theme-css",spellCheck:!1,className:"a-css-editor",value:o,"data-action":"view.update",onChange:ue=>D({css:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"theme.save",onClick:ne},"Save to library"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.preview",onClick:()=>_(async()=>{await I.current("theme.preview",{name:r,css:o}),c(!0)})},"Preview"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.apply",onClick:G},"Apply skin"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:Z},"Revert edits"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.export",onClick:()=>_(()=>I.current("theme.export",{}))},n.createElement(wa,null),"Export current appearance"))),d&&n.createElement("div",{className:"a-everyday-footer"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:m},"Custom themes & CSS")),!d&&n.createElement("button",{type:"button",className:"a-link a-appearance-reset",disabled:w,"data-action":"theme.reset",onClick:()=>_(async()=>{await I.current("theme.reset",{}),c(!1),S(null)})},n.createElement(Mt,null),"Restore original appearance"))}const Zi=[{id:"ai",title:"AI connections",scope:"Across workspaces on this Amplifier host",pages:[["ai-connections","AI connections"],["overview","AI connections"]]},{id:"smart-tools",title:"Smart Tools",scope:"This Amplifier host",pages:[["smart-tools","Smart Tools"]]},{id:"appearance",title:"Appearance",scope:"This interface",pages:[["appearance","Appearance"]]},{id:"voice",title:"Voice",scope:"Future voice connections",pages:[["voice","Voice"]]},{id:"notifications",title:"Notifications",scope:"This app",pages:[["notifications","Notifications"]]},{id:"privacy",title:"Privacy & files",scope:"Your work and access choices",pages:[["privacy","Privacy & files"],["workspaces","Files & folders"],["recall","Memory & past work"],["permissions","File access"],["desktop","Screen & computer access"],["diagnostics","App diagnostic capture"],["history","Saved work"]]},{id:"updates",title:"Updates",scope:"This Amplifier host",pages:[["updates","Updates"]]},{id:"advanced",title:"Advanced",scope:"Full configuration",pages:[["advanced","Advanced"],["providers","Provider configuration"],["routing","Model rules"],["app-bundles","Configured bundles"],["add-bundles","Discover bundles"],["defaults","Conversation defaults"],["loaded-modules","Conversation modules"],["share-bundle","Save & share a bundle"],["registries","Module & source registries"],["tool-connections","Tool connections"],["custom-appearance","Custom appearance"],["conversation","Current conversation"],["outputs","Outputs & review"],["publishing","Publishing"],["repair","Backup & repair"],["reset","Advanced recovery"],["ready-conversations","Ready conversations"],["automation","Terminal & automation"],["install-app","Install app"],["runtime","Session controls"]]}],Of={setup:["overview","ai-connections","advanced","appearance","voice","providers","routing","defaults","conversation","install-app","runtime","custom-appearance"],capabilities:["smart-tools","tool-connections","app-bundles","add-bundles","loaded-modules","registries","share-bundle"],maintenance:["privacy","ready-conversations","updates","diagnostics","history","recall","outputs","publishing","permissions","notifications","automation","repair","reset"]};function Vw(e={},t=Zi){var o,i;const a=new Set(t.flatMap(s=>s.pages.map(([l])=>l))),r=e.panel==="appearance"?"appearance":((i=(o=e.settingsExpanded)==null?void 0:o.find)==null?void 0:i.call(o,s=>a.has(s)))||{capabilities:"app-bundles",maintenance:"updates"}[e.settingsSection]||"ai-connections";return{page:r,section:t.find(s=>s.pages.some(([l])=>l===r))}}function Ww(e,t=Zi){if(!t.some(a=>a.pages.some(([r])=>r===e)))throw new Error("Unknown settings page");return{panel:"settings",settingsSection:Object.keys(Of).find(a=>Of[a].includes(e))||"setup",settingsExpanded:[e]}}function rD(e,t){return t.pages.reduce((a,[r])=>{var o,i;return a+(((i=(o=e.attention)==null?void 0:o.pages)==null?void 0:i[r])||0)},0)}function bp(e,t=Zi){var a;return((a=t.flatMap(r=>r.pages).find(([r])=>r===e))==null?void 0:a[1])||"Settings"}function Is(e,t=Zi){const a=t.find(r=>r.pages.some(([o])=>o===e));return["privacy","advanced"].includes(a==null?void 0:a.id)&&e!==a.id?a.id:null}function Zw({state:e,id:t,sessionId:a,act:r,disabled:o=!1}){var E,y,b,S,w,N,x,A;const[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(null),p=(y=(E=e.setup)==null?void 0:E.operations)==null?void 0:y["providers.testMessage:"+t],m=(S=(b=e.setup)==null?void 0:b.messageTests)==null?void 0:S[t],h=(N=(w=e.setup)==null?void 0:w.providers)==null?void 0:N.find(C=>C.id===t),f=(h==null?void 0:h.module)==="provider-openai-chatgpt"&&(((x=h.account)==null?void 0:x.authMode)||((A=h.config)==null?void 0:A.auth_mode))==="chatgpt_plan";v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[p==null?void 0:p.commandId,p==null?void 0:p.phase]);async function g(){if(!(u.current||f)){u.current=!0,s(!0),c("");try{const C=await r("providers.testMessage",{id:t,...a?{sessionId:a}:{}});if(!(C!=null&&C.accepted)||!C.operationId)throw Error((C==null?void 0:C.error)||"The test could not be started.");d.current=C.operationId,s(C.operationId)}catch(C){u.current=!1,s(!1),c(C.message)}}}return v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[i]),n.createElement("div",{"data-part":"provider-message-test"},n.createElement("button",{type:"button",className:"a-soft","data-action":"providers.testMessage",disabled:!t||o||f||!!i,onClick:g},i?"Sending test message…":"Send test message"),n.createElement("p",{className:"a-caption"},f?"ChatGPT plan does not support this test's output limit. Use Test connection to check the model catalog; no test message is sent.":"Sends a small message using the saved model and credentials. Provider charges may apply. No chat is created."),l&&n.createElement("p",{role:"alert"},l),!i&&m&&n.createElement("div",{role:"status"},n.createElement("p",null,n.createElement("strong",null,m.supported===!1?"Test message unavailable":m.reachable?"Test message succeeded":"Test message failed")," · ",m.model," · ",(m.elapsedMs/1e3).toFixed(1)," s",m.statusCode?` · HTTP ${m.statusCode}`:""),n.createElement("p",null,m.reachable?m.response:m.error)))}function Tu({credential:e}){const t=e==null?void 0:e.preview;if(!t)return null;const a=t.source==="key-file"?"Private keys file (keys.env)":t.source==="environment"?"Service environment":t.source==="configuration"?"Provider configuration":"Provider managed";return n.createElement("div",{className:"a-provider-key-preview","data-part":"provider-key-preview"},n.createElement("p",null,"Service API key: ",n.createElement("strong",null,t.status==="available"?n.createElement("code",null,t.masked):t.status==="missing"?"Not available":"Preview unavailable")),n.createElement("p",{className:"a-caption"},a,t.envVar&&n.createElement(n.Fragment,null," · ",n.createElement("code",null,t.envVar))),n.createElement("p",{className:"a-caption"},"For new connections from this running service. Existing chats may still use an earlier key. A changed shell environment does not update a running service."))}function tr(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Provider configuration must be a JSON object.");function a(r){if(!(!r||typeof r!="object"))for(const[o,i]of Object.entries(r)){if(/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(o)&&typeof i=="string"&&!/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(i)&&!/^\[redacted\]$/i.test(i))throw new Error("Enter credentials in the private API key field, or use an environment reference in configuration.");a(i)}}return a(t),t}function zl(e){return(Array.isArray(e)?e:(e==null?void 0:e.models)||[]).map(a=>typeof a=="string"?{id:a,name:a}:{id:a.id||a.name||a.model,name:a.display_name||a.displayName||a.name||a.id||a.model}).filter(a=>a.id)}function Pr(e,t,a){var r;return{...e,roles:{...e==null?void 0:e.roles,[t]:{...(r=e==null?void 0:e.roles)==null?void 0:r[t],...a}}}}function oD(e,t,a,r){var i,s;const o=[...((s=(i=e==null?void 0:e.roles)==null?void 0:i[t])==null?void 0:s.candidates)||[]];return o[a]={...o[a],...r},Pr(e,t,{candidates:o})}function Mf(e="my-routing"){return{name:e,roles:{general:{description:"General conversation and work",candidates:[{provider:"",model:""}]},fast:{description:"Quick and lightweight work",candidates:[{provider:"",model:""}]}}}}function Jw(e){try{const t=new URL(e);if(t.protocol!=="https:"||t.username||t.password||t.hash)return null;for(const a of t.searchParams.keys())if(/^(id_token_hint|access_token|refresh_token|id_token|code|client_secret)$/i.test(a))return null;return t.href}catch{return null}}function yp(e,t={}){var r,o;return(((r=e==null?void 0:e.configSchema)==null?void 0:r.fields)||((o=e==null?void 0:e.info)==null?void 0:o.config_fields)||[]).filter(i=>i.id&&i.field_type!=="secret"&&!/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(i.id)&&!["model","default_model"].includes(i.id)).filter(i=>i.requires_model&&!t.default_model&&!t.model?!1:Object.entries(i.show_when||{}).every(([s,l])=>{const c=String(t[s]??"").toLowerCase(),u=String(l).toLowerCase();if(u.startsWith("matches:"))try{return new RegExp(String(l).slice(8),"i").test(c)}catch{return!1}for(const[d,p]of[["not_contains:",m=>!c.includes(m)],["contains:",m=>c.includes(m)],["not_startswith:",m=>!c.startsWith(m)],["startswith:",m=>c.startsWith(m)]])if(u.startsWith(d))return p(u.slice(d.length));return c===u}))}function Iu(e,t,a){return!!a&&a.role===t&&a.source===JSON.stringify(e)&&Array.isArray(a.ids)&&a.ids.length===e.length&&new Set(a.ids).size===e.length&&a.ids.every(r=>e.some((o,i)=>String(i)===r))}function Tc(e,t,a){return Iu(e,t,a)?a:{role:t,ids:e.map((r,o)=>String(o)),source:JSON.stringify(e),notice:(a==null?void 0:a.role)===t?"The choices changed. Review the current order before saving.":""}}const Or=e=>!e||e==="legacy_codex"?"chatgpt_codex":e,iD="https://chatgpt.com/settings/usage";function Ep({account:e}){return e?n.createElement("div",{className:"a-ai-hint"},n.createElement("p",null,e.authMode==="chatgpt_plan"?e.planEnabled?"Using ChatGPT plan":e.connected?"Signed in. Permission to use your ChatGPT plan is still needed.":"Sign in to use your ChatGPT plan.":"This connection uses ChatGPT Codex with device sign-in.",e.email&&n.createElement(n.Fragment,null," · ",e.email)),e.authMode==="chatgpt_plan"&&n.createElement("a",{className:"a-link",href:iD,target:"_blank",rel:"noopener noreferrer"},"Manage usage")):null}function Kw({mode:e,onChange:t,disabled:a=!1}){const r=v.useId();return n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:r},"ChatGPT connection"),n.createElement("select",{id:r,value:Or(e),disabled:a,onChange:o=>t(o.target.value)},n.createElement("option",{value:"chatgpt_codex"},"ChatGPT Codex · device sign-in"),n.createElement("option",{value:"chatgpt_plan"},"ChatGPT plan · browser sign-in")),e==="chatgpt_plan"?n.createElement(n.Fragment,null,n.createElement("p",null,"Continue with ChatGPT to authorize Amplifier Unified to use your plan. Use a browser on the computer running Amplifier."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Using a remote host, such as Spark?"),n.createElement("p",null,"Browser sign-in returns to the computer where the browser is open. For a remote host, sign in locally with the ChatGPT provider, transfer the credentials over SSH, and import them on the remote host. Keep its host identity separate; let the remote host own subsequent refreshes."),n.createElement("p",null,"ChatGPT Codex device sign-in is the default for Unified."),n.createElement("a",{href:"https://developers.openai.com/siwc/token-sharing-open-source/self-hosted-vms",target:"_blank",rel:"noopener noreferrer"},"Remote-host sign-in guide"),n.createElement("p",null,n.createElement("a",{href:"https://github.com/microsoft/amplifier-module-provider-openai-chatgpt/blob/main/docs/CHATGPT_PLAN_SIGN_IN.md#self-hosted-server",target:"_blank",rel:"noopener noreferrer"},"Amplifier setup commands")))):n.createElement("p",null,"Sign in with a one-time code. This is the default ChatGPT connection for Amplifier Unified."))}function Au({login:e,onCancel:t,onRetry:a,busy:r=!1,chooseModel:o=!1,onEnablePlan:i,onWelcomeDismiss:s,welcomeDismissed:l=!1}){var N,x,A;const{active:c}=v.useContext(Kr),u=v.useId(),d=v.useRef(null),p=v.useRef(""),[m,h]=v.useState(!1),[f,g]=v.useState(!1),E=e.authMode==="chatgpt_plan",y=e.deviceCode||"",b=Jw(e.url),S=["starting","waiting"].includes(e.status);async function w(){var C;try{if(!((C=navigator.clipboard)!=null&&C.writeText))throw Error();await navigator.clipboard.writeText(y),h(!0),g(!1)}catch{h(!1),g(!0)}}return v.useEffect(()=>{c&&y&&p.current!==y&&(p.current=y,w())},[y,c]),e.status==="completed"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-signin-success",role:"status"},n.createElement(Pt,null),E&&!((N=e.account)!=null&&N.planEnabled)?"Signed in. Plan access needs permission.":o?"Signed in. Choose your model below.":"Signed in successfully."),E&&n.createElement(Ep,{account:e.account})," ",E&&((x=e.account)==null?void 0:x.connected)&&!((A=e.account)!=null&&A.planEnabled)&&i&&n.createElement("button",{className:"a-primary",disabled:r,onClick:i},"Enable ChatGPT plan access"),e.showPlanWelcome&&!l&&n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"You’re using your ChatGPT plan"),n.createElement("p",null,"Usage from this connection counts toward your ChatGPT plan."),s&&n.createElement("button",{className:"a-soft",onClick:s},"Got it"))):n.createElement("div",{className:"a-device-signin"},S?n.createElement(n.Fragment,null,E?n.createElement(n.Fragment,null,n.createElement("p",{role:"status"},b?"Finish signing in on this host’s browser.":"Preparing secure sign-in…"),b&&n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Continue with ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption"},"Waiting for sign-in. This page will continue automatically.")):y?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:u},"1. Copy your sign-in code"),n.createElement("div",{className:"a-device-code"},n.createElement("input",{id:u,ref:d,readOnly:!0,value:y,spellCheck:!1,onFocus:C=>C.target.select(),onClick:C=>C.currentTarget.select()}),n.createElement("button",{className:"a-soft",type:"button","aria-label":"Copy sign-in code",onClick:w},m?n.createElement(Pt,null):n.createElement(rr,null),m?"Copied":"Copy")),n.createElement("p",{className:"a-caption",role:"status"},m?"Copied to your clipboard.":f?"Select the code to copy it, or use the Copy button.":"Keep this code ready for the next step.")):n.createElement("p",{role:"status"},"Getting your sign-in code…"),y&&b&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-device-step"},"2. Open ChatGPT and paste the code"),n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Open ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption",role:"status"},"Waiting for sign-in. This page will continue automatically.")),n.createElement("button",{className:"a-link",type:"button",disabled:r,"data-action":"providers.loginCancel",onClick:t},"Cancel sign-in")):n.createElement(n.Fragment,null,n.createElement("p",{role:e.error?"alert":"status"},e.error||"Sign-in was cancelled. You can try again."),n.createElement("button",{className:"a-primary",disabled:r,"data-action":"providers.login",onClick:a},"Try sign-in again")))}function gr({title:e,description:t,onClick:a,Icon:r=Dr,page:o,count:i,disabled:s=!1}){return n.createElement("button",{type:"button",className:"a-everyday-row",disabled:s,"data-action":"view.update","data-settings-destination":o,onClick:a},r!==Dr&&n.createElement(r,{"aria-hidden":"true"}),n.createElement("span",null,n.createElement("strong",null,e),t&&n.createElement("small",null,t)),n.createElement(Da,{count:i}),n.createElement(en,{"aria-hidden":"true"}))}function sD({navigate:e,state:t}){var r,o,i,s;const a=[["recall","Memory & past work","Choose what is saved and reused. Review and correct memories.",Lk],["workspaces","Files & folders","Choose where new workspaces are created.",nr],["permissions","File access","Review additional allowed and blocked folders.",px],["desktop","Screen & computer access","Check the host, browser, and permission status.",Lu],["history","Saved work","Import, export, and review cleanup.",wi],["diagnostics","App diagnostic capture","Review recorded data and forwarding destinations.",mo]];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Your saved work, memory, and access choices."),n.createElement("div",{className:"a-everyday-list"},a.filter(l=>l[0]!=="diagnostics").map(([l,c,u,d])=>{var p,m;return n.createElement(gr,{key:l,count:(m=(p=t.attention)==null?void 0:p.pages)==null?void 0:m[l],page:l,title:c,description:u,Icon:d,onClick:()=>e(l)})})),n.createElement("h4",null,"Diagnostics"),n.createElement("div",{className:"a-everyday-list"},n.createElement(gr,{page:"diagnostics",count:(o=(r=t.attention)==null?void 0:r.pages)==null?void 0:o.diagnostics,title:"App diagnostic capture",description:"Review collected records and forwarding.",Icon:mo,onClick:()=>e("diagnostics")})),n.createElement("div",{className:"a-everyday-footer"},n.createElement(gr,{page:"repair",count:(s=(i=t.attention)==null?void 0:i.pages)==null?void 0:s.repair,title:"Backups & recovery",description:"Create a private backup or troubleshoot this app.",onClick:()=>e("repair")})))}function lD({sections:e,navigate:t,state:a}){const r=e.flatMap(i=>i.pages).filter(([i])=>i.startsWith("shell:")),o=[{title:"Model rules",description:"Routing profiles, roles, and model preference.",page:"routing"},{title:"Provider configuration",description:"Instance names, credentials, and custom providers.",page:"providers"},{title:"Bundles & modules",description:"Composition, discovery, defaults, registries, and loaded modules.",pages:["app-bundles","add-bundles","defaults","loaded-modules","share-bundle","registries"]},{title:"Tool connections",description:"MCP connections, installation sources, and authentication.",page:"tool-connections"},{title:"Custom appearance",description:"Import, export, theme folders, and custom CSS.",page:"custom-appearance"},{title:"Conversation & work",description:"Current conversation, outputs, review, and publishing.",pages:["conversation","outputs","publishing"]},{title:"Performance & runtime",description:"Ready conversations, session controls, and terminal access.",pages:["ready-conversations","runtime","automation","install-app"]},{title:"Troubleshooting & recovery",description:"Diagnostics, backups, repair, and reset options.",pages:["diagnostics","repair","reset"]}];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"The full configuration, when you need it."),n.createElement("div",{className:"a-everyday-list"},o.map(i=>{var s,l;return i.page?n.createElement(gr,{key:i.title,title:i.title,description:i.description,page:i.page,count:(l=(s=a.attention)==null?void 0:s.pages)==null?void 0:l[i.page],onClick:()=>t(i.page)}):n.createElement("details",{className:"a-advanced-group",key:i.title},n.createElement("summary",null,n.createElement("span",null,n.createElement("strong",null,i.title),n.createElement("small",null,i.description)),n.createElement(Da,{count:i.pages.reduce((c,u)=>{var d,p;return c+(((p=(d=a.attention)==null?void 0:d.pages)==null?void 0:p[u])||0)},0)}),n.createElement(en,null)),n.createElement("div",null,i.pages.map(c=>{var u,d;return n.createElement(gr,{key:c,page:c,count:(d=(u=a.attention)==null?void 0:u.pages)==null?void 0:d[c],title:bp(c,e),onClick:()=>t(c)})})))})),r.length>0&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Extension settings"),n.createElement("div",{className:"a-everyday-list"},r.map(([i,s])=>{var l,c;return n.createElement(gr,{key:i,page:i,count:(c=(l=a.attention)==null?void 0:l.pages)==null?void 0:c[i],title:s,Icon:qr,onClick:()=>t(i)})}))))}const Yw=v.createContext(null);function Gw(e,t){const a=v.useContext(Yw);v.useEffect(()=>{a==null||a.register(e,t)}),v.useEffect(()=>()=>a==null?void 0:a.remove(e),[a,e])}function cD(){const e=v.useRef(new Map),t=v.useRef(null),[a,r]=v.useState(0),[o,i]=v.useState(null),s=v.useCallback(()=>r([...e.current.values()].filter(f=>f.dirty).length),[]),l=v.useCallback((f,g)=>{var y;const E=!!((y=e.current.get(f))!=null&&y.dirty)!=!!g.dirty;e.current.set(f,g),E&&s()},[s]),c=v.useCallback(f=>{e.current.delete(f)&&s()},[s]),u=v.useMemo(()=>({register:l,remove:c}),[l,c]),d=v.useCallback(()=>[...e.current.values()].some(f=>f.dirty),[]),p=v.useCallback(()=>{const f=[...e.current.values()].filter(y=>y.dirty);if(!f.length)return Promise.resolve(!0);if(t.current)return t.current.promise;let g;const E=new Promise(y=>{g=y});return t.current={promise:E,resolve:g},i(f),E},[]),m=f=>{const g=t.current;t.current=null,i(null),g==null||g.resolve(f)};v.useEffect(()=>{if(!a)return;const f=g=>{g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[a]),v.useEffect(()=>()=>{var f;(f=t.current)==null||f.resolve(!1)},[]);const h=o&&n.createElement("div",{className:"a-settings-draft-overlay"},n.createElement("div",{className:"a-settings-draft-confirm",role:"alertdialog","aria-modal":"true","aria-labelledby":"settings-unsaved-title",onKeyDown:f=>{var g;if(f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),m(!1)),f.key==="Tab"){const E=[...f.currentTarget.querySelectorAll("button")],y=E.indexOf(document.activeElement);f.preventDefault(),(g=E[(y+(f.shiftKey?-1:1)+E.length)%E.length])==null||g.focus()}}},n.createElement("h3",{id:"settings-unsaved-title"},"Unsaved connection changes"),n.createElement("p",null,"Your changes have not been saved. Review them before closing Settings, or discard them."),n.createElement("ul",null,o.map(f=>n.createElement("li",{key:f.label},f.label))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",autoFocus:!0,onClick:()=>{o[0].review(),m(!1)}},"Review and save"),n.createElement("button",{type:"button",className:"a-soft a-danger",onClick:()=>{o.forEach(f=>f.discard()),m(!0)}},"Discard changes"),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>m(!1)},"Keep settings open"))));return{context:u,confirmClose:p,hasUnsaved:d,count:a,dialog:h}}function uD({value:e,children:t}){return n.createElement(Yw.Provider,{value:e},t)}function dD(e,t,a){const[r,o]=v.useState(e),i=v.useRef(a);return i.current=a,v.useEffect(()=>{if(e===r)return;const s=u=>u==="settings"||u==="appearance",l=t.current;if(!s(r)||s(e)||!(l!=null&&l.hasUnsaved())){o(e);return}let c=!0;return l.confirmClose().then(u=>{c&&(u?o(e):i.current(r))}),()=>{c=!1}},[e,r,t]),r}function xa(e,t,a,r,o,i,{simple:s=!1}={}){var h,f;const l=((f=(h=e.view)==null?void 0:h.settingsFilters)==null?void 0:f[a])||"",[c,u]=v.useState(l);v.useEffect(()=>u(l),[l]);const d=nl(r,c,o),p=g=>{var E;u(g),t("view.update",{patch:{settingsFilters:{...(E=e.view)==null?void 0:E.settingsFilters,[a]:g}}})},m=n.createElement("div",{className:"a-list-filter"},n.createElement("label",{htmlFor:"filter-"+a},n.createElement(To,null),i),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"filter-"+a,type:"search",value:c,placeholder:s?i:"Search or pattern, e.g. *openai*","data-action":"view.update",onChange:g=>p(g.target.value)}),c&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Clear "+i.toLowerCase(),"data-action":"view.update",onClick:()=>p("")},n.createElement(nn,null))),n.createElement("small",{role:"status"},d.length," of ",r.length,c&&!d.length?" · No matches":"",!s&&n.createElement(n.Fragment,null," · Text search or wildcards: * ? [abc] [!abc]")));return[d,m,c]}function wp({id:e,label:t="Model",value:a="",onChange:r,onCommit:o,entry:i,models:s,state:l,act:c,disabled:u=!1,placeholder:d="Enter a model ID",catalogKey:p=e,editable:m=!1}){var S;const h=(i==null?void 0:i.phase)==="working"||(i==null?void 0:i.phase)==="queued",f=v.useRef(null),g=v.useRef(null);let E=zl((i==null?void 0:i.models)??s??[]);!m&&(h||(i==null?void 0:i.phase)==="error")&&!E.length&&((S=f.current)==null?void 0:S.key)===p&&(E=f.current.models),!h&&(i==null?void 0:i.phase)!=="error"&&(f.current={key:p,models:E}),Zu(g,h);const[y,b]=xa(l,c,"model-picker-"+e,E,w=>[w.id,w.name],"Filter "+t.toLowerCase());return m?n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},n.createElement("input",{list:E.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),E.length>0&&n.createElement(n.Fragment,null,n.createElement("datalist",{id:e+"-options"},E.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))),E.length>12&&b,n.createElement("select",{id:e+"-catalog","aria-label":"Choose "+t.toLowerCase()+" from catalog",value:E.some(w=>w.id===a)?a:"",disabled:u,"data-action":"view.update",onChange:w=>{w.target.value&&(r(w.target.value),o==null||o(w.target.value))}},n.createElement("option",{value:""},"Choose from ",E.length," cached models…"),y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),h&&n.createElement("small",{role:"status"},E.length?"Refreshing in the background. Saved models are available.":"Discovering models. You can enter a model ID now."),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.loadedAt)&&n.createElement("small",null,"Catalog checked ",new Date(i.loadedAt*1e3).toLocaleString()),(i==null?void 0:i.phase)==="ready"&&!E.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID.")):n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},E.length>12&&b,(i==null?void 0:i.phase)!=="error"&&(E.length||h)?n.createElement("select",{id:e,"aria-label":t,value:a,disabled:u||h&&!E.length,"data-action":"view.update",onChange:w=>{r(w.target.value),o==null||o(w.target.value)}},n.createElement("option",{value:""},h?"Loading provider models…":"Choose a model…"),a&&!y.some(w=>w.id===a)&&n.createElement("option",{value:a},a," (selected)"),y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))):n.createElement(n.Fragment,null,n.createElement("input",{list:E.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),E.length>0&&n.createElement("datalist",{id:e+"-options"},y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.phase)==="ready"&&!E.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID."))}function Qw(e){const t=r=>{var o;return((o=r.info)==null?void 0:o.id)||r.module||r.id},a=new Map;for(const r of e)a.set(t(r),(a.get(t(r))||0)+1);return e.map(r=>{var o;return{id:r.id,label:(((o=r.info)==null?void 0:o.display_name)||t(r))+(a.get(t(r))>1?` (${r.id})`:"")}}).sort((r,o)=>r.label.localeCompare(o.label,void 0,{sensitivity:"base"}))}const zf={"provider-anthropic":"git+https://github.com/microsoft/amplifier-module-provider-anthropic@main","provider-azure-openai":"git+https://github.com/microsoft/amplifier-module-provider-azure-openai@main","provider-chat-completions":"git+https://github.com/microsoft/amplifier-module-provider-chat-completions@main","provider-gemini":"git+https://github.com/microsoft/amplifier-module-provider-gemini@main","provider-github-copilot":"git+https://github.com/microsoft/amplifier-module-provider-github-copilot@main","provider-ollama":"git+https://github.com/microsoft/amplifier-module-provider-ollama@main","provider-openai":"git+https://github.com/microsoft/amplifier-module-provider-openai@main","provider-openai-chatgpt":"git+https://github.com/microsoft/amplifier-module-provider-openai-chatgpt@main","provider-vllm":"git+https://github.com/microsoft/amplifier-module-provider-vllm@main"},kp=[{module:"provider-github-copilot",name:"GitHub Copilot Subscription",description:"Use your GitHub Copilot subscription.",auth:"token"},{module:"provider-openai-chatgpt",name:"ChatGPT Subscription",description:"Sign in with your ChatGPT account.",auth:"signin"},{module:"provider-openai",name:"OpenAI API",description:"Use an API key. API billing is separate from ChatGPT.",auth:"key"},{module:"provider-anthropic",name:"Anthropic API",description:"Connect with your Anthropic API key.",auth:"key"},{module:"provider-gemini",name:"Google Gemini API",description:"Connect with your Gemini API key.",auth:"key"},{module:"provider-chat-completions",name:"OpenAI Compatible API",description:"Connect a local model or another compatible service.",auth:"optional-key"}],pD=[...kp,{module:"provider-azure-openai",name:"Azure OpenAI"},{module:"provider-ollama",name:"Ollama"},{module:"provider-vllm",name:"vLLM"}],Ic=Object.keys(zf).map(e=>({...pD.find(t=>t.module===e),module:e,source:zf[e]}));function Ac(e){return kp.find(t=>t.module===e)||{module:e,name:(e==null?void 0:e.replace(/^provider-/,""))||"AI service",auth:"key"}}function mD(e,t,a){var r,o;return(o=(r=e.setup)==null?void 0:r.operations)==null?void 0:o[t+":"+a]}function Lf(e){return["working","pending","queued"].includes(e==null?void 0:e.phase)}function hD(e,t){if(!t)return null;const a=mD(e,t.action,t.id);return(a==null?void 0:a.commandId)===t.commandId?a:null}function fD({state:e,session:t,act:a,navigate:r}){var j,ie,Ee,me,_e,Je,De,ue,ye,M,Y,se,Fe,je;const o=v.useContext(Kr),i=e.setup||{},s=(i.providers||[]).filter(oe=>oe.enabled!==!1),l=new Map(Qw(s.map(oe=>({...oe,info:{id:oe.module,display_name:Ac(oe.module).name}}))).map(oe=>[oe.id,oe.label])),c=((j=e.view)==null?void 0:j.aiConnectionEditor)||{},u=c.step||"list",d=Ac(c.module),p=s.find(oe=>oe.id===c.id),m=Or(c.authMode||((ie=p==null?void 0:p.config)==null?void 0:ie.auth_mode)),h={id:c.id,authMode:m,scope:c.scope||"global"},[f,g]=v.useState(""),[E,y]=v.useState(""),[b,S]=v.useState(""),[w,N]=v.useState(null),x=v.useRef(!1),A=v.useRef(t==null?void 0:t.workspace),C=v.useRef(0),O=v.useRef(!0),k=oe=>a("view.update",{patch:{aiConnectionEditor:{...c,...oe}}});v.useEffect(()=>(O.current=!0,()=>{O.current=!1,C.current++}),[]),v.useEffect(()=>{A.current!==(t==null?void 0:t.workspace)&&(C.current++,A.current=t==null?void 0:t.workspace,g(""),N(null),x.current=!1,k({step:"list",id:"",model:""})),a("providers.list",t?{sessionId:t.id}:{}),a("routing.list")},[t==null?void 0:t.workspace]);async function T(oe,Ze={},it=""){if(x.current)return;x.current=!0;const zt=++C.current;y(""),S(""),N({action:oe,id:Ze.id||Ze.module||"",commandId:null,next:it});try{const ct=await a(oe,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(oe)?{sessionId:t.id}:{},...Ze});if(!O.current||zt!==C.current)return;if(!(ct!=null&&ct.accepted)||!ct.operationId)throw Error((ct==null?void 0:ct.error)||"The request could not be confirmed. Please try again.");N({action:oe,id:Ze.id||Ze.module||"",commandId:ct.operationId,next:it})}catch(ct){O.current&&zt===C.current&&(y(ct.message),N(null),x.current=!1)}}const I=hD(e,w),F=!!w;v.useEffect(()=>{var it;if(!I||Lf(I))return;const oe=w.next,Ze=w.action;if(N(null),x.current=!1,I.phase==="error"){y(I.error||"The request did not finish. Your choices are kept.");return}I.phase==="ready"&&(Ze==="providers.save"?(g(""),k({saved:!0,...oe==="models"?{step:"model"}:{}}),oe==="signin"?T("providers.login",h):oe==="models"&&T("providers.models",{id:c.id})):Ze==="providers.remove"?(g(""),k({step:"list",id:"",saved:!1}),S("Connection removed. Chats that used it will need a replacement connection when resumed.")):Ze==="providers.finishSetup"?(k({step:"list",saved:!1}),S((it=i.setupCompletion)!=null&&it.routingSelected?"Connection saved. Balanced model rules are ready for new conversations.":"Model saved. Existing model rules are unchanged.")):Ze==="providers.models"&&S("Model list checked. No chat request was sent."))},[I==null?void 0:I.commandId,I==null?void 0:I.phase]);const z=((Ee=i.login)==null?void 0:Ee.providerId)===c.id?i.login:null;v.useEffect(()=>{var oe;o.active&&u==="connect"&&c.saved&&(z==null?void 0:z.status)==="completed"&&(z.authMode!=="chatgpt_plan"||(oe=z.account)!=null&&oe.planEnabled)&&z.loginId!==c.previousLoginId&&!F&&(k({step:"model"}),T("providers.models",{id:c.id}))},[u,c.saved,z==null?void 0:z.status,z==null?void 0:z.loginId,F,o.active]);const q=(me=i.providerCatalogs)==null?void 0:me[c.id],W=zl((q==null?void 0:q.models)||((_e=i.modelCatalogs)==null?void 0:_e[c.id])||[]),X=Lf((Je=i.operations)==null?void 0:Je["providers.models:"+c.id])||(q==null?void 0:q.phase)==="working",U=((De=i.credentialCheck)==null?void 0:De.module)===c.module?i.credentialCheck:null,_=c.credentialMode==="auto"?U!=null&&U.githubCliAvailable?"github-cli":U!=null&&U.available?"environment":"private":c.credentialMode||"private",P=oe=>{Ac(oe).auth!=="signin"&&T("providers.credentials",{module:oe})},G=oe=>{x.current||(g(""),y(""),S(""),k({step:"connect",module:oe.module,id:oe.module.replace("provider-","")+"-"+crypto.randomUUID().slice(0,8),model:"",baseUrl:"",previousLoginId:null,scope:"global",authMode:"chatgpt_codex",saved:!1,credentialMode:"auto",initializeRouting:s.length===0}),P(oe.module))},Z=()=>{var oe;return T("providers.save",{id:c.id,module:c.module,config:{...p==null?void 0:p.config,...d.auth==="optional-key"?{base_url:(oe=c.baseUrl)==null?void 0:oe.trim()}:{}},scope:c.scope||"global",...d.auth==="signin"?{}:_==="environment"?{apiKeyEnv:U==null?void 0:U.envVar}:_==="github-cli"?{useGitHubCli:!0}:{apiKey:f}},d.auth==="signin"?"signin":"models")},D=()=>{y(""),k({step:u==="services"||u==="detail"?"list":u==="model"?"detail":"services"})},ne=()=>r("providers"),H=!!f||u==="connect"&&!!c.baseUrl&&c.baseUrl!==(((ue=p==null?void 0:p.config)==null?void 0:ue.base_url)||"")||u==="model"&&!!c.model&&c.model!==(((ye=p==null?void 0:p.config)==null?void 0:ye.default_model)||((M=p==null?void 0:p.config)==null?void 0:M.model)||"");return Gw("ai-connections",{label:"AI connection setup",dirty:H,review:()=>{r("ai-connections"),k({step:u})},discard:()=>{g(""),y(""),k({step:"list",id:"",module:"",model:"",baseUrl:"",saved:!1})}}),n.createElement("section",{"data-part":"ai-connections",className:"a-ai-form"},u==="list"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Connect the AI services Amplifier can use for your work."),s.length?n.createElement(n.Fragment,null,n.createElement("div",{className:"a-everyday-list"},s.map(oe=>{var Ze,it,zt,ct;return n.createElement(gr,{key:oe.id,disabled:F,title:l.get(oe.id),description:(((Ze=oe.config)==null?void 0:Ze.default_model)||((it=oe.config)==null?void 0:it.model)||"Choose a model")+" · "+(oe.accountConnected?"Account connected":oe.credentialsConfigured?"Credentials available":oe.keySource==="provider-managed"?"Account sign-in":"Connection needs setup")+((ct=(zt=oe.credential)==null?void 0:zt.preview)!=null&&ct.masked?" · Key "+oe.credential.preview.masked:""),onClick:()=>{var qt,le,fe,xe,ze;y(""),S(""),k({step:"detail",id:oe.id,module:oe.module,authMode:Or((qt=oe.config)==null?void 0:qt.auth_mode),model:((le=oe.config)==null?void 0:le.default_model)||((fe=oe.config)==null?void 0:fe.model)||"",scope:"global",baseUrl:((xe=oe.config)==null?void 0:xe.base_url)||"",previousLoginId:(ze=i.login)==null?void 0:ze.loginId,saved:!0,initializeRouting:!1})}})})),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect another service")):n.createElement("div",{className:"a-ai-welcome"},n.createElement(hx,{"aria-hidden":"true"}),n.createElement("h4",null,"Start with one connection"),n.createElement("p",null,"Choose a service, connect your account, and choose a model. You can add more later."),n.createElement("button",{className:"a-primary","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect AI")),i.active&&s.length>0&&n.createElement("div",{className:"a-ai-hint"},"Your model rules are saved. ",n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>r("routing")},"Advanced model rules")),n.createElement("div",{className:"a-everyday-footer"},n.createElement("p",{className:"a-caption"},"Connections are stored on the Amplifier host. Existing conversations keep their settings."),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Advanced connection settings",n.createElement(sa,null)))):n.createElement(n.Fragment,null,n.createElement("button",{className:"a-link","data-action":"view.update",disabled:F,onClick:D},n.createElement(Sa,null),"Back"),u==="services"?n.createElement(n.Fragment,null,n.createElement("h4",null,"Which service would you like to use?"),n.createElement("div",{className:"a-everyday-list"},kp.map(oe=>n.createElement(gr,{key:oe.module,disabled:F,title:oe.name,description:oe.description,onClick:()=>G(oe)}))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Other provider or custom endpoint")):n.createElement(n.Fragment,null,n.createElement("p",{className:"a-ai-step"},u==="connect"?"1 · Connect":u==="model"?"2 · Choose a model":"Saved connection"),n.createElement("h4",null,l.get(c.id)||d.name),u==="detail"?n.createElement(n.Fragment,null,d.auth==="signin"&&n.createElement(Ep,{account:p==null?void 0:p.account}),n.createElement("p",null,p!=null&&p.accountConnected?"Your ChatGPT account is connected.":p!=null&&p.credentialsConfigured?"This connection has credentials available on the Amplifier host.":"This connection needs credentials before it can be used."),n.createElement("p",null,"Model: ",n.createElement("strong",null,((Y=p==null?void 0:p.config)==null?void 0:Y.default_model)||((se=p==null?void 0:p.config)==null?void 0:se.model)||"Not selected")),n.createElement(Tu,{credential:p==null?void 0:p.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:F,onClick:()=>T("providers.list")},n.createElement(Mt,null),"Refresh credentials"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"providers.models",disabled:F,onClick:()=>{k({step:"model"}),T("providers.models",{id:c.id})}},"Choose model"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>{k({step:"connect",previousLoginId:z==null?void 0:z.loginId,credentialMode:"private"}),P(c.module)}},d.auth==="signin"?p!=null&&p.accountConnected?"Reconnect account":"Sign in":"Change credentials"),n.createElement("button",{className:"a-soft","data-action":"providers.test",disabled:F,onClick:()=>T("providers.test",{id:c.id})},"Check connection")),n.createElement("p",{className:"a-caption"},"Checking verifies the model catalog, without sending a chat request."),n.createElement(Zw,{key:c.id,state:e,id:c.id,sessionId:t==null?void 0:t.id,act:a,disabled:F}),n.createElement("div",{className:"a-dialog-actions a-connection-secondary-actions"},n.createElement("button",{className:"a-soft a-danger","data-action":"providers.remove",disabled:F,onClick:()=>T("providers.remove",{id:c.id,scope:c.scope||"global"})},n.createElement(ea,null),"Remove connection"),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full connection settings"))):u==="connect"?n.createElement(n.Fragment,null,d.auth==="signin"?n.createElement(n.Fragment,null,z&&z.loginId!==c.previousLoginId?n.createElement(Au,{login:z,busy:F,onCancel:()=>T("providers.loginCancel",{id:c.id}),onRetry:()=>T("providers.login",h),onEnablePlan:()=>T("providers.login",{...h,enablePlan:!0})}):n.createElement(n.Fragment,null,n.createElement(Kw,{mode:m,onChange:oe=>k({authMode:oe}),disabled:F}),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":p?"providers.login":"providers.save",disabled:F,onClick:()=>p?T("providers.login",h):Z()},F?"Getting ready…":m==="chatgpt_plan"?"Continue with ChatGPT":"Get sign-in code")))):n.createElement(n.Fragment,null,d.auth==="optional-key"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-base-url"},"API base URL"),n.createElement("input",{id:"ai-base-url",type:"url",placeholder:"http://localhost:1234/v1",value:c.baseUrl||"",disabled:F,onChange:oe=>k({baseUrl:oe.target.value})}),n.createElement("p",{className:"a-caption"},"Use an address reachable from the computer running Amplifier. Include /v1 if your service requires it.")),((U==null?void 0:U.available)||(U==null?void 0:U.githubCliAvailable))&&n.createElement("fieldset",{className:"a-credential-options"},n.createElement("legend",null,"How would you like to connect?"),U.available&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="environment",onChange:()=>{g(""),k({credentialMode:"environment"})}}),n.createElement("span",null,n.createElement("strong",null,"Use the key already on this host"),n.createElement("small",null,"Found ",U.envVar,". Only its name is saved; the key stays in the environment."))),U.githubCliAvailable&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="github-cli",onChange:()=>{g(""),k({credentialMode:"github-cli"})}}),n.createElement("span",null,n.createElement("strong",null,"Use GitHub CLI sign-in"),n.createElement("small",null,"Use the host’s signed-in GitHub account. Its token is saved privately for this connection."))),n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="private",onChange:()=>k({credentialMode:"private"})}),n.createElement("span",null,n.createElement("strong",null,"Use a different key"),n.createElement("small",null,"Connect another account or enter a key yourself.")))),_==="environment"&&n.createElement(Tu,{credential:U}),_==="private"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-private-key"},d.auth==="token"?"GitHub token":d.auth==="optional-key"?"API key (optional)":"API key"),n.createElement("input",{id:"ai-private-key",type:"password",autoComplete:"off",spellCheck:!1,value:f,onChange:oe=>g(oe.target.value),disabled:F}),n.createElement("p",{className:"a-caption"},d.auth==="optional-key"?"Leave blank if your local service does not need a key.":"Stored privately for this connection. Other accounts keep their own keys.")),d.auth==="token"&&!(U!=null&&U.githubCliAvailable)&&!(U!=null&&U.available)&&n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Help connecting GitHub Copilot"),n.createElement("div",null,n.createElement("p",null,"Sign in to GitHub CLI on the computer running Amplifier, then check again. Or use a GitHub token for an account with Copilot access."),n.createElement("a",{href:"https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli",target:"_blank",rel:"noreferrer"},"GitHub setup guide"),n.createElement("button",{className:"a-link",disabled:F,onClick:()=>P(c.module)},"Check host sign-in again"))),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"providers.save",disabled:F||d.auth==="optional-key"&&!/^https?:\/\/[^\s]+$/.test(c.baseUrl||"")||(_==="environment"?!(U!=null&&U.available):_==="github-cli"?!(U!=null&&U.githubCliAvailable):d.auth!=="optional-key"&&!f.trim()),onClick:Z},F?"Connecting…":"Save and check connection")))):u==="model"?n.createElement(n.Fragment,null,(z==null?void 0:z.status)==="completed"&&n.createElement(Au,{login:z,chooseModel:!0,welcomeDismissed:c.welcomedLoginId===z.loginId,onWelcomeDismiss:()=>k({welcomedLoginId:z.loginId})}),n.createElement("p",null,"Choose from the models available through this connection."),W.length>0?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model"},"Model"),n.createElement(wp,{id:"ai-model",label:"Model",value:c.model||"",catalogKey:c.id,entry:{...q,models:W,phase:"ready"},state:e,act:a,onChange:oe=>k({model:oe})})):n.createElement("p",{role:"status"},X?"Loading models…":"No model list is available yet. Retry or enter a model ID under More options."),X&&W.length>0&&n.createElement("p",{className:"a-caption",role:"status"},"Refreshing in the background. Saved models remain available."),(q==null?void 0:q.phase)==="error"&&n.createElement(nt,{phase:"error",message:q.error||"Could not refresh the model list. Saved choices are kept."}),n.createElement("button",{className:"a-link","data-action":"providers.models",disabled:F||X,onClick:()=>T("providers.models",{id:c.id,refresh:!0})},n.createElement(Mt,null),"Refresh models"),n.createElement("div",{className:"a-ai-hint"},c.initializeRouting?"Balanced model rules choose suitable models for each task. This connection’s default is used when no rule applies.":"This changes the connection’s default model. Existing model rules may choose a different model."),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:F||!((Fe=c.model)!=null&&Fe.trim()),"data-action":"providers.finishSetup",onClick:()=>T("providers.finishSetup",{id:c.id,model:c.model,scope:c.scope||"global",initializeRouting:!!c.initializeRouting})},F?"Saving…":"Finish setup"))):null,n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"More options"),n.createElement("div",null,n.createElement("label",{htmlFor:"ai-scope"},"Save for"),n.createElement("select",{id:"ai-scope",value:c.scope||"global",disabled:F,"data-action":"view.update",onChange:oe=>k({scope:oe.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"local"},"This workspace on this host"),n.createElement("option",{value:"project"},"This project (shareable configuration)")),u==="model"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model-manual"},"Model ID"),n.createElement("input",{id:"ai-model-manual",value:c.model||"",disabled:F,"data-action":"view.update",onChange:oe=>k({model:oe.target.value})})),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full provider configuration"))))),E&&n.createElement(nt,{phase:"error",message:E}),b&&n.createElement(nt,{phase:"ready",message:b}),F&&n.createElement(nt,{phase:"working",message:"Working on this connection…"}),!F&&((je=i.test)==null?void 0:je.providerId)===c.id&&u==="detail"&&n.createElement(nt,{phase:i.test.reachable===!1?"error":"ready",message:i.test.reachable===!1?"Connection check failed.":"Model catalog check passed."}))}function Va({id:e,label:t,description:a,selected:r,onSelect:o,checked:i,onCheck:s,disabled:l,badge:c,checkLabel:u,checkAction:d="view.update"}){return n.createElement("div",{className:"a-collection-row"+(r?" selected":""),"data-collection-id":e},s&&n.createElement("label",{className:"a-collection-check"},n.createElement("input",{type:"checkbox","aria-label":u||"Select "+t,checked:!!i,disabled:l,"data-action":d,onChange:p=>s(p.target.checked)})),n.createElement("button",{type:"button","aria-current":r?"true":void 0,"data-action":"view.update",onClick:o},n.createElement("span",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a)),c&&n.createElement("small",{className:"a-collection-badge"},c),n.createElement(en,{"aria-hidden":"true"})))}function Co({list:e,children:t,detailOpen:a=!0,onBack:r,label:o="items"}){const i=v.useRef(null),s=v.useRef(null),l=v.useContext(Kr);v.useEffect(()=>{var u;a&&l.compact&&((u=s.current)==null||u.focus({preventScroll:!0}))},[a,l.compact]);const c=()=>{r==null||r(),requestAnimationFrame(()=>{var u,d;return(d=(u=i.current)==null?void 0:u.querySelector("button[aria-current=true],button"))==null?void 0:d.focus({preventScroll:!0})})};return n.createElement("div",{className:"a-collection"+(a?" detail-open":"")},n.createElement("div",{className:"a-collection-list",ref:i},e),n.createElement("div",{className:"a-collection-detail",ref:s,tabIndex:-1},r&&!l.compact&&n.createElement("button",{type:"button",className:"a-link a-collection-back","data-action":"view.update",onClick:c},n.createElement(Sa,null),"Back to ",o),t))}function xp({title:e,description:t,items:a,ids:r,onChange:o,onSave:i,onCancel:s,busy:l=!1,error:c,notice:u,action:d="view.update"}){const[p,m]=v.useState(!1);return n.createElement("section",{className:"a-order-editor"},n.createElement("h4",null,e),u&&n.createElement("p",{role:"status"},u),n.createElement("p",null,t),n.createElement("p",{className:"a-caption"},"Drag the handle or choose a position. Changes apply when you save."),n.createElement(kg,{items:a,ids:r,onChange:o,onDraggingChange:m,busy:l,className:"a-order-list",rowClassName:"a-order-item",floatingClassName:"a-order-item",savedHint:"Save order to apply.",renderItem:(h,{handle:f,index:g,move:E})=>n.createElement(n.Fragment,null,f,n.createElement("span",{className:"a-order-copy"},n.createElement("strong",null,h.label),n.createElement("small",null,h.description)),n.createElement("span",{className:"a-order-arrows"},n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===0,"aria-label":"Move "+h.label+" up","data-action":"view.update",onClick:()=>E(g-1)},n.createElement(Li,null)),n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===r.length-1,"aria-label":"Move "+h.label+" down","data-action":"view.update",onClick:()=>E(g+1)},n.createElement(sg,null))),n.createElement("select",{"aria-label":"Position of "+h.label,value:g,disabled:l,"data-action":"view.update",onChange:y=>E(Number(y.target.value))},r.map((y,b)=>n.createElement("option",{key:b,value:b},b+1))))}),c&&n.createElement("p",{role:"alert",className:"a-danger"},c),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:l||p,"data-action":d,onClick:i},l?"Saving order…":"Save order"),n.createElement("button",{type:"button",className:"a-soft",disabled:l,"data-action":"view.update",onClick:s},"Cancel")))}const cr=e=>JSON.stringify(e,null,2),ms=e=>["queued","working","pending","running"].includes(e==null?void 0:e.phase);function gD({state:e,act:t}){var _,P,G,Z,D,ne,H,j,ie,Ee,me,_e,Je,De,ue,ye;v.useContext(Kr);const a=(_=e.view)==null?void 0:_.routingEditor,[r,o]=v.useState({name:"my-routing",scope:"global",matrix:null,newRole:"",...a}),i=v.useRef(r),[s,l]=v.useState({});v.useEffect(()=>{a&&(i.current=a,o(a))},[a]);const c=M=>{const Y={...i.current,...M};i.current=Y,o(Y),t("view.update",{patch:{routingEditor:Y}})},u=e.setup||{},d=u.providers||[],p=u.matrices||[],[m,h]=xa(e,t,"routing-profiles",p,M=>[M.name,M.description,M.source],"Filter routing profiles"),f=M=>{var Y;return s[M]||((Y=e.actionStatus)==null?void 0:Y[M])},g=async(M,Y={})=>{l(se=>({...se,[M]:{phase:"pending"}}));try{const se=await t(M,Y);return l(Fe=>({...Fe,[M]:se?null:{phase:"error",error:"Request could not be sent. Try again."}})),se}catch(se){l(Fe=>({...Fe,[M]:{phase:"error",error:se.message}}))}};v.useEffect(()=>{g("routing.list"),i.current.requested&&g("routing.show",{name:i.current.requested})},[]);const E=()=>({...r.profiles,...r.matrix?{[r.profileKey||r.name]:{matrix:r.matrix,name:r.name,role:r.role,candidate:r.candidate,rawText:r.rawText,raw:r.raw}}:{}}),y=M=>{const Y=E(),se=Y[M];se?c({...se,profileKey:M,requested:null,profiles:Y,order:null,error:"",detailOpen:!1,candidateOpen:!1}):(c({profileKey:M,requested:M,profiles:Y,order:null,error:""}),g("routing.show",{name:M}))};v.useEffect(()=>{if(u.matrix&&u.matrix.name===i.current.requested){const M=u.matrix;c({matrix:M,name:M.name,profileKey:M.name,requested:null,rawText:cr(M),raw:!1,role:Object.keys(M.roles||{})[0],candidate:0,detailOpen:!1,candidateOpen:!1,error:""})}},[u.matrix,r.requested]),v.useEffect(()=>{!i.current.matrix&&!i.current.requested&&p.length&&y(u.active||p[0].name)},[p]);const b=r.matrix||Mf(r.name),S=Object.entries(b.roles||{}),w=(P=b.roles)!=null&&P[r.role]?r.role:(G=S[0])==null?void 0:G[0],N=(Z=b.roles)==null?void 0:Z[w],x=(N==null?void 0:N.candidates)||[],A=Math.min(r.candidate||0,Math.max(0,x.length-1)),C=x[A],[O,k]=xa(e,t,"routing-roles",S,([M,Y])=>[M,Y.description,...(Y.candidates||[]).flatMap(se=>[se.provider,se.model])],"Filter task roles");v.useEffect(()=>{r.order&&r.orderOpen!==!1&&!Iu(x,w,r.order)&&c({order:Tc(x,w,r.order)})},[r.order,r.orderOpen,w,x]);const T=M=>c({matrix:M,rawText:cr(M),error:""}),I=M=>T(oD(b,w,A,M)),F=C?d.filter(M=>M.id===C.provider||M.module==="provider-"+C.provider||M.module===C.provider):[],z=F.find(M=>M.id===(C==null?void 0:C.provider)),q=z?[z]:F,W=[...new Map(q.flatMap(M=>{var Y;return(((Y=u.modelCatalogs)==null?void 0:Y[M.id])||[]).map(se=>[typeof se=="string"?se:se.id,se])}).filter(([M])=>M)).values()],X=z?(D=u.providerCatalogs)==null?void 0:D[z.id]:void 0;v.useEffect(()=>{var Y,se;const M=(Y=e.actionStatus)==null?void 0:Y["routing.save"];(M==null?void 0:M.phase)==="ready"&&((se=M.target)==null?void 0:se.name)===i.current.name&&c({profileKey:i.current.name})},[(H=(ne=e.actionStatus)==null?void 0:ne["routing.save"])==null?void 0:H.updatedAt]);const U=ms(f("routing.save"))||ms(f("routing.use"));return n.createElement("section",{className:"a-settings-section","data-part":"routing-settings","data-candidate-open":!!r.candidateOpen},n.createElement("div",{className:"a-settings-row"},n.createElement("p",null,"Choose models for each role. Routing uses the first resolvable choice."),n.createElement("button",{className:"a-icon","aria-label":"Refresh routing profiles","data-action":"routing.list",disabled:ms(f("routing.list")),onClick:()=>g("routing.list")},n.createElement(Mt,null))),u.routingCatalogError&&n.createElement(nt,{phase:"error",message:u.routingCatalogError}),n.createElement("div",{className:"a-routing-profile-picker"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-profile"},"Routing profile"),n.createElement("select",{id:"routing-profile",value:r.profileKey||"","data-action":"routing.show",onChange:M=>y(M.target.value)},n.createElement("option",{value:"",disabled:!0},"Choose a profile"),m.map(M=>n.createElement("option",{key:M.name,value:M.name},M.name,M.active||u.active===M.name?" · active":"")),r.profileKey&&!m.some(M=>M.name===r.profileKey)&&n.createElement("option",{value:r.profileKey},r.name," · draft"))),n.createElement("button",{className:"a-soft",disabled:!p.some(M=>M.name===r.profileKey)||u.active===r.profileKey||U||!!r.requested,"data-action":"routing.use",onClick:()=>g("routing.use",{name:r.profileKey,scope:r.scope})},"Use profile"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{const M=Mf();c({profiles:E(),matrix:M,name:M.name,profileKey:"new:"+Date.now(),requested:null,role:"general",candidate:0,rawText:cr(M),order:null,detailOpen:!1,candidateOpen:!1})}},n.createElement(Ln,null),"New profile")),r.requested&&n.createElement(nt,{phase:((j=f("routing.show"))==null?void 0:j.phase)==="error"?"error":"working",message:((ie=f("routing.show"))==null?void 0:ie.error)||"Opening "+r.requested+"…"}),r.requested&&((Ee=f("routing.show"))==null?void 0:Ee.phase)==="error"&&n.createElement("button",{className:"a-soft","data-action":"routing.show",onClick:()=>g("routing.show",{name:r.requested})},"Retry opening profile"),["routing.list","routing.use"].map(M=>{var Y;return((Y=f(M))==null?void 0:Y.phase)==="error"&&n.createElement(nt,{key:M,phase:"error",message:f(M).error})}),r.matrix&&n.createElement(n.Fragment,null,n.createElement("details",{className:"a-routing-profile-options",open:!!r.profileDetails},n.createElement("summary",{"data-action":"view.update",onClick:M=>{M.preventDefault(),c({profileDetails:!r.profileDetails})}},"Profile settings"),h,n.createElement("p",{className:"a-caption"},(me=p.find(M=>M.name===r.profileKey))==null?void 0:me.description),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-name"},"Custom profile name"),n.createElement("input",{id:"routing-name",value:r.name,"data-action":"view.update",onChange:M=>c({name:M.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"routing-scope"},"Save for"),n.createElement("select",{id:"routing-scope",value:r.scope,"data-action":"view.update",onChange:M=>c({scope:M.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace"))))),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:w+" preference order",notice:r.order.notice,description:"Place your preferred choice first. Routing selects the first resolvable match; this is not a retry chain for failed API calls.",items:x.map((M,Y)=>({id:String(Y),label:M.model||"Choose a model",description:M.provider||"Choose a provider"})),ids:r.order.ids,onChange:M=>c({order:{...r.order,ids:M}}),onCancel:()=>c({order:null}),onSave:()=>{if(!Iu(x,w,r.order)){c({order:Tc(x,w,r.order)});return}const M=Pr(b,w,{candidates:r.order.ids.map(Y=>x[Number(Y)])});c({order:null,matrix:M,rawText:cr(M),candidate:0})}}):n.createElement(Co,{label:"roles",detailOpen:!!r.detailOpen,onBack:()=>c({detailOpen:!1,candidateOpen:!1}),list:n.createElement(n.Fragment,null,k,O.map(([M,Y])=>{var se;return n.createElement(Va,{key:M,id:M,label:M,description:Y.description||`${((se=Y.candidates)==null?void 0:se.length)||0} choices`,selected:M===w,onSelect:()=>c({role:M,candidate:0,detailOpen:!0,candidateOpen:!1,candidateRaw:!1})})}))},N&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,w),n.createElement("button",{className:"a-icon a-danger","aria-label":"Remove role "+w,disabled:["general","fast"].includes(w),"data-action":"view.update",onClick:()=>{const M={...b,roles:{...b.roles}};delete M.roles[w],T(M)}},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-description"},"Role description"),n.createElement("input",{id:"routing-description","aria-label":w+" description",value:N.description||"",placeholder:"Describe this role","data-action":"view.update",onChange:M=>T(Pr(b,w,{description:M.target.value}))}),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,x.length," ordered choices"),n.createElement("button",{className:"a-soft",disabled:x.length<2,"data-action":"view.update",onClick:()=>c({orderOpen:!0,order:Tc(x,w,r.order)})},"Preference order")),n.createElement("div",{className:"a-routing-candidates"},x.map((M,Y)=>n.createElement(Va,{key:Y,id:String(Y),label:`${Y+1}. ${M.model||"Choose a model"}`,description:M.provider||"Choose a provider",selected:Y===A,onSelect:()=>c({candidate:Y,candidateOpen:!0,candidateRaw:!1})}))),C&&n.createElement("div",{className:"a-routing-selected"},n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,"Choice ",A+1),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove ${w} candidate ${A+1}`,"data-action":"view.update",onClick:()=>T(Pr(b,w,{candidates:x.filter((M,Y)=>Y!==A)}))},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-candidate-provider"},"Provider or connection name"),n.createElement("input",{id:"routing-candidate-provider","aria-label":`${w} provider ${A+1}`,list:"routing-provider-options",value:C.provider||"",placeholder:"For example, anthropic or opus","data-action":"view.update",onChange:M=>I({provider:M.target.value})}),n.createElement("datalist",{id:"routing-provider-options"},[...new Set(d.flatMap(M=>[M.id,M.module.replace(/^provider-/,"")]))].map(M=>n.createElement("option",{key:M,value:M}))),n.createElement("p",{className:"a-caption"},"Use a provider family for a portable profile, or a connection name for a specific account and configuration."),n.createElement("label",{htmlFor:`routing-${w}-${A}`},"Model ID or pattern"),n.createElement(wp,{editable:!0,catalogKey:C.provider,id:`routing-${w}-${A}`,label:`${w} model ${A+1}`,value:C.model||"",entry:X,models:W,state:e,act:t,placeholder:"Model ID or pattern, e.g. claude-sonnet-*",onChange:M=>I({model:M})}),n.createElement("p",{className:"a-caption"},"Patterns are resolved by the routing module. Model lists are suggestions and do not limit what you can enter.",q.length>0?" Suggestions from "+q.map(M=>M.id).join(", ")+".":""),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":!!r.candidateRaw,onClick:()=>c({candidateRaw:!r.candidateRaw,candidateText:cr(C)})},"Edit choice configuration"),r.candidateRaw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Choice configuration JSON",className:"a-json-editor",value:r.candidateText,"data-action":"view.update",onChange:M=>c({candidateText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.candidateText);if(!M.provider||!M.model)throw new Error("Include a provider and model.");const Y=[...x];Y[A]=M,T(Pr(b,w,{candidates:Y}))}catch(M){c({error:M.message})}}},"Apply choice configuration"))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>{const M=Pr(b,w,{candidates:[...x,{provider:"",model:""}]});c({matrix:M,rawText:cr(M),candidate:x.length,candidateOpen:!0,candidateRaw:!1})}},n.createElement(Ln,null),"Add fallback model"))),n.createElement("div",{className:"a-routing-add"},n.createElement("input",{"aria-label":"New routing role",list:"routing-role-options",value:r.newRole||"",placeholder:"Add a role","data-action":"view.update",onChange:M=>c({newRole:M.target.value})}),n.createElement("datalist",{id:"routing-role-options"},(u.roles||[]).map(M=>n.createElement("option",{value:M,key:M}))),n.createElement("button",{className:"a-soft",disabled:!((_e=r.newRole)!=null&&_e.trim())||!!((Je=b.roles)!=null&&Je[r.newRole.trim()]),"data-action":"view.update",onClick:()=>{const M=r.newRole.trim(),Y=Pr(b,M,{description:"",candidates:[{provider:"",model:""}]});c({matrix:Y,rawText:cr(Y),newRole:"",role:M,candidate:0,detailOpen:!0,candidateOpen:!0})}},n.createElement(Ln,null),"Add role")),n.createElement("div",{className:"a-routing-advanced"},n.createElement("button",{className:"a-link","aria-expanded":!!r.raw,"data-action":"view.update",onClick:()=>c({raw:!r.raw,rawText:cr(b)})},r.raw?"Hide":"Show"," full profile JSON"),r.raw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Routing matrix JSON",className:"a-json-editor",spellCheck:!1,value:r.rawText,"data-action":"view.update",onChange:M=>c({rawText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.rawText);if(!M.roles||typeof M.roles!="object"||Array.isArray(M.roles))throw new Error("A profile needs a roles object.");T(M)}catch(M){c({error:M.message})}}},"Update draft from JSON"))),r.error&&n.createElement("p",{className:"a-danger",role:"alert"},r.error),n.createElement(Rn,{active:!r.order||r.orderOpen===!1},n.createElement("button",{className:"a-primary",disabled:U||!!r.requested||!!r.order&&r.orderOpen!==!1||!r.name.trim()||!S.length||S.some(([,M])=>{var Y;return!((Y=M.candidates)!=null&&Y.length)||M.candidates.some(se=>!se.provider||!se.model)}),"data-action":"routing.save",onClick:()=>g("routing.save",{name:r.name.trim(),matrix:{...b,name:r.name.trim()},scope:r.scope,activate:!0})},n.createElement($c,null),u.active===r.name?"Save active profile":"Save and use profile")),n.createElement("p",{className:"a-caption"},"General and fast roles are required. Saving applies to future conversation preparation."),n.createElement(nt,{phase:(De=f("routing.save"))==null?void 0:De.phase,message:((ue=f("routing.save"))==null?void 0:ue.error)||(ms(f("routing.save"))?"Saving routing profile…":((ye=f("routing.save"))==null?void 0:ye.phase)==="ready"?"Routing profile saved and selected.":"")})))}const ni=e=>JSON.stringify(e,null,2);function vD(e,t,a,r){var c;const o=(c=e.view)==null?void 0:c[t],[i,s]=v.useState({...a,...o});return v.useEffect(()=>{o&&s(u=>({...u,...o}))},[o]),[i,u=>{const d={...i,...u};s(d),r("view.update",{patch:{[t]:d}})}]}function bD({state:e,session:t,act:a,navigate:r=()=>{}}){var oe,Ze,it,zt,ct,qt,le,fe,xe,ze,Ye,ht,bt,ft,Ce,gt,Et,vt,at;const[o,i]=vD(e,"providerEditor",{id:"",module:"",source:"",config:"{}",scope:"global",model:"",effort:"",advanced:!1,credentialMode:(Ze=(oe=e.view)==null?void 0:oe.providerEditor)!=null&&Ze.id?"private":"environment",envVar:""},a),s=ee=>i({dirty:!0,...ee}),l=v.useRef({}),c=v.useRef(!1),[u,d]=v.useState(""),[p,m]=v.useState(o.config);v.useEffect(()=>{var ee;m(c.current?((ee=l.current[o.selectionKey??o.id])==null?void 0:ee.configText)??o.config:o.config),c.current=!1},[o.config,o.selectionKey]);const h=e.setup||{},f=(h.providers||[]).filter(ee=>ee.enabled!==!1),g=f.find(ee=>ee.id===o.id),E=v.useRef(Date.now()/1e3),y=v.useRef(!1),[b,S]=v.useState({}),w=(ee,Re=o.id)=>{var et;const ae=ee+":"+Re,Le=(et=h.operations)==null?void 0:et[ae],Oe=b[ae];return Oe&&(!Le||Le.commandId!==Oe.commandId)?Oe:Le},N=ee=>["queued","working","pending"].includes(ee==null?void 0:ee.phase),x=async(ee,Re={})=>{const ae=ee+":"+(["providers.credentials","providers.schema"].includes(ee)?Re.module:Re.id||""),Le={phase:"pending",commandId:"local-"+Date.now(),envVar:Re.envVar||""};S(Oe=>({...Oe,[ae]:Le}));try{const Oe=await a(ee,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(ee)?{sessionId:t.id}:{},...Re});return S(et=>({...et,[ae]:Oe?null:{phase:"error",error:"The request could not be sent. Please retry."}})),Oe}catch(Oe){S(et=>({...et,[ae]:{phase:"error",error:Oe.message}}))}};v.useEffect(()=>{y.current=!1,E.current=h.providersLoadedAt||Date.now()/1e3,x("providers.list")},[t==null?void 0:t.workspace]);const A=((it=h.credentialCheck)==null?void 0:it.module)===o.module&&(o.envVar?h.credentialCheck.envVar===o.envVar:!h.credentialCheck.requestedEnvVar)?h.credentialCheck:null,C=A||((g==null?void 0:g.module)===o.module?g.credential:null),O=o.envVar||(C==null?void 0:C.envVar)||"",k=w("providers.credentials",o.module),T=k&&k.envVar===(o.envVar||"")?k:null,I=w("providers.models"),F=w("providers.schema",o.module),z=w("providers.test"),q=w("providers.list",""),W=o.credentialMode||"environment",X=o.module!=="provider-openai-chatgpt";v.useEffect(()=>{if(!o.module||W!=="environment"||!X)return;const ee=setTimeout(()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}}),250);return()=>clearTimeout(ee)},[o.module,o.envVar,W]);const U=["providers.save","providers.remove","providers.login","providers.move","providers.reorder"].some(ee=>N(w(ee))),_=((ct=(zt=h.providerCatalogs)==null?void 0:zt[o.id])==null?void 0:ct.metadata)||((qt=h.metadata)==null?void 0:qt[o.module])||(((le=h.providerMetadata)==null?void 0:le.module)===o.module?h.providerMetadata:null);v.useEffect(()=>{if(!/^provider-[A-Za-z0-9_.-]+$/.test(o.module)||_)return;const ee=setTimeout(()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}}),250);return()=>clearTimeout(ee)},[o.module,t==null?void 0:t.workspace]);const P=zl(((fe=h.modelCatalogs)==null?void 0:fe[o.id])||((h.modelsProviderId||h.providerId)===o.id?h.models:[])),G=((xe=h.login)==null?void 0:xe.providerId)===o.id?h.login:null,Z=(G==null?void 0:G.status)||(G==null?void 0:G.phase),D=Jw(G==null?void 0:G.url);let ne,H="";try{ne=tr(p)}catch(ee){H=ee.message}const[j,ie]=xa(e,a,"providers",f,ee=>{var Re,ae;return[ee.id,ee.module,(Re=ee.config)==null?void 0:Re.default_model,(ae=ee.config)==null?void 0:ae.model]},"Filter providers"),Ee=Or(o.authMode||((ze=g==null?void 0:g.config)==null?void 0:ze.auth_mode)),me=t&&["working","starting","running","stopping","busy"].includes(t.status),_e=ee=>{var xt,Ut,rt,Xe,$e,Nt,Zt,rn;c.current=!0;const Re=o.selectionKey??o.id??"";l.current[Re]={apiKey:u,configText:p};const{connections:ae,...Le}=o,Oe={...ae,[Re]:Le},et=(ee==null?void 0:ee.id)||"",It=Oe[et]||(ee?{modelEntry:"catalog",dirty:!1,authMode:Or((xt=ee.config)==null?void 0:xt.auth_mode),credentialMode:(Ut=ee.credential)!=null&&Ut.hasStoredKey||!ee.credential&&ee.credentialsConfigured?"private":"environment",envVar:((rt=ee.credential)==null?void 0:rt.envVar)||"",id:ee.id,module:ee.module,source:ee.source||"",config:ni(ee.config||{}),model:((Xe=ee.config)==null?void 0:Xe.default_model)||(($e=ee.config)==null?void 0:$e.model)||"",effort:((Nt=ee.config)==null?void 0:Nt.reasoning_effort)||""}:{modelEntry:"catalog",dirty:!1,id:"",module:"",source:"",config:"{}",model:"",effort:"",credentialMode:"environment",envVar:""});d(((Zt=l.current[et])==null?void 0:Zt.apiKey)||""),m(((rn=l.current[et])==null?void 0:rn.configText)??It.config),i({...It,connections:Oe,selectionKey:et,detailOpen:!0,order:null})};v.useEffect(()=>{var Re,ae,Le,Oe,et,st;if(y.current||!f.length||!h.providersLoadedAt||h.providersLoadedAtIt.id===o.id)||(!o.id&&!o.module?f[0]:null);ee&&!o.dirty&&i({id:ee.id,selectionKey:ee.id,module:ee.module,source:ee.source||"",config:ni(ee.config||{}),model:((Re=ee.config)==null?void 0:Re.default_model)||((ae=ee.config)==null?void 0:ae.model)||"",effort:((Le=ee.config)==null?void 0:Le.reasoning_effort)||"",authMode:Or((Oe=ee.config)==null?void 0:Oe.auth_mode),credentialMode:(et=ee.credential)!=null&&et.hasStoredKey||!ee.credential&&ee.credentialsConfigured?"private":"environment",envVar:((st=ee.credential)==null?void 0:st.envVar)||"",dirty:!1})},[h.providersLoadedAt]);const Je=v.useRef("");v.useEffect(()=>{var ee;if(!((G==null?void 0:G.status)!=="completed"||G.loginId===Je.current||!g)){Je.current=G.loginId;try{const Re={...tr(p)};for(const Le of["auth_mode","token_file_path","host_file_path","login_on_mount"])Le in(g.config||{})&&(Re[Le]=g.config[Le]);const ae=ni(Re);m(ae),i({config:ae,authMode:Or((ee=g.config)==null?void 0:ee.auth_mode)})}catch{}}},[G==null?void 0:G.loginId,G==null?void 0:G.status,(Ye=g==null?void 0:g.config)==null?void 0:Ye.auth_mode]);const De=w("providers.remove");v.useEffect(()=>{(De==null?void 0:De.phase)==="ready"&&De.updatedAt>=E.current&&(delete l.current[o.id],d(""),m("{}"),i({id:"",module:"",config:"{}",model:"",dirty:!1,detailOpen:!1,connections:{...o.connections,[o.id]:void 0}}))},[De==null?void 0:De.updatedAt]);const ue=w("providers.save");v.useEffect(()=>{(ue==null?void 0:ue.phase)==="ready"&&ue.updatedAt>=E.current&&(d(""),l.current[o.selectionKey??o.id]={apiKey:"",configText:p},s({dirty:!1,connections:{...o.connections,[o.selectionKey??o.id]:void 0}}))},[ue==null?void 0:ue.updatedAt]),v.useEffect(()=>{var ee;((ee=w("providers.reorder",""))==null?void 0:ee.phase)==="ready"&&o.order&&i({order:null})},[(ht=w("providers.reorder",""))==null?void 0:ht.updatedAt]);const ye=(ee,Re={})=>x(ee,{id:o.id,...Re}),M=yp(_,{...ne,default_model:o.model,model:o.model}).filter(ee=>o.module!=="provider-openai-chatgpt"||ee.id!=="auth_mode"),Y=(ee,Re)=>{const ae={...ne};Re===""?delete ae[ee]:ae[ee]=Re,m(ni(ae)),s({config:ni(ae),dirty:!0,...ee==="reasoning_effort"?{effort:Re}:{}})},se=async()=>{await x("providers.save",{...o.id?{id:o.id}:{},module:o.module.trim(),...o.source.trim()?{source:o.source.trim()}:{},config:{...ne,...o.model?{default_model:o.model}:{}},scope:o.scope,...X&&W==="environment"&&O?{apiKeyEnv:O}:u&&W==="private"?{apiKey:u}:{}})},Fe=!!u||p!==o.config||Object.values(l.current).some(ee=>ee.apiKey),je=!!o.dirty||Fe||Object.values(o.connections||{}).some(ee=>ee==null?void 0:ee.dirty);return Gw("providers",{label:"Provider configuration",dirty:je,review:()=>{r("providers");const ee=Object.entries(o.connections||{}).find(([,Re])=>Re==null?void 0:Re.dirty);!o.dirty&&!Fe&&ee?_e(f.find(Re=>Re.id===ee[0])||null):i({detailOpen:!0})},discard:()=>{l.current={},d(""),m("{}"),i({id:"",selectionKey:"",module:"",source:"",config:"{}",model:"",effort:"",dirty:!1,connections:{},detailOpen:!1})}}),n.createElement("section",{className:"a-settings-section","data-part":"provider-settings"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Model providers"),n.createElement("p",null,"Connect a provider and choose models for your conversations.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh providers","data-operation-pending":N(q)||void 0,"aria-busy":N(q)||void 0,"data-action":"providers.list",disabled:N(q),onClick:()=>x("providers.list")},n.createElement(Mt,null))),N(q)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading your saved providers…"),(q==null?void 0:q.error)&&n.createElement("p",{className:"a-danger",role:"alert"},q.error),!f.length&&!N(q)&&n.createElement("p",{className:"a-caption"},"No saved providers yet. Add a connection below."),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,f.length," saved connections"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>_e(null)},n.createElement(Ln,null),"Add provider"),n.createElement("button",{className:"a-soft",disabled:f.length<2||U,"data-action":"view.update",onClick:()=>i({orderOpen:!0,order:o.order||{ids:f.map(ee=>ee.id),expectedIds:f.map(ee=>ee.id),scope:o.scope}})},"Preference order")),o.order&&o.orderOpen!==!1?n.createElement(xp,{title:"Provider preference order",description:"Provider priority breaks ties after routing matches a model. Saving for "+({global:"all workspaces",project:"this project",local:"this workspace"}[o.order.scope]||o.order.scope)+". Routing profile choices stay separate.",items:f.map(ee=>({id:ee.id,label:ee.id,description:ee.module})),ids:o.order.ids,onChange:ee=>i({order:{...o.order,ids:ee}}),onCancel:()=>i({order:null}),busy:N(w("providers.reorder","")),error:(bt=w("providers.reorder",""))==null?void 0:bt.error,action:"providers.reorder",onSave:()=>x("providers.reorder",{...o.order})}):n.createElement(Co,{label:"providers",detailOpen:!!o.detailOpen,onBack:()=>i({detailOpen:!1}),list:n.createElement(n.Fragment,null,ie,n.createElement(Xt,{name:"provider-list",busy:N(q)},j.map(ee=>{var Re,ae;return n.createElement(Va,{key:ee.id,id:ee.id,label:ee.id,description:(((Re=ee.config)==null?void 0:Re.default_model)||((ae=ee.config)==null?void 0:ae.model)||ee.module)+" · "+(ee.credentialsConfigured?"credentials ready":ee.keySource||"credentials not configured"),selected:ee.id===(o.selectionKey??o.id),onSelect:()=>_e(ee)})})))},n.createElement("div",{className:"a-settings-provider-detail"},n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"provider-id"},"Provider instance name"),n.createElement("input",{id:"provider-id",value:o.id,"data-action":"view.update",onChange:ee=>s({id:ee.target.value}),placeholder:"openai"})),n.createElement("div",null,n.createElement("label",{htmlFor:"provider-scope"},"Save for"),n.createElement("select",{id:"provider-scope",value:o.scope,"data-action":"view.update",onChange:ee=>s({scope:ee.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project (shareable)"),n.createElement("option",{value:"local"},"This workspace (private)")))),n.createElement(Xt,{name:"provider-models",busy:N(I)},n.createElement("label",{htmlFor:"provider-model"},"Default model"),n.createElement(wp,{editable:!0,catalogKey:o.id,id:"provider-model",label:"Default model",value:o.model,entry:(ft=h.providerCatalogs)==null?void 0:ft[o.id],models:P,state:e,act:a,onChange:ee=>s({model:ee})})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!g||N(I),"data-operation-pending":N(I)||void 0,"aria-busy":N(I)||void 0,"data-action":"providers.models",onClick:()=>ye("providers.models",{refresh:!0})},n.createElement(Mt,null),N(I)?"Discovering models…":"Refresh models"),n.createElement("button",{className:"a-soft",disabled:!g||N(z),"data-operation-pending":N(z)||void 0,"aria-busy":N(z)||void 0,"data-action":"providers.test",onClick:()=>ye("providers.test")},n.createElement(Pt,null),N(z)?"Testing provider…":"Test connection"),n.createElement("button",{className:"a-soft",disabled:!g||U,"data-action":"providers.login",onClick:()=>ye("providers.login",{authMode:Ee,scope:o.scope})},n.createElement(Kk,null),g!=null&&g.accountConnected?"Reconnect account":"Provider sign-in")),n.createElement(nt,{phase:I==null?void 0:I.phase,message:N(I)?"Discovering available models…":(I==null?void 0:I.error)||((I==null?void 0:I.phase)==="ready"?`${P.length?`Found ${P.length} models. Choose one above.`:"This provider returned no models. Enter a model ID manually."}`:"")}),n.createElement(nt,{phase:z!=null&&z.error?"error":N(z)?"working":((Ce=h.test)==null?void 0:Ce.reachable)===!1?"error":"ready",message:N(z)?"Testing provider connection…":(z==null?void 0:z.error)||((z==null?void 0:z.phase)==="ready"||((gt=h.test)==null?void 0:gt.providerId)===o.id?((Et=h.test)==null?void 0:Et.reachable)!==!1?"Provider check passed":"Provider check failed":""),detail:!N(z)&&!(z!=null&&z.error)&&((vt=h.test)==null?void 0:vt.providerId)===o.id?`${h.test.modelCount??0} models returned. This checks the provider’s model catalog; no chat request was sent.`:void 0}),n.createElement("p",{className:"a-caption"},"Checks use saved provider settings. Save changes before testing."),n.createElement(Zw,{key:o.id,state:e,id:o.id,sessionId:t==null?void 0:t.id,act:a,disabled:!g||U}),o.module==="provider-openai-chatgpt"&&n.createElement(n.Fragment,null,n.createElement(Ep,{account:g==null?void 0:g.account}),n.createElement(Kw,{mode:Ee,onChange:ee=>i({authMode:ee}),disabled:U||["starting","waiting"].includes(Z)})),G&&(o.module==="provider-openai-chatgpt"?n.createElement(Au,{login:G,busy:U,onCancel:()=>ye("providers.loginCancel"),onRetry:()=>ye("providers.login",{authMode:Ee,scope:o.scope}),onEnablePlan:()=>ye("providers.login",{authMode:"chatgpt_plan",scope:o.scope,enablePlan:!0}),welcomeDismissed:o.welcomedLoginId===G.loginId,onWelcomeDismiss:()=>i({welcomedLoginId:G.loginId})}):n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"Provider sign-in · ",Z),(G.instructions||[]).map((ee,Re)=>n.createElement("p",{key:Re},ee)),D&&n.createElement("a",{href:D,target:"_blank",rel:"noopener noreferrer","data-action":"providers.login",className:"a-link"},"Open secure provider sign-in"),G.error&&n.createElement("p",{className:"a-danger"},G.error),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"providers.loginStatus",onClick:()=>a("providers.loginStatus",{id:o.id})},"Check sign-in status"),["starting","waiting"].includes(Z)&&n.createElement("button",{className:"a-soft","data-action":"providers.loginCancel",onClick:()=>a("providers.loginCancel",{id:o.id})},"Cancel sign-in")))),n.createElement(Xt,{name:"provider-options",busy:N(F),className:"a-provider-options"},n.createElement("h4",null,"Provider options"),N(F)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading options from this provider…"),(F==null?void 0:F.error)&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-danger"},F.error," You can still edit advanced configuration."),n.createElement("button",{className:"a-link","data-action":"providers.schema",onClick:()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}})},"Retry loading options")),M.map(ee=>{var Le;const Re=(ne==null?void 0:ne[ee.id])??"",ae="provider-option-"+ee.id;return n.createElement("div",{key:ee.id},n.createElement("label",{htmlFor:ae},ee.display_name||ee.id),(Le=ee.choices)!=null&&Le.length?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(ee.id,Oe.target.value)},n.createElement("option",{value:""},"Provider default",ee.default!=null?` (${ee.default})`:""),Re!==""&&!ee.choices.includes(String(Re))&&n.createElement("option",{value:String(Re)},String(Re)," (saved)"),ee.choices.map(Oe=>n.createElement("option",{key:Oe,value:Oe},Oe))):ee.field_type==="boolean"?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(ee.id,Oe.target.value===""?"":Oe.target.value==="true")},n.createElement("option",{value:""},"Provider default",ee.default!=null?` (${ee.default})`:""),n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):n.createElement("input",{id:ae,value:Re,"data-action":"view.update",placeholder:ee.default||"Provider default",onChange:Oe=>Y(ee.id,Oe.target.value)}),n.createElement("p",{className:"a-caption"},ee.prompt))}),_&&!M.length&&n.createElement("p",{className:"a-caption"},"This provider has no additional options for the selected model.")),g&&n.createElement(n.Fragment,null,n.createElement(Tu,{credential:g.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:N(q),onClick:()=>x("providers.list")},n.createElement(Mt,null),"Refresh credentials")),n.createElement("details",{className:"a-provider-access",open:o.accessOpen??!(g!=null&&g.credentialsConfigured)},n.createElement("summary",{"data-action":"view.update",onClick:ee=>{ee.preventDefault(),i({accessOpen:!(o.accessOpen??!(g!=null&&g.credentialsConfigured))})}},"Provider & access · ",g!=null&&g.accountConnected?"Account connected":g!=null&&g.credentialsConfigured?"Credentials configured":"Setup needed")," ",n.createElement("label",{htmlFor:"provider-preset"},"Provider"),n.createElement("select",{id:"provider-preset",value:Ic.some(ee=>ee.module===o.module)?o.module:"custom","data-action":"view.update",onChange:ee=>{const Re=ee.target.value==="custom"?"":ee.target.value;d(""),s({module:Re,envVar:"",credentialMode:["provider-chat-completions","provider-ollama","provider-vllm"].includes(Re)?"private":"environment",...!o.id&&Re?{id:Re.replace("provider-","")}:{}})}},n.createElement("option",{value:"custom"},"Custom provider module"),Ic.map(ee=>n.createElement("option",{key:ee.module,value:ee.module},ee.name))),!Ic.some(ee=>ee.module===o.module)&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-module"},"Provider module"),n.createElement("input",{id:"provider-module",value:o.module,"data-action":"view.update",onChange:ee=>s({module:ee.target.value}),placeholder:"provider-custom"})),X?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key-source"},"API key source"),n.createElement("select",{id:"provider-key-source",value:W,"data-action":"view.update",onChange:ee=>{d(""),s({credentialMode:ee.target.value})}},n.createElement("option",{value:"environment"},"Environment variable"),n.createElement("option",{value:"private"},"Private saved key")),W==="environment"?n.createElement(Xt,{name:"provider-credentials",busy:N(T)},n.createElement("label",{htmlFor:"provider-key-env"},"Environment variable name"),n.createElement("input",{id:"provider-key-env",value:O,"data-action":"view.update",onChange:ee=>s({envVar:ee.target.value}),placeholder:(C==null?void 0:C.defaultEnvVar)||"MY_PROVIDER_API_KEY",spellCheck:!1,autoComplete:"off"}),(C==null?void 0:C.defaultEnvVar)&&n.createElement("p",{className:"a-caption"},"Default: ",n.createElement("code",null,C.defaultEnvVar),!!((at=C.alternatives)!=null&&at.length)&&n.createElement(n.Fragment,null," · Also supported: ",C.alternatives.join(", "))),n.createElement(nt,{phase:N(T)?"working":T!=null&&T.error||A&&!(C!=null&&C.available)?"error":"ready",message:N(T)?"Checking environment variable…":(T==null?void 0:T.error)||(A||!o.envVar&&C?C!=null&&C.available?"Found — this variable will supply the key.":"Not found in the app environment. Set it before launching the app, then restart.":""),detail:A!=null&&A.checkedAt&&!N(T)?`Checked ${new Date(A.checkedAt*1e3).toLocaleTimeString()}`:void 0}),n.createElement("button",{className:"a-link","data-action":"providers.credentials",disabled:N(T)||!o.module||!!o.envVar&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(o.envVar),onClick:()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}})},N(T)?"Checking…":"Check variable"),n.createElement("p",{className:"a-caption"},"Reads the backend’s launch environment and private key file. Only the variable name is saved. Key previews show only the beginning and end of longer keys.")):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key"},"API key"),n.createElement("input",{id:"provider-key",type:"password",autoComplete:"new-password","data-private":"true","data-action":"providers.save",value:u,onChange:ee=>{d(ee.target.value),i({dirty:!0})},placeholder:g!=null&&g.credentialsConfigured?"Leave blank to keep current credentials":"Stored privately on this computer"}),n.createElement("p",{className:"a-caption"},"The full key stays private on this computer; only a masked preview is shown."))):n.createElement("p",{className:"a-caption"},"This provider uses account sign-in rather than an API key.")),n.createElement("button",{className:"a-link","aria-expanded":o.advanced,"data-action":"view.update",onClick:()=>i({advanced:!o.advanced})},o.advanced?"Hide":"Show"," advanced configuration"),o.advanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-source"},"Module source (optional)"),n.createElement(Ma,{id:"provider-source",value:o.source,onChange:ee=>s({source:ee}),state:e,act:a,placeholder:"git+https://… or a local module folder"}),n.createElement("label",{htmlFor:"provider-config"},"Provider configuration (JSON)"),n.createElement("textarea",{id:"provider-config",className:"a-json-editor",value:p,spellCheck:!1,"data-private":"true","data-action":"providers.save",onChange:ee=>{const Re=ee.target.value;m(Re);try{tr(Re),s({config:Re})}catch{}}})),H&&n.createElement("p",{className:"a-danger"},H),["providers.save","providers.remove"].map(ee=>{const Re=w(ee);return Re&&n.createElement("p",{className:Re.error?"a-danger":"a-caption",role:"status",key:ee},Re.error||(N(Re)?"Saving provider settings…":ee==="providers.save"?"Provider saved. New conversations will use these settings.":"Provider removed."))}),n.createElement(Rn,{active:!!o.detailOpen},n.createElement("button",{className:"a-primary",disabled:!o.module.trim()||!!H||U||X&&W==="environment"&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(O),"data-operation-pending":N(ue)||void 0,"aria-busy":N(ue)||void 0,"data-action":"providers.save",onClick:se},n.createElement(Pt,null),"Save provider"),n.createElement("button",{className:"a-soft a-danger",disabled:!g||U,"data-operation-pending":N(w("providers.remove"))||void 0,"aria-busy":N(w("providers.remove"))||void 0,"data-action":"providers.remove",onClick:()=>x("providers.remove",{id:o.id,scope:o.scope})},n.createElement(ea,null),"Remove")),t&&g&&n.createElement("div",{className:"a-provider-session"},n.createElement("button",{className:"a-soft",disabled:!o.model||me||U,"data-action":"runtime.control",onClick:()=>a("runtime.control",{sessionId:t.id,operation:"provider.select",args:{instance:o.id,model:o.model,...ne!=null&&ne.reasoning_effort?{effort:ne.reasoning_effort}:{}}})},"Use model in this conversation"),n.createElement("p",{className:"a-caption"},"Current-session selection requires the provider to be mounted by its bundle.")))))}const yD={open:!1,tab:"modules",scope:"global",section:"tools",id:"",module:"",source:"",config:"{}",enabled:!0,sourceKind:"module",sourceName:"",sourceUri:"",sourceSection:"tools",behavioral:!1,behaviorResultsExpanded:!1},Df=[["tools","Tools"],["hooks","Hooks"],["providers","Providers"],["orchestrator","Orchestrator"],["context","Context manager"]];function ED({state:e,act:t}){var O,k,T,I,F,z,q,W,X,U,_,P,G,Z,D,ne,H;const a=(O=e.view)==null?void 0:O.registryDraft,[r,o]=v.useState({...yD,...a});v.useEffect(()=>{a&&o(j=>({...j,...a}))},[a]);const i=j=>{const ie={...r,...j};o(ie),t("view.update",{patch:{registryDraft:ie}})},[s,l]=v.useState(r.config);v.useEffect(()=>{l(r.config)},[r.config]);const c=e.registry||{},u=((k=e.management)==null?void 0:k.phase)==="working",d=["queued","working"].includes((I=(T=e.actionStatus)==null?void 0:T["modules.validate"])==null?void 0:I.phase)&&((q=(z=(F=e.actionStatus)==null?void 0:F["modules.validate"])==null?void 0:z.target)==null?void 0:q.id)===r.id,p=c.modules||[],m=c.sources||[],h=((W=c.validation)==null?void 0:W.id)===r.id?c.validation:null,[f,g]=xa(e,t,"registry-modules",p,j=>[j.id,j.module,j.section,j.source],"Filter registered modules"),[E,y]=xa(e,t,"registry-sources",m,j=>[j.name,j.kind,j.source],"Filter source overrides");let b={},S="";try{b=tr(s)}catch(j){S=j.message}const w=((X=c.sourceValidation)==null?void 0:X.kind)===r.sourceKind&&((U=c.sourceValidation)==null?void 0:U.name)===r.sourceName.trim()&&((_=c.sourceValidation)==null?void 0:_.submittedSource)===r.sourceUri.trim()&&((P=c.sourceValidation)==null?void 0:P.scope)===r.scope&&((G=c.sourceValidation)==null?void 0:G.section)===r.sourceSection?c.sourceValidation:null,N={kind:r.sourceKind,name:r.sourceName.trim(),source:r.sourceUri.trim(),scope:r.scope,...r.sourceKind==="module"?{section:r.sourceSection}:{}},x=["sources.validate","sources.save"].some(j=>{var ie,Ee;return["queued","working"].includes((Ee=(ie=e.actionStatus)==null?void 0:ie[j])==null?void 0:Ee.phase)}),A=j=>{const ie=JSON.stringify(j.config||{},null,2);l(ie),i({section:j.section,id:j.id,module:j.module,source:j.source||"",config:ie,enabled:j.enabled!==!1})},C=()=>t(r.tab==="modules"?"modules.list":"sources.list",{scope:r.scope});return n.createElement(Pa,{id:"registries",title:"Advanced module & source registries",summary:"Register modules and override their sources",state:e,act:t},n.createElement("section",{className:"a-settings-section a-registry","data-part":"registries"},n.createElement("div",{className:"a-maintenance-content"},n.createElement("p",null,"Register individual modules or override where named modules and bundles are loaded from. Most setups can use community bundles above."),n.createElement("nav",{className:"a-settings-nav","aria-label":"Registry sections"},[["modules","Modules"],["sources","Source overrides"]].map(([j,ie])=>n.createElement("button",{key:j,className:r.tab===j?"selected":"","data-action":"view.update",onClick:()=>i({tab:j})},ie))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-scope"},"Configuration scope"),n.createElement("select",{id:"registry-scope",value:r.scope,"data-action":"view.update",onChange:j=>i({scope:j.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace (private)"))),n.createElement("button",{className:"a-soft",disabled:u,"data-action":r.tab==="modules"?"modules.list":"sources.list",onClick:C},n.createElement(Mt,null),"Load registry")),r.tab==="modules"?n.createElement(n.Fragment,null,g,n.createElement("div",{className:"a-provider-list"},f.map(j=>n.createElement("button",{key:j.section+":"+j.id,className:r.id===j.id&&r.section===j.section?"selected":"","data-action":"view.update",onClick:()=>A(j)},n.createElement("strong",null,j.id),n.createElement("small",null,j.section," · ",j.enabled===!1?"disabled":"enabled"," · ",j.scope||r.scope))),n.createElement("button",{"data-action":"view.update",onClick:()=>{l("{}"),i({id:"",module:"",source:"",config:"{}",enabled:!0})}},n.createElement(Ln,null),"Add module")),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-section"},"Module type"),n.createElement("select",{id:"registry-section",value:r.section,"data-action":"view.update",onChange:j=>i({section:j.target.value})},Df.map(([j,ie])=>n.createElement("option",{key:j,value:j},ie)))),n.createElement("div",null,n.createElement("label",{htmlFor:"registry-id"},"Instance name (optional)"),n.createElement("input",{id:"registry-id",value:r.id,"data-action":"view.update",onChange:j=>i({id:j.target.value})}))),n.createElement("label",{htmlFor:"registry-module"},"Module name"),n.createElement("input",{id:"registry-module",value:r.module,"data-action":"view.update",onChange:j=>i({module:j.target.value}),placeholder:"tool-example"}),n.createElement("label",{htmlFor:"registry-source"},"Source (optional)"),n.createElement(Ma,{id:"registry-source",state:e,act:t,value:r.source,onChange:j=>i({source:j}),placeholder:"git+https://… or /local/path"}),n.createElement("label",{htmlFor:"registry-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"registry-config",className:"a-json-editor",value:s,"data-action":"modules.save","data-private":"true",spellCheck:!1,onChange:j=>{const ie=j.target.value;l(ie);try{tr(ie),i({config:ie})}catch{}}}),S&&n.createElement("p",{className:"a-danger"},S),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.enabled,"data-action":"view.update",onChange:j=>i({enabled:j.target.checked})}),"Enabled"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.behavioral,"data-action":"view.update",onChange:j=>i({behavioral:j.target.checked})}),"Also run module behavior tests"),n.createElement("p",{className:"a-caption"},"Behavior tests run the module’s code in an isolated process."),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||!!S||!r.module.trim(),"data-action":"modules.save",onClick:()=>t("modules.save",{section:r.section,module:r.module.trim(),...r.id?{id:r.id}:{},...r.source?{source:r.source}:{},config:b,enabled:r.enabled,scope:r.scope})},n.createElement(Pt,null),"Save module")),n.createElement("button",{className:"a-soft",disabled:u||!r.id,"data-operation-pending":d||void 0,"aria-busy":d||void 0,"data-action":"modules.validate",onClick:()=>t("modules.validate",{section:r.section,id:r.id,scope:r.scope,behavioral:r.behavioral})},"Validate core contract"),n.createElement("button",{className:"a-soft a-danger",disabled:u||!r.id,"data-action":"modules.remove",onClick:()=>t("modules.remove",{section:r.section,id:r.id,scope:r.scope})},n.createElement(ea,null),"Remove")),n.createElement(Xt,{name:"module-validation",busy:d},((ne=(D=(Z=e.actionStatus)==null?void 0:Z["modules.validate"])==null?void 0:D.target)==null?void 0:ne.id)===r.id&&n.createElement(nt,{phase:e.actionStatus["modules.validate"].phase==="ready"&&(h==null?void 0:h.passed)===!1?"error":e.actionStatus["modules.validate"].phase,message:e.actionStatus["modules.validate"].error||(e.actionStatus["modules.validate"].phase==="ready"?h!=null&&h.passed?"Module validation passed":"Module validation failed":"Validating module…")}),h&&n.createElement("div",{className:"a-selection-card"},n.createElement("strong",null,h.id,": ",h.passed?"validation passed":"validation needs attention"),n.createElement("ul",{className:"a-catalog-list"},(h.checks||[]).map((j,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:j.passed?"ready":"error",message:j.name,detail:j.message})))),h.behavioral&&n.createElement("div",null,n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.behaviorResultsExpanded,onClick:()=>i({behaviorResultsExpanded:!r.behaviorResultsExpanded})},h.behavioral.passed?"Behavior tests passed":"Behavior tests need attention"," · ",(h.behavioral.tests||[]).length," tests · ",r.behaviorResultsExpanded?"Hide":"Show"," results"),r.behaviorResultsExpanded&&n.createElement("ul",{className:"a-catalog-list"},(h.behavioral.tests||[]).map((j,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:j.status==="failed"?"error":j.status==="skipped"?"neutral":"ready",message:j.name,detail:j.status})))))))):n.createElement(n.Fragment,null,y,n.createElement("div",{className:"a-routing-profiles"},E.map(j=>n.createElement("div",{key:j.kind+":"+j.name},n.createElement("span",null,n.createElement("strong",null,j.name),n.createElement("small",null,j.kind," · ",j.source)),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i({sourceKind:j.kind,sourceName:j.name,sourceUri:j.source})},"Edit"),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove source ${j.name}`,disabled:u,"data-action":"sources.remove",onClick:()=>t("sources.remove",{kind:j.kind,name:j.name,scope:r.scope})},n.createElement(ea,null))))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"source-kind"},"Source type"),n.createElement("select",{id:"source-kind",value:r.sourceKind,"data-action":"view.update",onChange:j=>i({sourceKind:j.target.value})},n.createElement("option",{value:"module"},"Module"),n.createElement("option",{value:"bundle"},"Bundle"))),n.createElement("div",null,n.createElement("label",{htmlFor:"source-name"},"Registered name"),n.createElement("input",{id:"source-name",value:r.sourceName,"data-action":"view.update",onChange:j=>i({sourceName:j.target.value}),placeholder:"tool-example"}))),n.createElement("label",{htmlFor:"source-uri"},"Repository URL or local path"),n.createElement(Ma,{id:"source-uri",state:e,act:t,value:r.sourceUri,onChange:j=>i({sourceUri:j}),placeholder:"git+https://… or /local/path"}),r.sourceKind==="module"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"source-section"},"Module type to validate"),n.createElement("select",{id:"source-section",value:r.sourceSection,"data-action":"view.update",onChange:j=>i({sourceSection:j.target.value})},Df.map(([j,ie])=>n.createElement("option",{key:j,value:j},ie))),n.createElement("p",{className:"a-caption"},"Check the candidate before replacing the saved source. Validation checks the module contract; it does not start a conversation.")),n.createElement("div",{className:"a-dialog-actions"},r.sourceKind==="module"&&n.createElement("button",{className:"a-soft",disabled:u||x||!N.name||!N.source,"data-action":"sources.validate",onClick:()=>t("sources.validate",N)},"Validate without saving"),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||x||!N.name||!N.source,"data-action":"sources.save",onClick:()=>t("sources.save",{...N,...r.sourceKind==="module"?{validate:!0}:{}})},n.createElement(Pt,null),r.sourceKind==="module"?"Validate & save source":"Save source override"))),n.createElement(Xt,{name:"source-validation",busy:x},x&&n.createElement(nt,{phase:"working",message:"Validating candidate source…"}),!x&&w&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:w.passed?"ready":"error",message:w.saved?"Candidate validated and saved":w.passed?"Candidate validated; nothing saved":"Validation failed; saved source unchanged"}),(H=w.checks)==null?void 0:H.map((j,ie)=>n.createElement(nt,{key:ie,phase:j.passed?"ready":"error",message:j.name,detail:j.message}))))),n.createElement("p",{className:"a-caption"},"Saved configuration applies when sessions are prepared again. Use environment references for credentials; configure provider keys under Setup."))))}function Sp(e){var a;const t=[];for(const r of["providers","tools","hooks"])for(const[o,i]of(Array.isArray(e==null?void 0:e[r])?e[r]:[]).entries())t.push({key:`${r}:${o}`,section:r,index:o,module:i.module||"Unnamed module",id:i.instance_id||i.id||i.module,enabled:i.enabled!==!1,source:i.source,config:i.config||{},entry:i});for(const r of["orchestrator","context"]){const o=(a=e==null?void 0:e.session)==null?void 0:a[r];o&&t.push({key:`session:${r}`,section:r,index:r,module:typeof o=="string"?o:o.module,id:o.id||o.module||o,enabled:o.enabled!==!1,source:o.source,config:o.config||{},entry:o,required:!0})}return t}function Ff(e,t,a){const r=structuredClone(e),o=Sp(r).find(l=>l.key===t);if(!o)throw new Error("Select a module to edit.");const s={...typeof o.entry=="string"?{module:o.entry}:o.entry,...a};if(o.required){if(a.enabled===!1)throw new Error("The session requires an orchestrator and a context module.");r.session[o.section]=s}else r[o.section][o.index]=s;return r}function wD(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Configuration must be a JSON object.");return t}const ur=e=>JSON.stringify(e,null,2),kD={source:"",selectedUri:"",alias:"",role:"behavior",exportName:"my-amplifier",exportDescription:""};function Xw(e,t,a,r){const[o,i]=v.useState({...t,...e});v.useEffect(()=>{e&&i(l=>({...l,...e}))},[e]);function s(l){const c={...o,...l};i(c),r("view.update",{patch:{[a]:c}})}return[o,s]}function xD({state:e,session:t,act:a}){var x,A,C,O;const[r,o]=Xw((x=e.view)==null?void 0:x.bundleManager,kD,"bundleManager",a),i=Array.isArray(e.bundles)?e.bundles:((A=e.bundles)==null?void 0:A.entries)||[],[s,l]=v.useState({});v.useEffect(()=>{l(k=>Object.fromEntries(Object.entries(k).filter(([T,I])=>i.some(F=>F.id===T&&F.enabled!==I))))},[e.bundles]);const c=(C=e.actionStatus)==null?void 0:C["bundles.toggle"];v.useEffect(()=>{(c==null?void 0:c.phase)==="error"&&l(k=>{var I;const T={...k};return delete T[(I=c.target)==null?void 0:I.id],T})},[c]);const u=async(k,T)=>{l(I=>({...I,[k]:T}));try{if(!await a("bundles.toggle",{id:k,enabled:T}))throw new Error("Request not sent")}catch{l(I=>{const F={...I};return delete F[k],F})}},d=i.find(k=>k.id===r.entryId)||i[0],p=i.filter(k=>k.role!=="standalone"&&k.enabled!==!1),m=(O=e.actionStatus)==null?void 0:O["bundles.reorder"];v.useEffect(()=>{(m==null?void 0:m.phase)==="ready"&&r.order&&o({order:null})},[m==null?void 0:m.commandId,m==null?void 0:m.phase]);const h=e.bundleDiscovery||{},f=h.candidates||[],[g,E]=xa(e,a,"bundle-discovery",f,k=>[k.display_name,k.name,k.path,k.uri,k.kind,k.description],"Filter discovered bundles"),[y,b]=xa(e,a,"app-bundles",i,k=>[k.name,k.uri,k.role],"Filter app bundles"),S=f.find(k=>k.uri===r.selectedUri),w=e.management||{},N=Object.entries(e.actionStatus||{}).some(([k,T])=>k.startsWith("bundle")&&["queued","running","pending","working","discovering","applying"].includes(T.phase));return v.useEffect(()=>{a("bundles.list",{})},[]),n.createElement("div",{className:"a-bundle-pane"},n.createElement(Pa,{id:"add-bundles",title:"Add capabilities",summary:"Browse community bundle repositories",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(qr,null),n.createElement("div",null,n.createElement("h3",null,"Build your Amplifier"),n.createElement("p",null,"Add capabilities from community repositories, then shape the modules they compose into."))),w.error&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,w.error)),N&&n.createElement("div",{className:"a-management-status",role:"status"},n.createElement(Mt,{className:"a-progress-spinner"}),w.detail||"Updating your configuration…"),!N&&w.detail&&n.createElement("p",{className:"a-caption",role:"status"},w.detail),n.createElement("label",{htmlFor:"bundle-source"},"Repository or bundle URL"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"bundle-source",type:"url",value:r.source,placeholder:"https://github.com/owner/amplifier-bundle","data-action":"view.update",onChange:k=>o({source:k.target.value})}),n.createElement("button",{className:"a-primary",disabled:!r.source.trim()||N,"data-action":"bundle.discover",onClick:()=>a("bundle.discover",{url:r.source.trim()})},n.createElement(To,null),"Browse")),n.createElement("p",{className:"a-caption"},"Browse a repository’s YAML and Markdown bundles before choosing what to add."),f.length>0&&n.createElement("div",{className:"a-discovery","aria-label":"Discovered bundles"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,f.length," ",f.length===1?"bundle found":"bundles found"),h.revision&&n.createElement("code",null,h.revision.slice(0,9))),E,n.createElement("div",{className:"a-candidates"},g.map(k=>n.createElement("label",{className:`a-candidate ${(S==null?void 0:S.uri)===k.uri?"selected":""}`,key:k.uri},n.createElement("input",{type:"radio",name:"bundle-candidate",checked:(S==null?void 0:S.uri)===k.uri,"data-action":"view.update",onChange:()=>o({selectedUri:k.uri,alias:k.name||"",role:k.kind==="standalone"?"standalone":"behavior"})}),n.createElement("span",null,n.createElement("strong",null,k.display_name||k.name||k.path),n.createElement("small",null,k.path||k.uri),k.description&&n.createElement("p",null,k.description)),n.createElement("span",{className:"a-kind-tag"},k.kind||"bundle")))),n.createElement("p",{className:"a-caption"},"Type suggestions are based on file contents. Choose how you want to use the bundle below.")),(S||r.selectedUri)&&n.createElement("div",{className:"a-selection-card"},n.createElement("label",{htmlFor:"bundle-add-role"},"Use this bundle as"),n.createElement("select",{id:"bundle-add-role",value:r.role,"data-action":"view.update",onChange:k=>o({role:k.target.value})},n.createElement("option",{value:"behavior"},"An app capability — compose into sessions"),n.createElement("option",{value:"standalone"},"A standalone bundle — register an alias")),n.createElement("label",{htmlFor:"bundle-alias"},r.role==="standalone"?"Bundle alias":"Display name"),n.createElement("input",{id:"bundle-alias",value:r.alias,"data-action":"view.update",onChange:k=>o({alias:k.target.value}),placeholder:"my-capabilities"}),n.createElement("p",{className:"a-caption a-wrap"},r.selectedUri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:N||!r.selectedUri||r.role==="standalone"&&!r.alias.trim(),"data-action":"bundles.add",onClick:()=>a("bundles.add",{uri:r.selectedUri,...S!=null&&S.reviewId?{reviewId:S.reviewId}:{},name:r.alias.trim()||void 0,role:r.role})},n.createElement(Ln,null),r.role==="standalone"?"Register bundle":"Add capability"))))),n.createElement(Pa,{id:"app-bundles",title:"App bundles",summary:`${i.length} configured · inspect capabilities and aliases`,state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Your app bundles"),n.createElement("p",null,"Capabilities extend your conversations. Standalone aliases are available when starting a conversation.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh app bundles","data-action":"bundles.list",onClick:()=>a("bundles.list")},n.createElement(Mt,null))),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,i.length," configured · ",p.length," enabled capabilities"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:p.length<2||N,onClick:()=>o({orderOpen:!0,order:r.order||{ids:p.map(k=>k.id),expectedIds:p.map(k=>k.id)}})},"Composition order")),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:"Bundle composition order",description:"Capabilities compose from top to bottom. Later settings can override earlier ones. Disabled entries and standalone aliases are outside this chain.",items:p.map(k=>({id:k.id,label:k.name||k.uri,description:"App capability"})),ids:r.order.ids,onChange:k=>o({order:{...r.order,ids:k}}),onCancel:()=>o({order:null}),busy:["queued","working"].includes(m==null?void 0:m.phase),error:m==null?void 0:m.error,action:"bundles.reorder",onSave:()=>a("bundles.reorder",r.order)}):i.length?n.createElement(Co,{label:"bundles",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,b,y.map(k=>n.createElement(Va,{key:k.id,id:k.id,label:k.name||k.uri,description:k.role==="standalone"?"Standalone alias":"App capability",checked:s[k.id]??k.enabled!==!1,disabled:N,checkLabel:`Enable ${k.name||k.uri}`,checkAction:"bundles.toggle",onCheck:T=>u(k.id,T),selected:k.id===(d==null?void 0:d.id),onSelect:()=>o({entryId:k.id,detailOpen:!0})})))},d&&n.createElement(n.Fragment,null,n.createElement("h4",null,d.name||"Bundle"),n.createElement("p",null,d.role==="standalone"?"Standalone alias · choose it when starting a conversation.":"App capability · composes into prepared conversations."),n.createElement("p",{className:"a-caption"},d.enabled===!1?"Disabled":d.role==="standalone"?"Available as "+d.name:"Position "+(p.findIndex(k=>k.id===d.id)+1)+" of "+p.length+" in composition"),n.createElement("h5",null,"Source"),n.createElement("p",{className:"a-caption a-wrap"},d.uri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft a-danger","aria-label":`Remove ${d.name||"bundle"}`,disabled:N,"data-action":"bundles.remove",onClick:()=>a("bundles.remove",{id:d.id})},n.createElement(ea,null),"Remove bundle")),n.createElement("p",{className:"a-caption"},"Changes apply to future conversation preparation. Inspect conversation modules to change a loaded session."))):n.createElement("div",{className:"a-settings-empty"},n.createElement(ax,null),n.createElement("span",null,"Your app has no additional bundles yet. Browse a repository to add one.")))),n.createElement(Pa,{id:"loaded-modules",title:"Loaded session modules",summary:t?`Inspect and edit the running mount plan for ${t.title}`:"Select a conversation to inspect its mount plan",state:e,act:a},n.createElement(SD,{state:e,session:t,act:a})),n.createElement(ED,{state:e,act:a}),n.createElement(Pa,{id:"share-bundle",title:"Save and share",summary:"Export this session as a reusable bundle",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(wa,null),n.createElement("div",null,n.createElement("h3",null,"Share your setup"),n.createElement("p",null,"Export the current session’s bundle and applied configuration for others to load with Amplifier Foundation."))),n.createElement("label",{htmlFor:"bundle-export-name"},"Bundle name"),n.createElement("input",{id:"bundle-export-name",value:r.exportName,"data-action":"view.update",onChange:k=>o({exportName:k.target.value})}),n.createElement("label",{htmlFor:"bundle-export-description"},"Description"),n.createElement("input",{id:"bundle-export-description",value:r.exportDescription,"data-action":"view.update",onChange:k=>o({exportDescription:k.target.value})}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!t||N||!r.exportName.trim(),"data-action":"bundle.export",onClick:()=>a("bundle.export",{sessionId:t.id,name:r.exportName.trim(),description:r.exportDescription})},n.createElement(wa,null),"Export app bundle")),n.createElement("p",{className:"a-caption"},"Exports include bundle references and configuration. Provider credentials stay on this machine."))))}function SD({state:e,session:t,act:a}){var w,N,x,A;const[r,o]=Xw((w=e.view)==null?void 0:w.moduleEditor,{sessionId:"",text:"",selectedKey:"",configText:"",name:"my-amplifier",description:"",showRaw:!1,configAdvanced:!1},"moduleEditor",a),i=(t==null?void 0:t.configuration)||(((N=e.configuration)==null?void 0:N.sessionId)===(t==null?void 0:t.id)?e.configuration:null),s=i==null?void 0:i.plan;e.management;const l=(x=e.actionStatus)==null?void 0:x["configuration.apply"],c=(A=e.actionStatus)==null?void 0:A["configuration.inspect"],u=!!(t!=null&&t.configurationBusy)||["queued","working"].includes(c==null?void 0:c.phase)||["queued","working"].includes(l==null?void 0:l.phase),d=!!t&&["working","running","busy","starting","stopping"].includes(t.status);v.useEffect(()=>{t&&a("configuration.inspect",{id:t.id})},[t==null?void 0:t.id]),v.useEffect(()=>{var C,O,k;s&&t&&(r.sessionId!==t.id||!r.text||((C=t.pendingConfiguration)==null?void 0:C.phase)==="ready"&&r.appliedAt!==((O=t.pendingConfiguration)==null?void 0:O.appliedAt))&&o({sessionId:t.id,text:ur(s),selectedKey:"",configText:"",appliedAt:(k=t.pendingConfiguration)==null?void 0:k.appliedAt})},[t==null?void 0:t.id,s]);let p=null,m="";try{r.sessionId===(t==null?void 0:t.id)&&r.text&&(p=wD(r.text))}catch(C){m=C.message}const h=Sp(p),f=h.find(C=>C.key===r.selectedKey),[g,E]=xa(e,a,"loaded-modules",h,C=>[C.id,C.module,C.section,C.source],"Filter loaded modules"),y=!!p&&ur(p)!==ur(s);function b(C,O){try{const k=Ff(p,C,O);o({text:ur(k),...C===r.selectedKey&&O.config?{configText:ur(O.config)}:{}})}catch(k){o({parseError:k.message})}}function S(C){o({selectedKey:C.key,detailOpen:!0,configText:ur(C.config),parseError:""})}return n.createElement("section",{className:"a-settings-section a-module-settings"},n.createElement("div",{className:"a-settings-heading"},n.createElement(Os,null),n.createElement("div",null,n.createElement("h3",null,"Running mount plan"),n.createElement("p",null,t?`Inspect the loaded configuration behind “${t.title}”.`:"Start or select a conversation to inspect its composed configuration."))),t&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:c==null?void 0:c.phase,message:(c==null?void 0:c.error)||(["queued","working"].includes(c==null?void 0:c.phase)?"Reading the loaded AmplifierSession mount plan…":"")}),n.createElement("div",{className:"a-settings-row"},n.createElement("span",{className:"a-caption a-wrap"},t.bundle),n.createElement("button",{className:"a-soft",disabled:u,"data-action":"configuration.inspect",onClick:()=>a("configuration.inspect",{id:t.id})},n.createElement(Mt,null),s?"Refresh configuration":"Load configuration")),s&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"The fully composed plan includes your root bundle and app capabilities. Edits below apply to this conversation’s mounted configuration. Apply changes to reload modules and preserve the conversation history."),n.createElement(Co,{label:"modules",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,E,g.map(C=>n.createElement(Va,{key:C.key,id:C.key,label:C.id,description:C.section+(C.required?" · required":""),checked:C.enabled,disabled:C.required,checkLabel:`Enable ${C.id}`,onCheck:O=>b(C.key,{enabled:O}),selected:C.key===r.selectedKey,onSelect:()=>S(C)})))},f?n.createElement(n.Fragment,null,n.createElement("h4",null,f.module),f.source&&n.createElement("p",{className:"a-caption a-wrap"},f.source),n.createElement("div",{className:"a-module-fields"},Object.entries(f.config).map(([C,O])=>{const k=/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(C),T="module-field-"+C;return n.createElement("div",{key:C},n.createElement("label",{htmlFor:T},C.replaceAll("_"," ")),k?n.createElement("p",{className:"a-caption"},"Credential preserved. Manage keys in Model providers."):typeof O=="boolean"?n.createElement("select",{id:T,value:String(O),"data-action":"view.update",onChange:I=>b(f.key,{config:{...f.config,[C]:I.target.value==="true"}})},n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):O===null||typeof O=="object"?n.createElement("p",{className:"a-caption"},Array.isArray(O)?`${O.length} items`:"Structured value"," · edit in advanced configuration below."):n.createElement("input",{id:T,type:typeof O=="number"?"number":"text",value:O,"data-action":"view.update",onChange:I=>{typeof O=="number"&&!I.target.value||b(f.key,{config:{...f.config,[C]:typeof O=="number"?Number(I.target.value):I.target.value}})}}))})),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.configAdvanced,onClick:()=>o({configAdvanced:!r.configAdvanced})},r.configAdvanced?"Hide":"Edit"," advanced configuration"),r.configAdvanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"module-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"module-config",className:"a-json-editor",value:r.configText,spellCheck:!1,"data-action":"view.update",onChange:C=>{try{tr(C.target.value),o({configText:C.target.value,parseError:""})}catch(O){O.message.includes("private API key")?o({parseError:O.message}):o({configText:C.target.value,parseError:""})}}}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const C=tr(r.configText);o({text:ur(Ff(p,f.key,{config:C})),parseError:""})}catch(C){o({parseError:C.message})}}},n.createElement(Pt,null),"Update draft"))):n.createElement("div",{className:"a-settings-empty"},n.createElement(Os,null),n.createElement("span",null,"Select a module to edit its configuration."))),(m||r.parseError)&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,m||r.parseError)),n.createElement("div",{className:"a-module-plan-options"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>o({showRaw:!r.showRaw})},r.showRaw?"Hide":"Edit"," full configuration JSON"),r.showRaw&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"full-module-plan"},"Full composed plan"),n.createElement("textarea",{id:"full-module-plan",className:"a-json-editor a-full-plan",spellCheck:!1,value:r.text,"data-action":"view.update",onChange:C=>o({text:C.target.value,parseError:""})})),d&&n.createElement("p",{className:"a-caption"},"Work is active. Apply when idle will queue these changes until this turn and its worker lanes finish.")),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:!p||!!m||u||!y,"data-action":"configuration.apply",onClick:()=>a("configuration.apply",{id:t.id,config:p,whenIdle:!0})},n.createElement(Pt,null),d?"Apply when idle":"Apply to loaded session"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:!y&&!r.parseError&&!m,onClick:()=>o({text:ur(s),selectedKey:"",configText:"",parseError:""})},"Revert draft"),n.createElement("span",{className:"a-caption"},y?"Unapplied changes":"Saved configuration")),t.pendingConfiguration&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:t.pendingConfiguration.phase==="queued"?"pending":t.pendingConfiguration.phase==="applying"?"working":t.pendingConfiguration.phase,message:t.pendingConfiguration.error||t.pendingConfiguration.detail||"Applying mount-plan changes…"}),t.pendingConfiguration.phase==="queued"&&n.createElement("button",{className:"a-soft","data-action":"configuration.cancel",onClick:()=>a("configuration.cancel",{id:t.id})},"Cancel queued changes")),n.createElement("div",{className:"a-custom-bundle"},n.createElement("h4",null,"Keep this as a custom bundle"),n.createElement("p",null,"Save the applied configuration under your own name. Use Export below to share it. Apply any pending changes first."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-name"},"Name"),n.createElement("input",{id:"custom-bundle-name",value:r.name,"data-action":"view.update",onChange:C=>o({name:C.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-description"},"Description"),n.createElement("input",{id:"custom-bundle-description",value:r.description,"data-action":"view.update",onChange:C=>o({description:C.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!p||!!m||y||!r.name.trim()||u,"data-action":"bundle.save",onClick:()=>a("bundle.save",{sessionId:t.id,name:r.name.trim(),description:r.description})},n.createElement(wa,null),"Save custom bundle"))))))}function ek(e,t){const[a,r]=v.useState({visibility:"hidden"});return v.useLayoutEffect(()=>{var c,u;if(!e)return;const o=(c=t.current)==null?void 0:c.querySelector(".a-compact-popover"),i=(u=t.current)==null?void 0:u.querySelector("button");if(!o||!i)return;const s=()=>{const d=i.getBoundingClientRect(),p=Math.min(340,window.innerWidth-24),m=o.getBoundingClientRect().height;r({width:p,left:Math.max(12,Math.min(d.left,window.innerWidth-p-12)),top:Math.max(12,Math.min(d.top-m-10,window.innerHeight-m-12)),visibility:"visible"})};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{l.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[e,t]),a}const _i=(e,t)=>{var a,r;return((r=(a=e.registeredBundles)==null?void 0:a.find(o=>o.value===t))==null?void 0:r.label)||t||"Bundle"},Cp={};function tk(e){return e.compact?n.createElement(CD,{...e}):n.createElement(ND,{...e})}function CD({state:e,session:t,act:a,working:r}){var A,C,O,k,T;const o=Ja(e),i=Ag(e),s=((A=e.view)==null?void 0:A.composerBundle)||Cp,[l,c]=v.useState(s),[u,d]=v.useState(!1),[p,m]=v.useState(""),h=v.useRef(!1);v.useEffect(()=>c(s),[s]);const f=I=>{const F={...l,...I};c(F),a("view.update",{patch:{composerBundle:F}})},g=(t==null?void 0:t.bundle)||o.bundle||i.bundle||(((C=e.bundleDefaults)==null?void 0:C.workspacePath)===o.workspace?e.bundleDefaults.effective:""),E=l.open&&l.sessionId===((t==null?void 0:t.id)||null),y=v.useRef(null),b=ek(E,y);il(E,y,()=>f({open:!1})),v.useEffect(()=>{var I;(I=e.registeredBundles)!=null&&I.length||a("bundles.list",{})},[]);const S=e.registeredBundles||[],w=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1;async function N(I,F=!1){if(!h.current){h.current=!0,d(!0),m(""),f({bundle:I});try{await a(t?"bundle.switch":"view.update",t?{sessionId:t.id,bundle:I,resetModel:F}:{patch:{newSessionDraft:{...o,bundle:I}}})}catch(z){m(z.message)}finally{h.current=!1,d(!1)}}}const x=(t==null?void 0:t.bundlePreview)&&t.bundlePreview.bundle===l.bundle&&t.bundlePreview.modelCompatible===!1&&((O=t==null?void 0:t.bundleChange)==null?void 0:O.phase)!=="ready";return n.createElement("div",{className:"a-model-control a-bundle-control",ref:y},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle",disabled:!!w,"aria-expanded":!!E,"data-action":"view.update",onClick:()=>f({open:!E,sessionId:(t==null?void 0:t.id)||null,bundle:g})},n.createElement(qr,null),n.createElement("span",null,g?_i(e,g):i.phase==="error"?"Bundle unavailable":"Loading bundle…"),n.createElement(el,null)),E&&n.createElement("section",{className:"a-model-popover a-compact-popover",style:b,"aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>f({open:!1})},n.createElement(nn,null))),n.createElement("select",{"aria-label":"Registered root bundles",value:g||"",disabled:r||u||(t==null?void 0:t.configurationBusy),"data-action":t?"bundle.switch":"view.update",onChange:I=>N(I.target.value)},!g&&n.createElement("option",{value:"",disabled:!0},"Loading bundles…"),g&&!S.some(I=>I.value===g)&&n.createElement("option",{value:g},_i(e,g)),S.map(I=>n.createElement("option",{key:I.value,value:I.value},I.label||I.value))),((k=S.find(I=>I.value===g))==null?void 0:k.description)&&n.createElement("p",{className:"a-caption a-composer-bundle-description"},S.find(I=>I.value===g).description),x&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("button",{type:"button",className:"a-soft",disabled:u||r,onClick:()=>N(l.bundle,!0)},"Use the new bundle’s model")),(p||((T=t==null?void 0:t.bundleChange)==null?void 0:T.phase)==="error")&&n.createElement("small",{className:"a-danger",role:"status"},p||t.bundleChange.error)))}function ND({state:e,session:t,act:a,working:r}){var O,k,T,I,F;const o=((O=e.view)==null?void 0:O.composerBundle)||Cp,[i,s]=v.useState(o),[l,c]=v.useState(null),u=v.useRef(!1);v.useEffect(()=>s(o),[o]);const d=z=>{const q={...i,...z};s(q),a("view.update",{patch:{composerBundle:q}})},p=Ja(e),m=(t==null?void 0:t.bundle)||p.bundle||((k=e.bundleDefaults)==null?void 0:k.effective)||((T=e.settings)==null?void 0:T.bundle)||"work",h=i.open&&i.sessionId===((t==null?void 0:t.id)||null),f=v.useRef(null);il(h,f,()=>d({open:!1}));const g=t==null?void 0:t.bundleChange,E=t==null?void 0:t.bundlePreview,y=!!l||!!(t!=null&&t.configurationBusy)||(g==null?void 0:g.phase)==="working",b=(E==null?void 0:E.bundle)===i.bundle&&(E==null?void 0:E.previewId),S=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1,w=r||y||S||!((I=i.bundle)!=null&&I.trim()),N=b&&!E.modelCompatible&&!i.resetModel,x=l||(g==null?void 0:g.action),A=x==="bundle.preview"?"Previewing bundle changes…":x==="bundle.fork"?"Creating a conversation with this bundle…":"Switching bundle…";async function C(z){if(!u.current){u.current=!0,c(z);try{await a(z,z==="view.update"?{patch:{newSessionDraft:{...Ja(e),bundle:i.bundle},composerBundle:{},panel:null}}:{sessionId:t.id,bundle:i.bundle,...z!=="bundle.preview"?{...b?{previewId:E.previewId}:{},resetModel:!!i.resetModel}:{}})}finally{u.current=!1,c(null)}}}return n.createElement("div",{className:"a-model-control a-bundle-control",ref:f},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle","aria-expanded":!!h,"data-action":"view.update",onClick:()=>d({open:!h,sessionId:(t==null?void 0:t.id)||null,bundle:m,resetModel:!1})},n.createElement(qr,null),n.createElement("span",null,!t&&!p.bundle?"Workspace default":_i(e,m)),n.createElement(el,null)),h&&n.createElement("section",{className:"a-model-popover a-bundle-popover","aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>d({open:!1})},n.createElement(nn,null))),n.createElement("p",null,"Choose the tools, agents, and instructions for this conversation."),n.createElement(Ng,{id:"conversation-bundle",value:i.bundle||m,onChange:z=>d({bundle:z,resetModel:!1}),state:e,act:a}),t?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Switch directly, or preview the changes first. Switching keeps history and compatible model choices, and resets previous module edits, modes, and budget overrides."),b&&n.createElement("div",{className:"a-bundle-changes","aria-label":"Bundle changes"},Object.entries(E.changes||{}).map(([z,q])=>{var W,X,U,_;return n.createElement("div",{key:z},n.createElement("strong",null,z[0].toUpperCase()+z.slice(1)),"after"in q?n.createElement("p",null,q.before||"None"," → ",q.after||"None"):n.createElement(n.Fragment,null,((W=q.added)==null?void 0:W.length)>0&&n.createElement("p",null,"Add: ",q.added.join(", ")),((X=q.removed)==null?void 0:X.length)>0&&n.createElement("p",null,"Remove: ",q.removed.join(", ")),!((U=q.added)!=null&&U.length)&&!((_=q.removed)!=null&&_.length)&&n.createElement("p",null,"Same set; settings may change.")))}),n.createElement("p",null,"Instructions are replaced. Enabled app capabilities and shared settings still apply."),((F=E.appCapabilities)==null?void 0:F.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Added app capabilities (",E.appCapabilities.length,")"),n.createElement("ul",null,E.appCapabilities.map(z=>n.createElement("li",{key:z,className:"a-wrap"},z)))),!E.modelCompatible&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:!!i.resetModel,"data-action":"view.update",onChange:z=>d({resetModel:z.target.checked})})," Use the new bundle’s model"))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w||N||i.bundle===m,"data-action":"bundle.switch",onClick:()=>C("bundle.switch")},"Switch bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"bundle.preview",onClick:()=>C("bundle.preview")},"Preview changes"),n.createElement("button",{type:"button",className:"a-soft",disabled:w||N,"data-action":"bundle.fork",onClick:()=>C("bundle.fork")},"Fork with this bundle")),r&&n.createElement("p",null,"Finish this turn and its workers to preview or switch bundles."),(y||g)&&n.createElement(nt,{phase:y?"working":g.phase,message:y?A:g.error||(g.phase==="ready"?g.action==="bundle.preview"?"Preview ready":g.action==="bundle.fork"?"Fork created":"Bundle switched":"")})):n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"view.update",onClick:()=>C("view.update")},"Use bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:y||!p.bundle,"data-action":"view.update",onClick:()=>a("view.update",{patch:{newSessionDraft:{...p,bundle:""},composerBundle:{}}})},"Use workspace default"))))}function RD({state:e,act:t}){var h,f;const a=e.bundleDefaults||{},r=((h=e.view)==null?void 0:h.bundleDefaultsDraft)||Cp,[o,i]=v.useState(r),[s,l]=v.useState(!1),c=v.useRef(!1);v.useEffect(()=>i(r),[r]);const u=o.scope||"app",d=o.bundle??a[u]??"",p=g=>{const E={...o,...g};i(E),t("view.update",{patch:{bundleDefaultsDraft:E}})};async function m(g){var E;if(!c.current){c.current=!0,l(!0);try{await t("bundle.default",{scope:u,bundle:g,workspace:a.workspacePath||((E=e.settings)==null?void 0:E.workspace)})}finally{c.current=!1,l(!1)}}}return n.createElement("div",null,n.createElement("label",{htmlFor:"bundle-default-scope"},"Default applies to"),n.createElement("select",{id:"bundle-default-scope",value:u,"data-action":"view.update",onChange:g=>p({scope:g.target.value,bundle:a[g.target.value]||""})},n.createElement("option",{value:"app"},"This Unified app"),n.createElement("option",{value:"workspace"},"This workspace on this computer"),n.createElement("option",{value:"shared"},"Shared Amplifier settings (including CLI)")),n.createElement("label",{htmlFor:"default-bundle"},"Default bundle for new conversations"),n.createElement(Ng,{id:"default-bundle",value:d,state:e,act:t,onChange:g=>p({bundle:g})}),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:s||!d.trim(),"data-action":"bundle.default",onClick:()=>m(d.trim())},"Save default"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"bundle.default",onClick:async()=>{await m(null),p({bundle:""})}},"Use inherited default")),n.createElement("p",{className:"a-caption"},"New conversations here use ",n.createElement("strong",null,_i(e,a.effective||((f=e.settings)==null?void 0:f.bundle)))," from ",{workspace:"workspace settings",app:"this Unified app",shared:"shared Amplifier settings"}[a.source]||"shared Amplifier settings",". Workspace settings take priority over this app, then shared settings. Existing conversations keep their selected bundles."),u==="workspace"&&a.workspaceInherited&&n.createElement("p",{className:"a-caption"},"Clearing this computer’s override inherits the project’s ",_i(e,a.workspaceInherited)," default."))}const ao={page:"home",serverId:"",toolName:"",repository:"",ref:"",path:"",extras:"",connection:{id:"",name:"",transport:"stdio",command:"",args:"",env:"",cwd:"",url:"",headers:"",auth:"environment",installationId:""},values:{},raw:!1,json:"{}"},jt=e=>["running","working","queued","pending","connecting","installing"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase)),eo=e=>{var t;return["failed","error","interrupted"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase))||!!(e!=null&&e.error)||((t=e==null?void 0:e.result)==null?void 0:t.isError)===!0},Za=e=>JSON.stringify(e,null,2),ai=e=>Array.isArray(e)?e:Object.values(e||{}),Pi=e=>e.replace(/[_.-]+/g," ").replace(/^./,t=>t.toUpperCase()),Ta=e=>(e==null?void 0:e.repository)||(e==null?void 0:e.repo)||(e==null?void 0:e.url)||"",TD=e=>jt(e)?"working":eo(e)?"error":"ready",ID={"smartTools.catalog":"Catalog refreshed","smartTools.inspect":"Source inspected","smartTools.install":"Installation complete","smartTools.configure":"Connection saved","smartTools.connect":"Connected","smartTools.disconnect":"Disconnected","smartTools.remove":"Connection removed","smartTools.call":"Tool finished","smartTools.open":"Opened in canvas","smartTools.reconnect":"Reconnected","smartTools.schemas":"Tool fields loaded","smartTools.discover":"Tool definitions found","smartTools.uninstall":"Package uninstalled","smartTools.authStart":"Sign-in started","smartTools.authCancel":"Sign-in cancelled","smartTools.authForget":"Local sign-in removed","smartTools.accountAccept":"Account change accepted; reconnect explicitly"};function AD({value:e}){return typeof e=="string"?n.createElement("p",null,e):!Array.isArray(e)||e.some(t=>typeof t!="string"&&typeof(t==null?void 0:t.name)!="string")?n.createElement("pre",null,Za(e)):n.createElement("ul",{className:"a-smart-setup-requirements"},e.map((t,a)=>typeof t=="string"?n.createElement("li",{key:a},t):n.createElement("li",{key:a},n.createElement("strong",null,t.name),t.optional&&n.createElement("small",null," · Optional"),typeof t.purpose=="string"&&n.createElement("p",null,t.purpose),typeof t.install=="string"&&(/^https?:\/\//.test(t.install)?n.createElement("a",{href:t.install,target:"_blank",rel:"noreferrer"},"Setup instructions",n.createElement(sa,null)):n.createElement("p",null,t.install)),Object.keys(t).some(r=>!["name","optional","purpose","install"].includes(r))&&n.createElement("details",null,n.createElement("summary",null,"More requirement details"),n.createElement("pre",null,Za(t))))))}function _D(e,t){var l;const a=(l=e.view)==null?void 0:l.smartToolsEditor,[r,o]=v.useState({...ao,...a}),i=v.useRef(r);return v.useLayoutEffect(()=>{a&&(i.current={...ao,...a},o(i.current))},[a]),[r,c=>{const u={...i.current,...c};i.current=u,o(u),t("view.update",{patch:{smartToolsEditor:u}})}]}function PD(e,t,a={}){return[...e].reverse().find(r=>r.action===t&&Object.entries(a).every(([o,i])=>{var l,c;const s=((l=r.target)==null?void 0:l[o])??((c=r.args)==null?void 0:c[o])??(o==="id"?r.serverId:o==="name"?r.tool||r.name:r[o]);return r.target||r.args?(s??"")===(i??""):s==null||s===i}))}function ga({operation:e,busyMessage:t}){var r;if(!e)return null;const a=e.error||((r=e.result)!=null&&r.isError?"The tool reported an error. See its result below.":jt(e)?t||"Working…":ID[e.action]||"Finished");return n.createElement(nt,{phase:TD(e),message:typeof a=="string"?a:Za(a),detail:e.status==="interrupted"?"The previous app run ended before this request finished. Review the tool state before retrying.":void 0})}function OD({operation:e}){if(!e||jt(e)||e.result==null)return null;const t=e.result,a=!!(t&&typeof t=="object"&&t.$resource),r=a?t.summary??t.preview??null:t,o=typeof r=="string"?r:r==null?"":Za(r);return n.createElement("div",{className:"a-smart-result"},n.createElement("h4",null,"Result"),o&&n.createElement("pre",{tabIndex:0},o.slice(0,24e3)),a?n.createElement("p",{className:"a-caption"},"The full result is saved",typeof t.bytes=="number"?` (${Math.ceil(t.bytes/1024).toLocaleString()} KB)`:"",". Ask your agent to inspect it or show the details you need."):o.length>24e3&&n.createElement("p",{className:"a-caption"},"Showing the first 24,000 characters. The full result is saved and available for your agent to inspect."))}function MD(e){const t=e.split(` +`;var Pf={version:"0.20.46",id:"b48fe668835544e3"};const Ru=typeof Pf>"u"?{version:"dev",id:"dev"}:Pf,Ei=new Map;let jw="unknown";function ti(e){jw=["connecting","open","reconnecting","closed"].includes(e)?e:"unknown"}function VL(){const e=Symbol();return Ei.set(e,Date.now()),()=>Ei.delete(e)}function $w(e,t=globalThis){var l,c,u,d,p,m,h;const a=t.navigator||{},r=a.userAgent||"",o=r.match(/(Edg)\/([0-9.]+)/)||r.match(/(Firefox)\/([0-9.]+)/)||r.match(/(Chrome)\/([0-9.]+)/)||r.match(/(Version)\/([0-9.]+)/),i=!!((l=t.matchMedia)!=null&&l.call(t,"(prefers-color-scheme: dark)").matches),s=["light","dark","system"].includes((c=e==null?void 0:e.view)==null?void 0:c.scheme)?e.view.scheme:"system";return{frontendVersion:Ru.version,frontendBuild:Ru.id,browser:o?{Edg:"Edge",Firefox:"Firefox",Chrome:"Chrome",Version:"Safari"}[o[1]]:"Other",browserVersion:(o==null?void 0:o[2])||"",deviceOS:/Android/.test(r)?"Android":/iPhone|iPad|iPod/.test(r)?"iOS":/Windows/.test(r)?"Windows":/Macintosh/.test(r)?"macOS":/Linux/.test(r)?"Linux":"Other",width:Math.min(32768,t.innerWidth||0),height:Math.min(32768,t.innerHeight||0),pixelRatio:Math.min(16,t.devicePixelRatio||1),colorPreference:i?"dark":"light",appearance:s,resolvedAppearance:s==="system"?i?"dark":"light":s,standalone:!!((u=t.matchMedia)!=null&&u.call(t,"(display-mode: standalone)").matches||a.standalone),secureContext:!!t.isSecureContext,online:a.onLine!==!1,eventStream:jw,serviceWorkerControlled:!!((d=a.serviceWorker)!=null&&d.controller),reducedMotion:!!((p=t.matchMedia)!=null&&p.call(t,"(prefers-reduced-motion: reduce)").matches),visible:((m=t.document)==null?void 0:m.visibilityState)!=="hidden",pageAgeSeconds:Math.min(31536e3,Math.floor((((h=t.performance)==null?void 0:h.now())||0)/1e3)),pendingActions:Ei.size,oldestPendingMs:Ei.size?Date.now()-Math.min(...Ei.values()):0}}function WL(e,t){const a=r=>typeof r=="string"&&/^[a-f0-9]{12,64}$/.test(r);return a(e==null?void 0:e.id)&&a(t==null?void 0:t.id)&&(e.id!==t.id||e.version!==t.version)}async function ZL({prepare:e,reload:t}){await e(),t()}const Bw=v.createContext(null);function JL({enabled:e,blocked:t,prepare:a}){const[r,o]=v.useState(null),[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(a);d.current=a,v.useEffect(()=>{if(!e)return;let m=!0,h=!1;const f=new AbortController,g=async()=>{if(!(h||document.hidden)){h=!0;try{const y=await fetch("/build.json",{cache:"no-store",credentials:"same-origin",signal:f.signal});if(y.ok){const b=await y.json();m&&o(WL(Ru,b)?b:null)}}catch{}finally{h=!1}}};g();const E=setInterval(g,6e4);return window.addEventListener("focus",g),window.addEventListener("amplifier-reconnected",g),document.addEventListener("visibilitychange",g),()=>{m=!1,f.abort(),clearInterval(E),window.removeEventListener("focus",g),window.removeEventListener("amplifier-reconnected",g),document.removeEventListener("visibilitychange",g)}},[e]);const p=async()=>{if(!(!r||t||u.current)){u.current=!0,s(!0),c("");try{await ZL({prepare:()=>d.current(),reload:()=>window.location.reload()})}catch(m){c(m.message||"Your changes could not be saved. Try again when connected."),u.current=!1,s(!1)}}};return{available:!!r,version:r==null?void 0:r.version,busy:i,blocked:t,error:l,reload:p}}function Hw(){const e=v.useContext(Bw);return e!=null&&e.available?n.createElement("aside",{className:"a-reload-notice","data-part":"app-reload","aria-label":"App update ready"},n.createElement(Mt,{"aria-hidden":"true"}),n.createElement("div",null,n.createElement("strong",null,"Update ready—reload to finish"),n.createElement("p",null,e.blocked||"Load the updated app in this tab. Your chats and saved settings stay in place."),e.error&&n.createElement("p",{role:"alert"},e.error)),n.createElement("button",{type:"button",className:"a-primary",disabled:e.busy||!!e.blocked,onClick:e.reload},e.busy?"Saving before reload…":"Reload now")):null}const Kr=v.createContext({compact:!1,active:!0,footer:null});function Rn({children:e,active:t=!0,className:a=""}){const r=v.useContext(Kr);if(r.compact&&!t)return null;const o=n.createElement("div",{className:"a-dialog-actions "+a},e);return r.compact&&r.active&&r.footer&&t?Mi.createPortal(o,r.footer):o}function KL(e){const[t,a]=v.useState(()=>typeof window<"u"&&window.matchMedia("(max-width:959px)").matches);return v.useLayoutEffect(()=>{var s;const r=((s=e.current)==null?void 0:s.closest(".a-overlay"))||e.current;if(!r)return;const o=()=>a(r.clientWidth<960);o();const i=new ResizeObserver(o);return i.observe(r),()=>i.disconnect()},[]),t}function YL(e,t){v.useEffect(()=>{var l;const a=(l=e.current)==null?void 0:l.closest(".a-overlay"),r=window.visualViewport;if(!t||!a||!r)return;let o;const i=()=>{r.scale===1&&(a.style.setProperty("--a-settings-viewport-top",r.offsetTop+"px"),a.style.setProperty("--a-settings-viewport-height",r.height+"px"),cancelAnimationFrame(o),o=requestAnimationFrame(()=>{var m;const c=document.activeElement;if(!((m=e.current)!=null&&m.contains(c))||!c.matches("input,textarea,select"))return;const u=c.closest(".a-settings-content");if(!u)return;const d=c.getBoundingClientRect(),p=u.getBoundingClientRect();d.bottom>p.bottom-16?u.scrollTop+=d.bottom-p.bottom+16:d.top{cancelAnimationFrame(o),r.removeEventListener("resize",i),r.removeEventListener("scroll",i),s.removeEventListener("focusin",i),a.style.removeProperty("--a-settings-viewport-top"),a.style.removeProperty("--a-settings-viewport-height")}},[t])}function GL({compact:e,trail:t,view:a,act:r,close:o,body:i,navigationRef:s,confirmClose:l=()=>Promise.resolve(!0),hasUnsaved:c=()=>!1}){const u=v.useRef(null),d=v.useRef(null),p=v.useRef(new Map),m=v.useRef(null),h=v.useRef(!1),[f,g]=v.useState(!1),E=v.useRef(!1);u.current={trail:t,view:a,act:r,close:o,confirmClose:l};const y=t.at(-1),b=y.key,S=v.useRef(a.settingsRootVisit);v.useEffect(()=>{const A=S.current!==a.settingsRootVisit;S.current=a.settingsRootVisit,m.current=b,h.current=!0;const C=requestAnimationFrame(()=>{i.current&&(i.current.scrollTop=A?0:p.current.get(b)||0),h.current=!1});return()=>cancelAnimationFrame(C)},[b,a.settingsRootVisit]);const w=()=>{i.current&&!h.current&&p.current.set(m.current,i.current.scrollTop)};v.useLayoutEffect(()=>{var z;if(!e||typeof window>"u")return;const A=(z=history.state)==null?void 0:z.amplifierSettings,C=typeof(A==null?void 0:A.token)=="string"&&A.token.startsWith("settings-")&&Number.isInteger(A.index)&&A.index>0&&A.index<10?A:null,O=(C==null?void 0:C.token)||"settings-"+crypto.randomUUID(),k={...history.state};delete k.amplifierSettings;const T={token:O,entries:C?[...u.current.trail]:[],index:(C==null?void 0:C.index)||0,closing:!1};d.current=T;const I=q=>{T.entries.splice(T.index),T.entries.push(q),T.index=T.entries.length,history.pushState({...k,amplifierSettings:{token:O,index:T.index}},"")};C||u.current.trail.forEach(I);const F=async q=>{var P,G;const W=(P=q.state)==null?void 0:P.amplifierSettings;if((W==null?void 0:W.token)!==O){if(T.confirming)return;if(T.closing){u.current.close();return}T.confirming=!0,g(!0);const Z=await u.current.confirmClose();if(T.confirming=!1,Z)T.closing=!0,u.current.close();else for(let D=1;D<=T.index;D++)history.pushState({...k,amplifierSettings:{token:O,index:D}},"");g(!1);return}T.index=W.index;const X=T.entries[T.index-1];if(!X)return;const U=Object.keys(X.navigation).find(Z=>{var D;return((D=X.navigation[Z])==null?void 0:D.orderOpen)===!0});if(U&&!((G=u.current.view[U])!=null&&G.order)){history.back();return}const _={...X.navigation};for(const Z of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])_[Z]&&(_[Z]={...u.current.view[Z],..._[Z]});u.current.act("view.update",{patch:_})};return window.addEventListener("popstate",F),()=>{var q,W;window.removeEventListener("popstate",F),d.current=null,((W=(q=history.state)==null?void 0:q.amplifierSettings)==null?void 0:W.token)===O&&!T.closing&&history.go(-T.index)}},[e]),v.useLayoutEffect(()=>{const A=d.current;if(!e||!A||A.closing||A.confirming)return;const C=A.entries[A.index-1];if(t.forEach((O,k)=>{A.entries[k]=O}),A.index>t.length){history.go(t.length-A.index);return}if(A.index===t.length){(C==null?void 0:C.key)!==b&&history.replaceState({...history.state,amplifierSettings:{token:A.token,index:A.index}},"");return}for(;A.index{const A=d.current;if(A&&A.index>1)w(),history.back();else if(t.length>1){const C=t.at(-2),O={...C.navigation};for(const k of["providerEditor","routingEditor","bundleManager","moduleEditor","smartToolsEditor","diagnosticsDraft","aiConnectionEditor"])O[k]&&(O[k]={...a[k],...O[k]});r("view.update",{patch:O})}else x()},x=async()=>{if(E.current)return;E.current=!0;const A=d.current;A&&(A.confirming=!0),g(!0);const C=await u.current.confirmClose();A&&(A.confirming=!1),C&&(A&&!A.closing?(A.closing=!0,history.go(-A.index)):o()),E.current=!1,g(!1)};return v.useEffect(()=>(s&&(s.current={close:x,confirmClose:l,hasUnsaved:c}),()=>{s&&(s.current=null)})),{back:N,dismiss:x,rememberScroll:w}}function QL(e){const[t,a]=v.useState(()=>typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches);return v.useEffect(()=>{const r=matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e==="dark"||e==="system"&&t?"dark":"light"}function XL({root:e,state:t,shell:a,scheme:r,mode:o,preview:i,css:s}){var l,c;v.useLayoutEffect(()=>{var h,f,g,E,y;if(!e.current||!a.ready||i||(h=t==null?void 0:t.view)!=null&&h.themePreview||(f=a.data)!=null&&f.preview)return;const u=getComputedStyle(e.current),d={};try{Object.assign(d,(g=JSON.parse(sessionStorage.getItem("amplifier.appearance")||"null"))==null?void 0:g.colors)}catch{}d[o]={background:u.backgroundColor,foreground:u.color};const p=(y=(E=t==null?void 0:t.theme)==null?void 0:E.definition)==null?void 0:y.palette;if(p)for(const b of["light","dark"])d[b]={background:p[b].bg,foreground:p[b].ink};const m={version:1,scheme:["light","dark","system"].includes(r)?r:"light",colors:d};try{sessionStorage.setItem("amplifier.appearance",JSON.stringify(m))}catch{}document.documentElement.style.colorScheme=o,document.documentElement.style.setProperty("--boot-bg",d[o].background),document.documentElement.style.setProperty("--boot-ink",d[o].foreground)},[e,a.ready,(l=a.data)==null?void 0:l.preview,(c=t==null?void 0:t.view)==null?void 0:c.themePreview,t==null?void 0:t.theme,r,o,i,s])}function eD({shell:e,onError:t}){const a=e.composition.presentation.decorations!==!1,[r,o]=v.useState(!1),[i,s]=v.useState(a);v.useEffect(()=>{r||s(a)},[a,r]);async function l(c){const u=c.target.checked;s(u),o(!0);try{await e.setPresentation({decorations:u})}catch(d){s(a),t(d.message)}finally{o(!1)}}return n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:i,disabled:r,"data-action":"shell.changes.apply",onChange:l}),"Show decorative theme background")}const tD={bg:"#e9ecf5",surface:"#ffffff",ink:"#23304d",accent:"#6353c7",line:"#d7ddec"};function nD({item:e}){const t={...tD,...e.palette};return n.createElement("div",{className:"a-appearance-swatch","aria-hidden":"true",style:{"--sw-bg":t.bg,"--sw-surface":t.surface,"--sw-ink":t.ink,"--sw-accent":t.accent,"--sw-line":t.line,"--sw-radius":e.radius||"12px",backgroundImage:e.background||"none",fontFamily:e.heading||"inherit",backgroundSize:e.id==="builtin:graphite"?"16px 16px":"cover"}},n.createElement("div",{className:"a-swatch-header"},n.createElement("span",null,"◉ Amplifier"),n.createElement("span",null,"•••")),n.createElement("div",{className:"a-swatch-body"},n.createElement("div",{className:"a-swatch-nav"},n.createElement("i",null),n.createElement("i",null),n.createElement("i",null)),n.createElement("div",{className:"a-swatch-chat"},n.createElement("strong",null,"Room for ideas."),n.createElement("span",{className:"a-swatch-line"}),n.createElement("span",{className:"a-swatch-line short"}),n.createElement("div",{className:"a-swatch-prompt"},n.createElement("span",null,"Ask anything…"),n.createElement("b",null,"↑")))))}function aD({state:e,shell:t,act:a,name:r,css:o,preview:i,setName:s,setCss:l,setPreview:c,defaultSkin:u,simple:d=!1,advancedOnly:p=!1,onAdvanced:m}){var Ee,me,_e,Je,De;const{active:h}=v.useContext(Kr),[f,g]=v.useState(""),[E,y]=v.useState({items:[],errors:[],directory:""}),[b,S]=v.useState(null),[w,N]=v.useState(!1),[x,A]=v.useState(""),[C,O]=v.useState(""),[k,T]=v.useState(!1),I=v.useRef(a),F=v.useRef(!0),z=v.useRef(0),q=v.useRef(i);I.current=a,q.current=i;const W=t.composition.presentation,X=W.scheme||((Ee=e.view)==null?void 0:Ee.scheme)||"system";async function U(){var ye;const ue=await I.current("theme.list",{});if(!Array.isArray((ye=ue.result)==null?void 0:ye.items))throw Error("The appearance library is unavailable. Try reopening Settings.");F.current&&(y(ue.result),g(""))}v.useEffect(()=>{if(!h)return;F.current=!0,U().catch(ye=>g(ye.message));const ue=setInterval(()=>U().catch(()=>{}),5e3);return()=>{F.current=!1,z.current++,clearInterval(ue),q.current&&(c(!1),I.current("view.update",{patch:{themePreview:!1}}).catch(()=>{}))}},[h]);async function _(ue){N(!0),A(""),O("");try{await ue()}catch(ye){F.current&&A(ye.message)}finally{F.current&&N(!1)}}async function P(ue){const ye=++z.current;await _(async()=>{const{result:M}=await I.current("theme.read",{id:ue.id});if(!F.current||ye!==z.current)return;S(ue.id),s(M.name),l(M.css);const Y=await I.current(d?"theme.apply":"theme.preview",{name:M.name,css:M.css});if((Y==null?void 0:Y.accepted)===!1)throw Error(Y.error||"Could not save appearance.");c(!d),d&&O(M.name+" saved.")})}async function G(){await _(async()=>{await I.current("theme.apply",{name:r,css:o}),c(!1),O(r+" applied.")})}async function Z(){await _(async()=>{var ue,ye;i&&await I.current("theme.revert",{}),c(!1),s(((ue=e.theme)==null?void 0:ue.name)||"Amplifier Unified"),l(((ye=e.theme)==null?void 0:ye.css)||u),S(null)})}async function D(ue){"name"in ue&&s(ue.name),"css"in ue&&l(ue.css),S(null),c(!1),await I.current("view.update",{patch:{themeDraft:ue.css??o,themeDraftName:ue.name??r,themePreview:!1}})}async function ne(){await _(async()=>{const{result:ue}=await I.current("theme.save",{name:r,css:o});S(ue.id),await U(),O("Saved to your appearance library.")})}async function H(ue){if(!ue)return;if(ue.size>99e4)throw Error("Choose a CSS appearance smaller than 1 MB.");const ye=await ue.text(),M=ue.name.replace(/\.amplifier\.css$|\.css$/i,"").slice(0,100),{result:Y}=await I.current("theme.save",{name:M,css:ye});return await U(),O(M+" added to your library. Select it to preview."),Y}const j=b||(((me=e.theme)==null?void 0:me.name)==="Amplifier Unified"?"builtin:default":(_e=E.items.find(ue=>{var ye;return ue.name===((ye=e.theme)==null?void 0:ye.name)}))==null?void 0:_e.id),ie=ue=>_(()=>t.setPresentation(ue));return n.createElement("div",{className:"a-appearance-settings","data-appearance-simple":d,"data-appearance-advanced":p},n.createElement("div",{className:"a-appearance-intro"},n.createElement("div",null,d?n.createElement("p",null,"Choose a look. Your choice is saved automatically."):n.createElement(n.Fragment,null,n.createElement("p",null,"Make this space yours."),n.createElement("small",null,"Choose an appearance to try it. Apply when it feels right."))),!d&&n.createElement("span",{className:"a-appearance-current"},n.createElement(Bc,{size:14}),i?"Previewing "+r:((Je=e.theme)==null?void 0:Je.name)||"Amplifier")),d&&n.createElement("h4",{className:"a-appearance-label"},"Look & feel"),n.createElement("div",{className:"a-appearance-gallery","aria-label":"Appearance library"},E.items.map(ue=>n.createElement("button",{type:"button",key:ue.id,className:"a-appearance-card","aria-label":(d?"Use ":"Preview ")+ue.name,"aria-pressed":j===ue.id,disabled:w,"data-action":d?"theme.apply":"theme.preview",onClick:()=>P(ue)},n.createElement(nD,{item:ue}),n.createElement("div",{className:"a-appearance-card-caption"},n.createElement("div",null,n.createElement("strong",null,ue.name),!d&&n.createElement("small",null,ue.tag)),j===ue.id?n.createElement(Pt,null):n.createElement(Bc,null)),!d&&n.createElement("p",null,ue.description))),!E.items.length&&!f&&n.createElement("p",{role:"status"},"Loading appearances…")),i&&n.createElement("div",{className:"a-appearance-preview",role:"status"},n.createElement("span",null,i?"Previewing "+r:"Current appearance"),n.createElement("div",null,i&&n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:Z},"Cancel preview"),n.createElement("button",{type:"button",className:"a-primary",disabled:w||!i,"data-action":"theme.apply",onClick:G},n.createElement(Pt,null),d?"Apply appearance":"Use "+r))),(x||f)&&n.createElement("p",{role:"alert",className:"a-danger"},x||f),C&&n.createElement("p",{role:"status",className:"a-appearance-notice"},n.createElement(Pt,{size:15}),C),n.createElement("section",{className:"a-appearance-options"},d?n.createElement("div",{className:"a-appearance-color"},n.createElement("label",{htmlFor:"appearance-color-mode"},"Color mode"),n.createElement("select",{id:"appearance-color-mode",value:X,disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({scheme:ue.target.value})},n.createElement("option",{value:"system"},"Device"),n.createElement("option",{value:"light"},"Light"),n.createElement("option",{value:"dark"},"Dark"))):n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Color mode"),n.createElement("p",null,"Keep a favorite look throughout the day.")),n.createElement("div",{className:"a-appearance-modes",role:"group","aria-label":"Color mode"},[["light","Light",gx],["dark","Dark",nx],["system","Device",Lu]].map(([ue,ye,M])=>n.createElement("button",{type:"button",key:ue,disabled:w,"aria-pressed":X===ue,"data-action":"shell.changes.apply",onClick:()=>ie({scheme:ue})},n.createElement(M,null),ye)))),n.createElement("fieldset",{className:"a-detail-level"},n.createElement("legend",null,"How much would you like to see?"),n.createElement("p",null,"Choose a calmer workspace or keep more information at hand. You can always open details."),n.createElement("div",{className:"a-detail-choices"},[["minimal","Focused","Quiet lists and simple work summaries. Extra information stays in details."],["standard","Balanced","Useful context and work totals, with deeper details one click away."],["detailed","Everything","Work activity opens automatically. Counts and list actions stay visible."]].map(([ue,ye,M])=>n.createElement("label",{key:ue,"data-selected":(W.interfaceDetail||W.executionDetail||"standard")===ue},n.createElement("input",{type:"radio",name:"interface-detail",value:ue,checked:(W.interfaceDetail||W.executionDetail||"standard")===ue,disabled:w,"data-action":"shell.changes.apply",onChange:()=>ie({interfaceDetail:ue,executionDetail:ue})}),n.createElement("span",null,n.createElement("strong",null,ye),n.createElement("small",null,M)))))),n.createElement("details",{className:"a-everyday-disclosure",open:!d||void 0},n.createElement("summary",null,"Layout & background"),n.createElement("div",null,n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("h3",null,"Background"),n.createElement("p",null,"Decorative artwork stays behind your content.")),n.createElement(eD,{shell:t,onError:A})),n.createElement("div",{className:"a-appearance-option"},n.createElement("div",null,n.createElement("label",{htmlFor:"layout"},"Layout"),n.createElement("p",null,"Choose where the conversation and Canvas sit.")),n.createElement("select",{id:"layout",value:W.layout||((De=e.view)==null?void 0:De.layout)||"balanced",disabled:w,"data-action":"shell.changes.apply",onChange:ue=>ie({layout:ue.target.value})},n.createElement("option",{value:"balanced"},"Canvas on the right"),n.createElement("option",{value:"conversation"},"More room for conversation"),n.createElement("option",{value:"work"},"Canvas on the left")))))),!d&&n.createElement("section",{className:"a-appearance-import"},n.createElement("div",null,n.createElement("h3",null,n.createElement(mg,null),"Your appearance library"),n.createElement("p",null,"Upload a CSS appearance once. It will stay here across restarts and be available to every connected device.")),n.createElement(Cg,{id:"theme-import",accept:".css,text/css",action:"theme.save",label:"Upload appearance",hint:"Drop a CSS file here · up to 1 MB",onFile:H}),E.errors.map(ue=>n.createElement("p",{className:"a-danger",key:ue.name},ue.name,": ",ue.message)),n.createElement("details",{className:"a-appearance-folder"},n.createElement("summary",null,n.createElement(nr,null),"Theme folder"),n.createElement("p",null,"CSS files placed here appear in the library automatically."),n.createElement("code",null,E.directory))),!d&&n.createElement("details",{className:"a-appearance-advanced",open:k,onToggle:ue=>T(ue.currentTarget.open)},n.createElement("summary",null,"Advanced customization"),n.createElement("p",null,"Edit or export a complete, portable CSS appearance. Embedded images and fonts travel with it."),n.createElement("label",{htmlFor:"theme-name"},"Appearance name"),n.createElement("input",{id:"theme-name",value:r,"data-action":"view.update",onChange:ue=>D({name:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("label",{htmlFor:"theme-css"},"CSS"),n.createElement("textarea",{id:"theme-css",spellCheck:!1,className:"a-css-editor",value:o,"data-action":"view.update",onChange:ue=>D({css:ue.target.value}).catch(ye=>A(ye.message))}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"theme.save",onClick:ne},"Save to library"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.preview",onClick:()=>_(async()=>{await I.current("theme.preview",{name:r,css:o}),c(!0)})},"Preview"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.apply",onClick:G},"Apply skin"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,onClick:Z},"Revert edits"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"theme.export",onClick:()=>_(()=>I.current("theme.export",{}))},n.createElement(wa,null),"Export current appearance"))),d&&n.createElement("div",{className:"a-everyday-footer"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:m},"Custom themes & CSS")),!d&&n.createElement("button",{type:"button",className:"a-link a-appearance-reset",disabled:w,"data-action":"theme.reset",onClick:()=>_(async()=>{await I.current("theme.reset",{}),c(!1),S(null)})},n.createElement(Mt,null),"Restore original appearance"))}const Zi=[{id:"ai",title:"AI connections",scope:"Across workspaces on this Amplifier host",pages:[["ai-connections","AI connections"],["overview","AI connections"]]},{id:"smart-tools",title:"Smart Tools",scope:"This Amplifier host",pages:[["smart-tools","Smart Tools"]]},{id:"appearance",title:"Appearance",scope:"This interface",pages:[["appearance","Appearance"]]},{id:"voice",title:"Voice",scope:"Future voice connections",pages:[["voice","Voice"]]},{id:"notifications",title:"Notifications",scope:"This app",pages:[["notifications","Notifications"]]},{id:"privacy",title:"Privacy & files",scope:"Your work and access choices",pages:[["privacy","Privacy & files"],["workspaces","Files & folders"],["recall","Memory & past work"],["permissions","File access"],["desktop","Screen & computer access"],["diagnostics","App diagnostic capture"],["history","Saved work"]]},{id:"updates",title:"Updates",scope:"This Amplifier host",pages:[["updates","Updates"]]},{id:"advanced",title:"Advanced",scope:"Full configuration",pages:[["advanced","Advanced"],["providers","Provider configuration"],["routing","Model rules"],["app-bundles","Configured bundles"],["add-bundles","Discover bundles"],["defaults","Conversation defaults"],["loaded-modules","Conversation modules"],["share-bundle","Save & share a bundle"],["registries","Module & source registries"],["tool-connections","Tool connections"],["custom-appearance","Custom appearance"],["conversation","Current conversation"],["outputs","Outputs & review"],["publishing","Publishing"],["repair","Backup & repair"],["reset","Advanced recovery"],["ready-conversations","Ready conversations"],["automation","Terminal & automation"],["install-app","Install app"],["runtime","Session controls"]]}],Of={setup:["overview","ai-connections","advanced","appearance","voice","providers","routing","defaults","conversation","install-app","runtime","custom-appearance"],capabilities:["smart-tools","tool-connections","app-bundles","add-bundles","loaded-modules","registries","share-bundle"],maintenance:["privacy","ready-conversations","updates","diagnostics","history","recall","outputs","publishing","permissions","notifications","automation","repair","reset"]};function Vw(e={},t=Zi){var o,i;const a=new Set(t.flatMap(s=>s.pages.map(([l])=>l))),r=e.panel==="appearance"?"appearance":((i=(o=e.settingsExpanded)==null?void 0:o.find)==null?void 0:i.call(o,s=>a.has(s)))||{capabilities:"app-bundles",maintenance:"updates"}[e.settingsSection]||"ai-connections";return{page:r,section:t.find(s=>s.pages.some(([l])=>l===r))}}function Ww(e,t=Zi){if(!t.some(a=>a.pages.some(([r])=>r===e)))throw new Error("Unknown settings page");return{panel:"settings",settingsSection:Object.keys(Of).find(a=>Of[a].includes(e))||"setup",settingsExpanded:[e]}}function rD(e,t){return t.pages.reduce((a,[r])=>{var o,i;return a+(((i=(o=e.attention)==null?void 0:o.pages)==null?void 0:i[r])||0)},0)}function bp(e,t=Zi){var a;return((a=t.flatMap(r=>r.pages).find(([r])=>r===e))==null?void 0:a[1])||"Settings"}function Is(e,t=Zi){const a=t.find(r=>r.pages.some(([o])=>o===e));return["privacy","advanced"].includes(a==null?void 0:a.id)&&e!==a.id?a.id:null}function Zw({state:e,id:t,sessionId:a,act:r,disabled:o=!1}){var E,y,b,S,w,N,x,A;const[i,s]=v.useState(!1),[l,c]=v.useState(""),u=v.useRef(!1),d=v.useRef(null),p=(y=(E=e.setup)==null?void 0:E.operations)==null?void 0:y["providers.testMessage:"+t],m=(S=(b=e.setup)==null?void 0:b.messageTests)==null?void 0:S[t],h=(N=(w=e.setup)==null?void 0:w.providers)==null?void 0:N.find(C=>C.id===t),f=(h==null?void 0:h.module)==="provider-openai-chatgpt"&&(((x=h.account)==null?void 0:x.authMode)||((A=h.config)==null?void 0:A.auth_mode))==="chatgpt_plan";v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[p==null?void 0:p.commandId,p==null?void 0:p.phase]);async function g(){if(!(u.current||f)){u.current=!0,s(!0),c("");try{const C=await r("providers.testMessage",{id:t,...a?{sessionId:a}:{}});if(!(C!=null&&C.accepted)||!C.operationId)throw Error((C==null?void 0:C.error)||"The test could not be started.");d.current=C.operationId,s(C.operationId)}catch(C){u.current=!1,s(!1),c(C.message)}}}return v.useEffect(()=>{d.current&&(p==null?void 0:p.commandId)===d.current&&["ready","error"].includes(p.phase)&&(u.current=!1,s(!1),c(p.error||""),d.current=null)},[i]),n.createElement("div",{"data-part":"provider-message-test"},n.createElement("button",{type:"button",className:"a-soft","data-action":"providers.testMessage",disabled:!t||o||f||!!i,onClick:g},i?"Sending test message…":"Send test message"),n.createElement("p",{className:"a-caption"},f?"ChatGPT plan does not support this test's output limit. Use Test connection to check the model catalog; no test message is sent.":"Sends a small message using the saved model and credentials. Provider charges may apply. No chat is created."),l&&n.createElement("p",{role:"alert"},l),!i&&m&&n.createElement("div",{role:"status"},n.createElement("p",null,n.createElement("strong",null,m.supported===!1?"Test message unavailable":m.reachable?"Test message succeeded":"Test message failed")," · ",m.model," · ",(m.elapsedMs/1e3).toFixed(1)," s",m.statusCode?` · HTTP ${m.statusCode}`:""),n.createElement("p",null,m.reachable?m.response:m.error)))}function Tu({credential:e}){const t=e==null?void 0:e.preview;if(!t)return null;const a=t.source==="key-file"?"Private keys file (keys.env)":t.source==="environment"?"Service environment":t.source==="configuration"?"Provider configuration":"Provider managed";return n.createElement("div",{className:"a-provider-key-preview","data-part":"provider-key-preview"},n.createElement("p",null,"Service API key: ",n.createElement("strong",null,t.status==="available"?n.createElement("code",null,t.masked):t.status==="missing"?"Not available":"Preview unavailable")),n.createElement("p",{className:"a-caption"},a,t.envVar&&n.createElement(n.Fragment,null," · ",n.createElement("code",null,t.envVar))),n.createElement("p",{className:"a-caption"},"For new connections from this running service. Existing chats may still use an earlier key. A changed shell environment does not update a running service."))}function tr(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Provider configuration must be a JSON object.");function a(r){if(!(!r||typeof r!="object"))for(const[o,i]of Object.entries(r)){if(/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(o)&&typeof i=="string"&&!/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(i)&&!/^\[redacted\]$/i.test(i))throw new Error("Enter credentials in the private API key field, or use an environment reference in configuration.");a(i)}}return a(t),t}function zl(e){return(Array.isArray(e)?e:(e==null?void 0:e.models)||[]).map(a=>typeof a=="string"?{id:a,name:a}:{id:a.id||a.name||a.model,name:a.display_name||a.displayName||a.name||a.id||a.model}).filter(a=>a.id)}function Pr(e,t,a){var r;return{...e,roles:{...e==null?void 0:e.roles,[t]:{...(r=e==null?void 0:e.roles)==null?void 0:r[t],...a}}}}function oD(e,t,a,r){var i,s;const o=[...((s=(i=e==null?void 0:e.roles)==null?void 0:i[t])==null?void 0:s.candidates)||[]];return o[a]={...o[a],...r},Pr(e,t,{candidates:o})}function Mf(e="my-routing"){return{name:e,roles:{general:{description:"General conversation and work",candidates:[{provider:"",model:""}]},fast:{description:"Quick and lightweight work",candidates:[{provider:"",model:""}]}}}}function Jw(e){try{const t=new URL(e);if(t.protocol!=="https:"||t.username||t.password||t.hash)return null;for(const a of t.searchParams.keys())if(/^(id_token_hint|access_token|refresh_token|id_token|code|client_secret)$/i.test(a))return null;return t.href}catch{return null}}function yp(e,t={}){var r,o;return(((r=e==null?void 0:e.configSchema)==null?void 0:r.fields)||((o=e==null?void 0:e.info)==null?void 0:o.config_fields)||[]).filter(i=>i.id&&i.field_type!=="secret"&&!/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(i.id)&&!["model","default_model"].includes(i.id)).filter(i=>i.requires_model&&!t.default_model&&!t.model?!1:Object.entries(i.show_when||{}).every(([s,l])=>{const c=String(t[s]??"").toLowerCase(),u=String(l).toLowerCase();if(u.startsWith("matches:"))try{return new RegExp(String(l).slice(8),"i").test(c)}catch{return!1}for(const[d,p]of[["not_contains:",m=>!c.includes(m)],["contains:",m=>c.includes(m)],["not_startswith:",m=>!c.startsWith(m)],["startswith:",m=>c.startsWith(m)]])if(u.startsWith(d))return p(u.slice(d.length));return c===u}))}function Iu(e,t,a){return!!a&&a.role===t&&a.source===JSON.stringify(e)&&Array.isArray(a.ids)&&a.ids.length===e.length&&new Set(a.ids).size===e.length&&a.ids.every(r=>e.some((o,i)=>String(i)===r))}function Tc(e,t,a){return Iu(e,t,a)?a:{role:t,ids:e.map((r,o)=>String(o)),source:JSON.stringify(e),notice:(a==null?void 0:a.role)===t?"The choices changed. Review the current order before saving.":""}}const Or=e=>!e||e==="legacy_codex"?"chatgpt_codex":e,iD="https://chatgpt.com/settings/usage";function Ep({account:e}){return e?n.createElement("div",{className:"a-ai-hint"},n.createElement("p",null,e.authMode==="chatgpt_plan"?e.planEnabled?"Using ChatGPT plan":e.connected?"Signed in. Permission to use your ChatGPT plan is still needed.":"Sign in to use your ChatGPT plan.":"This connection uses ChatGPT Codex with device sign-in.",e.email&&n.createElement(n.Fragment,null," · ",e.email)),e.authMode==="chatgpt_plan"&&n.createElement("a",{className:"a-link",href:iD,target:"_blank",rel:"noopener noreferrer"},"Manage usage")):null}function Kw({mode:e,onChange:t,disabled:a=!1}){const r=v.useId();return n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:r},"ChatGPT connection"),n.createElement("select",{id:r,value:Or(e),disabled:a,onChange:o=>t(o.target.value)},n.createElement("option",{value:"chatgpt_codex"},"ChatGPT Codex · device sign-in"),n.createElement("option",{value:"chatgpt_plan"},"ChatGPT plan · browser sign-in")),e==="chatgpt_plan"?n.createElement(n.Fragment,null,n.createElement("p",null,"Continue with ChatGPT to authorize Amplifier Unified to use your plan. Use a browser on the computer running Amplifier."),n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Using a remote host, such as Spark?"),n.createElement("p",null,"Browser sign-in returns to the computer where the browser is open. For a remote host, sign in locally with the ChatGPT provider, transfer the credentials over SSH, and import them on the remote host. Keep its host identity separate; let the remote host own subsequent refreshes."),n.createElement("p",null,"ChatGPT Codex device sign-in is the default for Unified."),n.createElement("a",{href:"https://developers.openai.com/siwc/token-sharing-open-source/self-hosted-vms",target:"_blank",rel:"noopener noreferrer"},"Remote-host sign-in guide"),n.createElement("p",null,n.createElement("a",{href:"https://github.com/microsoft/amplifier-module-provider-openai-chatgpt/blob/main/docs/CHATGPT_PLAN_SIGN_IN.md#self-hosted-server",target:"_blank",rel:"noopener noreferrer"},"Amplifier setup commands")))):n.createElement("p",null,"Sign in with a one-time code. This is the default ChatGPT connection for Amplifier Unified."))}function Au({login:e,onCancel:t,onRetry:a,busy:r=!1,chooseModel:o=!1,onEnablePlan:i,onWelcomeDismiss:s,welcomeDismissed:l=!1}){var N,x,A;const{active:c}=v.useContext(Kr),u=v.useId(),d=v.useRef(null),p=v.useRef(""),[m,h]=v.useState(!1),[f,g]=v.useState(!1),E=e.authMode==="chatgpt_plan",y=e.deviceCode||"",b=Jw(e.url),S=["starting","waiting"].includes(e.status);async function w(){var C;try{if(!((C=navigator.clipboard)!=null&&C.writeText))throw Error();await navigator.clipboard.writeText(y),h(!0),g(!1)}catch{h(!1),g(!0)}}return v.useEffect(()=>{c&&y&&p.current!==y&&(p.current=y,w())},[y,c]),e.status==="completed"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-signin-success",role:"status"},n.createElement(Pt,null),E&&!((N=e.account)!=null&&N.planEnabled)?"Signed in. Plan access needs permission.":o?"Signed in. Choose your model below.":"Signed in successfully."),E&&n.createElement(Ep,{account:e.account})," ",E&&((x=e.account)==null?void 0:x.connected)&&!((A=e.account)!=null&&A.planEnabled)&&i&&n.createElement("button",{className:"a-primary",disabled:r,onClick:i},"Enable ChatGPT plan access"),e.showPlanWelcome&&!l&&n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"You’re using your ChatGPT plan"),n.createElement("p",null,"Usage from this connection counts toward your ChatGPT plan."),s&&n.createElement("button",{className:"a-soft",onClick:s},"Got it"))):n.createElement("div",{className:"a-device-signin"},S?n.createElement(n.Fragment,null,E?n.createElement(n.Fragment,null,n.createElement("p",{role:"status"},b?"Finish signing in on this host’s browser.":"Preparing secure sign-in…"),b&&n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Continue with ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption"},"Waiting for sign-in. This page will continue automatically.")):y?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:u},"1. Copy your sign-in code"),n.createElement("div",{className:"a-device-code"},n.createElement("input",{id:u,ref:d,readOnly:!0,value:y,spellCheck:!1,onFocus:C=>C.target.select(),onClick:C=>C.currentTarget.select()}),n.createElement("button",{className:"a-soft",type:"button","aria-label":"Copy sign-in code",onClick:w},m?n.createElement(Pt,null):n.createElement(rr,null),m?"Copied":"Copy")),n.createElement("p",{className:"a-caption",role:"status"},m?"Copied to your clipboard.":f?"Select the code to copy it, or use the Copy button.":"Keep this code ready for the next step.")):n.createElement("p",{role:"status"},"Getting your sign-in code…"),y&&b&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-device-step"},"2. Open ChatGPT and paste the code"),n.createElement("a",{className:"a-primary",href:b,target:"_blank",rel:"noopener noreferrer"},"Open ChatGPT",n.createElement(sa,null)),n.createElement("p",{className:"a-caption",role:"status"},"Waiting for sign-in. This page will continue automatically.")),n.createElement("button",{className:"a-link",type:"button",disabled:r,"data-action":"providers.loginCancel",onClick:t},"Cancel sign-in")):n.createElement(n.Fragment,null,n.createElement("p",{role:e.error?"alert":"status"},e.error||"Sign-in was cancelled. You can try again."),n.createElement("button",{className:"a-primary",disabled:r,"data-action":"providers.login",onClick:a},"Try sign-in again")))}function gr({title:e,description:t,onClick:a,Icon:r=Dr,page:o,count:i,disabled:s=!1}){return n.createElement("button",{type:"button",className:"a-everyday-row",disabled:s,"data-action":"view.update","data-settings-destination":o,onClick:a},r!==Dr&&n.createElement(r,{"aria-hidden":"true"}),n.createElement("span",null,n.createElement("strong",null,e),t&&n.createElement("small",null,t)),n.createElement(Da,{count:i}),n.createElement(en,{"aria-hidden":"true"}))}function sD({navigate:e,state:t}){var r,o,i,s;const a=[["recall","Memory & past work","Choose what is saved and reused. Review and correct memories.",Lk],["workspaces","Files & folders","Choose where new workspaces are created.",nr],["permissions","File access","Review additional allowed and blocked folders.",px],["desktop","Screen & computer access","Check the host, browser, and permission status.",Lu],["history","Saved work","Import, export, and review cleanup.",wi],["diagnostics","App diagnostic capture","Review recorded data and forwarding destinations.",mo]];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Your saved work, memory, and access choices."),n.createElement("div",{className:"a-everyday-list"},a.filter(l=>l[0]!=="diagnostics").map(([l,c,u,d])=>{var p,m;return n.createElement(gr,{key:l,count:(m=(p=t.attention)==null?void 0:p.pages)==null?void 0:m[l],page:l,title:c,description:u,Icon:d,onClick:()=>e(l)})})),n.createElement("h4",null,"Diagnostics"),n.createElement("div",{className:"a-everyday-list"},n.createElement(gr,{page:"diagnostics",count:(o=(r=t.attention)==null?void 0:r.pages)==null?void 0:o.diagnostics,title:"App diagnostic capture",description:"Review collected records and forwarding.",Icon:mo,onClick:()=>e("diagnostics")})),n.createElement("div",{className:"a-everyday-footer"},n.createElement(gr,{page:"repair",count:(s=(i=t.attention)==null?void 0:i.pages)==null?void 0:s.repair,title:"Backups & recovery",description:"Create a private backup or troubleshoot this app.",onClick:()=>e("repair")})))}function lD({sections:e,navigate:t,state:a}){const r=e.flatMap(i=>i.pages).filter(([i])=>i.startsWith("shell:")),o=[{title:"Model rules",description:"Routing profiles, roles, and model preference.",page:"routing"},{title:"Provider configuration",description:"Instance names, credentials, and custom providers.",page:"providers"},{title:"Bundles & modules",description:"Composition, discovery, defaults, registries, and loaded modules.",pages:["app-bundles","add-bundles","defaults","loaded-modules","share-bundle","registries"]},{title:"Tool connections",description:"MCP connections, installation sources, and authentication.",page:"tool-connections"},{title:"Custom appearance",description:"Import, export, theme folders, and custom CSS.",page:"custom-appearance"},{title:"Conversation & work",description:"Current conversation, outputs, review, and publishing.",pages:["conversation","outputs","publishing"]},{title:"Performance & runtime",description:"Ready conversations, session controls, and terminal access.",pages:["ready-conversations","runtime","automation","install-app"]},{title:"Troubleshooting & recovery",description:"Diagnostics, backups, repair, and reset options.",pages:["diagnostics","repair","reset"]}];return n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"The full configuration, when you need it."),n.createElement("div",{className:"a-everyday-list"},o.map(i=>{var s,l;return i.page?n.createElement(gr,{key:i.title,title:i.title,description:i.description,page:i.page,count:(l=(s=a.attention)==null?void 0:s.pages)==null?void 0:l[i.page],onClick:()=>t(i.page)}):n.createElement("details",{className:"a-advanced-group",key:i.title},n.createElement("summary",null,n.createElement("span",null,n.createElement("strong",null,i.title),n.createElement("small",null,i.description)),n.createElement(Da,{count:i.pages.reduce((c,u)=>{var d,p;return c+(((p=(d=a.attention)==null?void 0:d.pages)==null?void 0:p[u])||0)},0)}),n.createElement(en,null)),n.createElement("div",null,i.pages.map(c=>{var u,d;return n.createElement(gr,{key:c,page:c,count:(d=(u=a.attention)==null?void 0:u.pages)==null?void 0:d[c],title:bp(c,e),onClick:()=>t(c)})})))})),r.length>0&&n.createElement(n.Fragment,null,n.createElement("h4",null,"Extension settings"),n.createElement("div",{className:"a-everyday-list"},r.map(([i,s])=>{var l,c;return n.createElement(gr,{key:i,page:i,count:(c=(l=a.attention)==null?void 0:l.pages)==null?void 0:c[i],title:s,Icon:qr,onClick:()=>t(i)})}))))}const Yw=v.createContext(null);function Gw(e,t){const a=v.useContext(Yw);v.useEffect(()=>{a==null||a.register(e,t)}),v.useEffect(()=>()=>a==null?void 0:a.remove(e),[a,e])}function cD(){const e=v.useRef(new Map),t=v.useRef(null),[a,r]=v.useState(0),[o,i]=v.useState(null),s=v.useCallback(()=>r([...e.current.values()].filter(f=>f.dirty).length),[]),l=v.useCallback((f,g)=>{var y;const E=!!((y=e.current.get(f))!=null&&y.dirty)!=!!g.dirty;e.current.set(f,g),E&&s()},[s]),c=v.useCallback(f=>{e.current.delete(f)&&s()},[s]),u=v.useMemo(()=>({register:l,remove:c}),[l,c]),d=v.useCallback(()=>[...e.current.values()].some(f=>f.dirty),[]),p=v.useCallback(()=>{const f=[...e.current.values()].filter(y=>y.dirty);if(!f.length)return Promise.resolve(!0);if(t.current)return t.current.promise;let g;const E=new Promise(y=>{g=y});return t.current={promise:E,resolve:g},i(f),E},[]),m=f=>{const g=t.current;t.current=null,i(null),g==null||g.resolve(f)};v.useEffect(()=>{if(!a)return;const f=g=>{g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[a]),v.useEffect(()=>()=>{var f;(f=t.current)==null||f.resolve(!1)},[]);const h=o&&n.createElement("div",{className:"a-settings-draft-overlay"},n.createElement("div",{className:"a-settings-draft-confirm",role:"alertdialog","aria-modal":"true","aria-labelledby":"settings-unsaved-title",onKeyDown:f=>{var g;if(f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),m(!1)),f.key==="Tab"){const E=[...f.currentTarget.querySelectorAll("button")],y=E.indexOf(document.activeElement);f.preventDefault(),(g=E[(y+(f.shiftKey?-1:1)+E.length)%E.length])==null||g.focus()}}},n.createElement("h3",{id:"settings-unsaved-title"},"Unsaved connection changes"),n.createElement("p",null,"Your changes have not been saved. Review them before closing Settings, or discard them."),n.createElement("ul",null,o.map(f=>n.createElement("li",{key:f.label},f.label))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",autoFocus:!0,onClick:()=>{o[0].review(),m(!1)}},"Review and save"),n.createElement("button",{type:"button",className:"a-soft a-danger",onClick:()=>{o.forEach(f=>f.discard()),m(!0)}},"Discard changes"),n.createElement("button",{type:"button",className:"a-soft",onClick:()=>m(!1)},"Keep settings open"))));return{context:u,confirmClose:p,hasUnsaved:d,count:a,dialog:h}}function uD({value:e,children:t}){return n.createElement(Yw.Provider,{value:e},t)}function dD(e,t,a){const[r,o]=v.useState(e),i=v.useRef(a);return i.current=a,v.useEffect(()=>{if(e===r)return;const s=u=>u==="settings"||u==="appearance",l=t.current;if(!s(r)||s(e)||!(l!=null&&l.hasUnsaved())){o(e);return}let c=!0;return l.confirmClose().then(u=>{c&&(u?o(e):i.current(r))}),()=>{c=!1}},[e,r,t]),r}function xa(e,t,a,r,o,i,{simple:s=!1}={}){var h,f;const l=((f=(h=e.view)==null?void 0:h.settingsFilters)==null?void 0:f[a])||"",[c,u]=v.useState(l);v.useEffect(()=>u(l),[l]);const d=nl(r,c,o),p=g=>{var E;u(g),t("view.update",{patch:{settingsFilters:{...(E=e.view)==null?void 0:E.settingsFilters,[a]:g}}})},m=n.createElement("div",{className:"a-list-filter"},n.createElement("label",{htmlFor:"filter-"+a},n.createElement(To,null),i),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"filter-"+a,type:"search",value:c,placeholder:s?i:"Search or pattern, e.g. *openai*","data-action":"view.update",onChange:g=>p(g.target.value)}),c&&n.createElement("button",{type:"button",className:"a-icon","aria-label":"Clear "+i.toLowerCase(),"data-action":"view.update",onClick:()=>p("")},n.createElement(nn,null))),n.createElement("small",{role:"status"},d.length," of ",r.length,c&&!d.length?" · No matches":"",!s&&n.createElement(n.Fragment,null," · Text search or wildcards: * ? [abc] [!abc]")));return[d,m,c]}function wp({id:e,label:t="Model",value:a="",onChange:r,onCommit:o,entry:i,models:s,state:l,act:c,disabled:u=!1,placeholder:d="Enter a model ID",catalogKey:p=e,editable:m=!1}){var S;const h=(i==null?void 0:i.phase)==="working"||(i==null?void 0:i.phase)==="queued",f=v.useRef(null),g=v.useRef(null);let E=zl((i==null?void 0:i.models)??s??[]);!m&&(h||(i==null?void 0:i.phase)==="error")&&!E.length&&((S=f.current)==null?void 0:S.key)===p&&(E=f.current.models),!h&&(i==null?void 0:i.phase)!=="error"&&(f.current={key:p,models:E}),Zu(g,h);const[y,b]=xa(l,c,"model-picker-"+e,E,w=>[w.id,w.name],"Filter "+t.toLowerCase());return m?n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},n.createElement("input",{list:E.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),E.length>0&&n.createElement(n.Fragment,null,n.createElement("datalist",{id:e+"-options"},E.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))),E.length>12&&b,n.createElement("select",{id:e+"-catalog","aria-label":"Choose "+t.toLowerCase()+" from catalog",value:E.some(w=>w.id===a)?a:"",disabled:u,"data-action":"view.update",onChange:w=>{w.target.value&&(r(w.target.value),o==null||o(w.target.value))}},n.createElement("option",{value:""},"Choose from ",E.length," cached models…"),y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),h&&n.createElement("small",{role:"status"},E.length?"Refreshing in the background. Saved models are available.":"Discovering models. You can enter a model ID now."),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.loadedAt)&&n.createElement("small",null,"Catalog checked ",new Date(i.loadedAt*1e3).toLocaleString()),(i==null?void 0:i.phase)==="ready"&&!E.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID.")):n.createElement("div",{className:"a-model-select",ref:g,"data-activity-region":"models"},E.length>12&&b,(i==null?void 0:i.phase)!=="error"&&(E.length||h)?n.createElement("select",{id:e,"aria-label":t,value:a,disabled:u||h&&!E.length,"data-action":"view.update",onChange:w=>{r(w.target.value),o==null||o(w.target.value)}},n.createElement("option",{value:""},h?"Loading provider models…":"Choose a model…"),a&&!y.some(w=>w.id===a)&&n.createElement("option",{value:a},a," (selected)"),y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name))):n.createElement(n.Fragment,null,n.createElement("input",{list:E.length?e+"-options":void 0,id:e,"aria-label":t,value:a,disabled:u,placeholder:d,"data-action":"view.update",onChange:w=>r(w.target.value),onBlur:w=>o==null?void 0:o(w.target.value)}),E.length>0&&n.createElement("datalist",{id:e+"-options"},y.map(w=>n.createElement("option",{key:w.id,value:w.id},w.name)))),(i==null?void 0:i.phase)==="error"&&n.createElement("small",{className:"a-danger",role:"status"},i.error||"Model list unavailable. Enter a model ID or refresh this provider."),(i==null?void 0:i.phase)==="ready"&&!E.length&&n.createElement("small",null,i.supported===!1?"This provider does not supply a model list.":"This provider returned no models."," Enter a model ID."))}function Qw(e){const t=r=>{var o;return((o=r.info)==null?void 0:o.id)||r.module||r.id},a=new Map;for(const r of e)a.set(t(r),(a.get(t(r))||0)+1);return e.map(r=>{var o;return{id:r.id,label:(((o=r.info)==null?void 0:o.display_name)||t(r))+(a.get(t(r))>1?` (${r.id})`:"")}}).sort((r,o)=>r.label.localeCompare(o.label,void 0,{sensitivity:"base"}))}const zf={"provider-anthropic":"git+https://github.com/microsoft/amplifier-module-provider-anthropic@main","provider-azure-openai":"git+https://github.com/microsoft/amplifier-module-provider-azure-openai@main","provider-chat-completions":"git+https://github.com/microsoft/amplifier-module-provider-chat-completions@main","provider-gemini":"git+https://github.com/microsoft/amplifier-module-provider-gemini@main","provider-github-copilot":"git+https://github.com/microsoft/amplifier-module-provider-github-copilot@main","provider-ollama":"git+https://github.com/microsoft/amplifier-module-provider-ollama@main","provider-openai":"git+https://github.com/microsoft/amplifier-module-provider-openai@main","provider-openai-chatgpt":"git+https://github.com/microsoft/amplifier-module-provider-openai-chatgpt@main","provider-vllm":"git+https://github.com/microsoft/amplifier-module-provider-vllm@main"},kp=[{module:"provider-github-copilot",name:"GitHub Copilot Subscription",description:"Use your GitHub Copilot subscription.",auth:"token"},{module:"provider-openai-chatgpt",name:"ChatGPT Subscription",description:"Sign in with your ChatGPT account.",auth:"signin"},{module:"provider-openai",name:"OpenAI API",description:"Use an API key. API billing is separate from ChatGPT.",auth:"key"},{module:"provider-anthropic",name:"Anthropic API",description:"Connect with your Anthropic API key.",auth:"key"},{module:"provider-gemini",name:"Google Gemini API",description:"Connect with your Gemini API key.",auth:"key"},{module:"provider-chat-completions",name:"OpenAI Compatible API",description:"Connect a local model or another compatible service.",auth:"optional-key"}],pD=[...kp,{module:"provider-azure-openai",name:"Azure OpenAI"},{module:"provider-ollama",name:"Ollama"},{module:"provider-vllm",name:"vLLM"}],Ic=Object.keys(zf).map(e=>({...pD.find(t=>t.module===e),module:e,source:zf[e]}));function Ac(e){return kp.find(t=>t.module===e)||{module:e,name:(e==null?void 0:e.replace(/^provider-/,""))||"AI service",auth:"key"}}function mD(e,t,a){var r,o;return(o=(r=e.setup)==null?void 0:r.operations)==null?void 0:o[t+":"+a]}function Lf(e){return["working","pending","queued"].includes(e==null?void 0:e.phase)}function hD(e,t){if(!t)return null;const a=mD(e,t.action,t.id);return(a==null?void 0:a.commandId)===t.commandId?a:null}function fD({state:e,session:t,act:a,navigate:r}){var j,ie,Ee,me,_e,Je,De,ue,ye,M,Y,se,Fe,je;const o=v.useContext(Kr),i=e.setup||{},s=(i.providers||[]).filter(oe=>oe.enabled!==!1),l=new Map(Qw(s.map(oe=>({...oe,info:{id:oe.module,display_name:Ac(oe.module).name}}))).map(oe=>[oe.id,oe.label])),c=((j=e.view)==null?void 0:j.aiConnectionEditor)||{},u=c.step||"list",d=Ac(c.module),p=s.find(oe=>oe.id===c.id),m=Or(c.authMode||((ie=p==null?void 0:p.config)==null?void 0:ie.auth_mode)),h={id:c.id,authMode:m,scope:c.scope||"global"},[f,g]=v.useState(""),[E,y]=v.useState(""),[b,S]=v.useState(""),[w,N]=v.useState(null),x=v.useRef(!1),A=v.useRef(t==null?void 0:t.workspace),C=v.useRef(0),O=v.useRef(!0),k=oe=>a("view.update",{patch:{aiConnectionEditor:{...c,...oe}}});v.useEffect(()=>(O.current=!0,()=>{O.current=!1,C.current++}),[]),v.useEffect(()=>{A.current!==(t==null?void 0:t.workspace)&&(C.current++,A.current=t==null?void 0:t.workspace,g(""),N(null),x.current=!1,k({step:"list",id:"",model:""})),a("providers.list",t?{sessionId:t.id}:{}),a("routing.list")},[t==null?void 0:t.workspace]);async function T(oe,Ze={},it=""){if(x.current)return;x.current=!0;const zt=++C.current;y(""),S(""),N({action:oe,id:Ze.id||Ze.module||"",commandId:null,next:it});try{const ct=await a(oe,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(oe)?{sessionId:t.id}:{},...Ze});if(!O.current||zt!==C.current)return;if(!(ct!=null&&ct.accepted)||!ct.operationId)throw Error((ct==null?void 0:ct.error)||"The request could not be confirmed. Please try again.");N({action:oe,id:Ze.id||Ze.module||"",commandId:ct.operationId,next:it})}catch(ct){O.current&&zt===C.current&&(y(ct.message),N(null),x.current=!1)}}const I=hD(e,w),F=!!w;v.useEffect(()=>{var it;if(!I||Lf(I))return;const oe=w.next,Ze=w.action;if(N(null),x.current=!1,I.phase==="error"){y(I.error||"The request did not finish. Your choices are kept.");return}I.phase==="ready"&&(Ze==="providers.save"?(g(""),k({saved:!0,...oe==="models"?{step:"model"}:{}}),oe==="signin"?T("providers.login",h):oe==="models"&&T("providers.models",{id:c.id})):Ze==="providers.remove"?(g(""),k({step:"list",id:"",saved:!1}),S("Connection removed. Chats that used it will need a replacement connection when resumed.")):Ze==="providers.finishSetup"?(k({step:"list",saved:!1}),S((it=i.setupCompletion)!=null&&it.routingSelected?"Connection saved. Balanced model rules are ready for new conversations.":"Model saved. Existing model rules are unchanged.")):Ze==="providers.models"&&S("Model list checked. No chat request was sent."))},[I==null?void 0:I.commandId,I==null?void 0:I.phase]);const z=((Ee=i.login)==null?void 0:Ee.providerId)===c.id?i.login:null;v.useEffect(()=>{var oe;o.active&&u==="connect"&&c.saved&&(z==null?void 0:z.status)==="completed"&&(z.authMode!=="chatgpt_plan"||(oe=z.account)!=null&&oe.planEnabled)&&z.loginId!==c.previousLoginId&&!F&&(k({step:"model"}),T("providers.models",{id:c.id}))},[u,c.saved,z==null?void 0:z.status,z==null?void 0:z.loginId,F,o.active]);const q=(me=i.providerCatalogs)==null?void 0:me[c.id],W=zl((q==null?void 0:q.models)||((_e=i.modelCatalogs)==null?void 0:_e[c.id])||[]),X=Lf((Je=i.operations)==null?void 0:Je["providers.models:"+c.id])||(q==null?void 0:q.phase)==="working",U=((De=i.credentialCheck)==null?void 0:De.module)===c.module?i.credentialCheck:null,_=c.credentialMode==="auto"?U!=null&&U.githubCliAvailable?"github-cli":U!=null&&U.available?"environment":"private":c.credentialMode||"private",P=oe=>{Ac(oe).auth!=="signin"&&T("providers.credentials",{module:oe})},G=oe=>{x.current||(g(""),y(""),S(""),k({step:"connect",module:oe.module,id:oe.module.replace("provider-","")+"-"+crypto.randomUUID().slice(0,8),model:"",baseUrl:"",previousLoginId:null,scope:"global",authMode:"chatgpt_codex",saved:!1,credentialMode:"auto",initializeRouting:s.length===0}),P(oe.module))},Z=()=>{var oe;return T("providers.save",{id:c.id,module:c.module,config:{...p==null?void 0:p.config,...d.auth==="optional-key"?{base_url:(oe=c.baseUrl)==null?void 0:oe.trim()}:{}},scope:c.scope||"global",...d.auth==="signin"?{}:_==="environment"?{apiKeyEnv:U==null?void 0:U.envVar}:_==="github-cli"?{useGitHubCli:!0}:{apiKey:f}},d.auth==="signin"?"signin":"models")},D=()=>{y(""),k({step:u==="services"||u==="detail"?"list":u==="model"?"detail":"services"})},ne=()=>r("providers"),H=!!f||u==="connect"&&!!c.baseUrl&&c.baseUrl!==(((ue=p==null?void 0:p.config)==null?void 0:ue.base_url)||"")||u==="model"&&!!c.model&&c.model!==(((ye=p==null?void 0:p.config)==null?void 0:ye.default_model)||((M=p==null?void 0:p.config)==null?void 0:M.model)||"");return Gw("ai-connections",{label:"AI connection setup",dirty:H,review:()=>{r("ai-connections"),k({step:u})},discard:()=>{g(""),y(""),k({step:"list",id:"",module:"",model:"",baseUrl:"",saved:!1})}}),n.createElement("section",{"data-part":"ai-connections",className:"a-ai-form"},u==="list"?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-everyday-intro"},"Connect the AI services Amplifier can use for your work."),s.length?n.createElement(n.Fragment,null,n.createElement("div",{className:"a-everyday-list"},s.map(oe=>{var Ze,it,zt,ct;return n.createElement(gr,{key:oe.id,disabled:F,title:l.get(oe.id),description:(((Ze=oe.config)==null?void 0:Ze.default_model)||((it=oe.config)==null?void 0:it.model)||"Choose a model")+" · "+(oe.accountConnected?"Account connected":oe.credentialsConfigured?"Credentials available":oe.keySource==="provider-managed"?"Account sign-in":"Connection needs setup")+((ct=(zt=oe.credential)==null?void 0:zt.preview)!=null&&ct.masked?" · Key "+oe.credential.preview.masked:""),onClick:()=>{var qt,le,fe,xe,ze;y(""),S(""),k({step:"detail",id:oe.id,module:oe.module,authMode:Or((qt=oe.config)==null?void 0:qt.auth_mode),model:((le=oe.config)==null?void 0:le.default_model)||((fe=oe.config)==null?void 0:fe.model)||"",scope:"global",baseUrl:((xe=oe.config)==null?void 0:xe.base_url)||"",previousLoginId:(ze=i.login)==null?void 0:ze.loginId,saved:!0,initializeRouting:!1})}})})),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect another service")):n.createElement("div",{className:"a-ai-welcome"},n.createElement(hx,{"aria-hidden":"true"}),n.createElement("h4",null,"Start with one connection"),n.createElement("p",null,"Choose a service, connect your account, and choose a model. You can add more later."),n.createElement("button",{className:"a-primary","data-action":"view.update",disabled:F,onClick:()=>k({step:"services"})},n.createElement(Ln,null),"Connect AI")),i.active&&s.length>0&&n.createElement("div",{className:"a-ai-hint"},"Your model rules are saved. ",n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>r("routing")},"Advanced model rules")),n.createElement("div",{className:"a-everyday-footer"},n.createElement("p",{className:"a-caption"},"Connections are stored on the Amplifier host. Existing conversations keep their settings."),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Advanced connection settings",n.createElement(sa,null)))):n.createElement(n.Fragment,null,n.createElement("button",{className:"a-link","data-action":"view.update",disabled:F,onClick:D},n.createElement(Sa,null),"Back"),u==="services"?n.createElement(n.Fragment,null,n.createElement("h4",null,"Which service would you like to use?"),n.createElement("div",{className:"a-everyday-list"},kp.map(oe=>n.createElement(gr,{key:oe.module,disabled:F,title:oe.name,description:oe.description,onClick:()=>G(oe)}))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Other provider or custom endpoint")):n.createElement(n.Fragment,null,n.createElement("p",{className:"a-ai-step"},u==="connect"?"1 · Connect":u==="model"?"2 · Choose a model":"Saved connection"),n.createElement("h4",null,l.get(c.id)||d.name),u==="detail"?n.createElement(n.Fragment,null,d.auth==="signin"&&n.createElement(Ep,{account:p==null?void 0:p.account}),n.createElement("p",null,p!=null&&p.accountConnected?"Your ChatGPT account is connected.":p!=null&&p.credentialsConfigured?"This connection has credentials available on the Amplifier host.":"This connection needs credentials before it can be used."),n.createElement("p",null,"Model: ",n.createElement("strong",null,((Y=p==null?void 0:p.config)==null?void 0:Y.default_model)||((se=p==null?void 0:p.config)==null?void 0:se.model)||"Not selected")),n.createElement(Tu,{credential:p==null?void 0:p.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:F,onClick:()=>T("providers.list")},n.createElement(Mt,null),"Refresh credentials"),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary","data-action":"providers.models",disabled:F,onClick:()=>{k({step:"model"}),T("providers.models",{id:c.id})}},"Choose model"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:F,onClick:()=>{k({step:"connect",previousLoginId:z==null?void 0:z.loginId,credentialMode:"private"}),P(c.module)}},d.auth==="signin"?p!=null&&p.accountConnected?"Reconnect account":"Sign in":"Change credentials"),n.createElement("button",{className:"a-soft","data-action":"providers.test",disabled:F,onClick:()=>T("providers.test",{id:c.id})},"Check connection")),n.createElement("p",{className:"a-caption"},"Checking verifies the model catalog, without sending a chat request."),n.createElement(Zw,{key:c.id,state:e,id:c.id,sessionId:t==null?void 0:t.id,act:a,disabled:F}),n.createElement("div",{className:"a-dialog-actions a-connection-secondary-actions"},n.createElement("button",{className:"a-soft a-danger","data-action":"providers.remove",disabled:F,onClick:()=>T("providers.remove",{id:c.id,scope:c.scope||"global"})},n.createElement(ea,null),"Remove connection"),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full connection settings"))):u==="connect"?n.createElement(n.Fragment,null,d.auth==="signin"?n.createElement(n.Fragment,null,z&&z.loginId!==c.previousLoginId?n.createElement(Au,{login:z,busy:F,onCancel:()=>T("providers.loginCancel",{id:c.id}),onRetry:()=>T("providers.login",h),onEnablePlan:()=>T("providers.login",{...h,enablePlan:!0})}):n.createElement(n.Fragment,null,n.createElement(Kw,{mode:m,onChange:oe=>k({authMode:oe}),disabled:F}),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":p?"providers.login":"providers.save",disabled:F,onClick:()=>p?T("providers.login",h):Z()},F?"Getting ready…":m==="chatgpt_plan"?"Continue with ChatGPT":"Get sign-in code")))):n.createElement(n.Fragment,null,d.auth==="optional-key"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-base-url"},"API base URL"),n.createElement("input",{id:"ai-base-url",type:"url",placeholder:"http://localhost:1234/v1",value:c.baseUrl||"",disabled:F,onChange:oe=>k({baseUrl:oe.target.value})}),n.createElement("p",{className:"a-caption"},"Use an address reachable from the computer running Amplifier. Include /v1 if your service requires it.")),((U==null?void 0:U.available)||(U==null?void 0:U.githubCliAvailable))&&n.createElement("fieldset",{className:"a-credential-options"},n.createElement("legend",null,"How would you like to connect?"),U.available&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="environment",onChange:()=>{g(""),k({credentialMode:"environment"})}}),n.createElement("span",null,n.createElement("strong",null,"Use the key already on this host"),n.createElement("small",null,"Found ",U.envVar,". Only its name is saved; the key stays in the environment."))),U.githubCliAvailable&&n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="github-cli",onChange:()=>{g(""),k({credentialMode:"github-cli"})}}),n.createElement("span",null,n.createElement("strong",null,"Use GitHub CLI sign-in"),n.createElement("small",null,"Use the host’s signed-in GitHub account. Its token is saved privately for this connection."))),n.createElement("label",null,n.createElement("input",{type:"radio",name:"ai-credential",checked:_==="private",onChange:()=>k({credentialMode:"private"})}),n.createElement("span",null,n.createElement("strong",null,"Use a different key"),n.createElement("small",null,"Connect another account or enter a key yourself.")))),_==="environment"&&n.createElement(Tu,{credential:U}),_==="private"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-private-key"},d.auth==="token"?"GitHub token":d.auth==="optional-key"?"API key (optional)":"API key"),n.createElement("input",{id:"ai-private-key",type:"password",autoComplete:"off",spellCheck:!1,value:f,onChange:oe=>g(oe.target.value),disabled:F}),n.createElement("p",{className:"a-caption"},d.auth==="optional-key"?"Leave blank if your local service does not need a key.":"Stored privately for this connection. Other accounts keep their own keys.")),d.auth==="token"&&!(U!=null&&U.githubCliAvailable)&&!(U!=null&&U.available)&&n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"Help connecting GitHub Copilot"),n.createElement("div",null,n.createElement("p",null,"Sign in to GitHub CLI on the computer running Amplifier, then check again. Or use a GitHub token for an account with Copilot access."),n.createElement("a",{href:"https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli",target:"_blank",rel:"noreferrer"},"GitHub setup guide"),n.createElement("button",{className:"a-link",disabled:F,onClick:()=>P(c.module)},"Check host sign-in again"))),n.createElement(Rn,null,n.createElement("button",{className:"a-primary","data-action":"providers.save",disabled:F||d.auth==="optional-key"&&!/^https?:\/\/[^\s]+$/.test(c.baseUrl||"")||(_==="environment"?!(U!=null&&U.available):_==="github-cli"?!(U!=null&&U.githubCliAvailable):d.auth!=="optional-key"&&!f.trim()),onClick:Z},F?"Connecting…":"Save and check connection")))):u==="model"?n.createElement(n.Fragment,null,(z==null?void 0:z.status)==="completed"&&n.createElement(Au,{login:z,chooseModel:!0,welcomeDismissed:c.welcomedLoginId===z.loginId,onWelcomeDismiss:()=>k({welcomedLoginId:z.loginId})}),n.createElement("p",null,"Choose from the models available through this connection."),W.length>0?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model"},"Model"),n.createElement(wp,{id:"ai-model",label:"Model",value:c.model||"",catalogKey:c.id,entry:{...q,models:W,phase:"ready"},state:e,act:a,onChange:oe=>k({model:oe})})):n.createElement("p",{role:"status"},X?"Loading models…":"No model list is available yet. Retry or enter a model ID under More options."),X&&W.length>0&&n.createElement("p",{className:"a-caption",role:"status"},"Refreshing in the background. Saved models remain available."),(q==null?void 0:q.phase)==="error"&&n.createElement(nt,{phase:"error",message:q.error||"Could not refresh the model list. Saved choices are kept."}),n.createElement("button",{className:"a-link","data-action":"providers.models",disabled:F||X,onClick:()=>T("providers.models",{id:c.id,refresh:!0})},n.createElement(Mt,null),"Refresh models"),n.createElement("div",{className:"a-ai-hint"},c.initializeRouting?"Balanced model rules choose suitable models for each task. This connection’s default is used when no rule applies.":"This changes the connection’s default model. Existing model rules may choose a different model."),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:F||!((Fe=c.model)!=null&&Fe.trim()),"data-action":"providers.finishSetup",onClick:()=>T("providers.finishSetup",{id:c.id,model:c.model,scope:c.scope||"global",initializeRouting:!!c.initializeRouting})},F?"Saving…":"Finish setup"))):null,n.createElement("details",{className:"a-everyday-disclosure"},n.createElement("summary",null,"More options"),n.createElement("div",null,n.createElement("label",{htmlFor:"ai-scope"},"Save for"),n.createElement("select",{id:"ai-scope",value:c.scope||"global",disabled:F,"data-action":"view.update",onChange:oe=>k({scope:oe.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"local"},"This workspace on this host"),n.createElement("option",{value:"project"},"This project (shareable configuration)")),u==="model"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"ai-model-manual"},"Model ID"),n.createElement("input",{id:"ai-model-manual",value:c.model||"",disabled:F,"data-action":"view.update",onChange:oe=>k({model:oe.target.value})})),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:ne},"Full provider configuration"))))),E&&n.createElement(nt,{phase:"error",message:E}),b&&n.createElement(nt,{phase:"ready",message:b}),F&&n.createElement(nt,{phase:"working",message:"Working on this connection…"}),!F&&((je=i.test)==null?void 0:je.providerId)===c.id&&u==="detail"&&n.createElement(nt,{phase:i.test.reachable===!1?"error":"ready",message:i.test.reachable===!1?"Connection check failed.":"Model catalog check passed."}))}function Va({id:e,label:t,description:a,selected:r,onSelect:o,checked:i,onCheck:s,disabled:l,badge:c,checkLabel:u,checkAction:d="view.update"}){return n.createElement("div",{className:"a-collection-row"+(r?" selected":""),"data-collection-id":e},s&&n.createElement("label",{className:"a-collection-check"},n.createElement("input",{type:"checkbox","aria-label":u||"Select "+t,checked:!!i,disabled:l,"data-action":d,onChange:p=>s(p.target.checked)})),n.createElement("button",{type:"button","aria-current":r?"true":void 0,"data-action":"view.update",onClick:o},n.createElement("span",null,n.createElement("strong",null,t),a&&n.createElement("small",null,a)),c&&n.createElement("small",{className:"a-collection-badge"},c),n.createElement(en,{"aria-hidden":"true"})))}function Co({list:e,children:t,detailOpen:a=!0,onBack:r,label:o="items"}){const i=v.useRef(null),s=v.useRef(null),l=v.useContext(Kr);v.useEffect(()=>{var u;a&&l.compact&&((u=s.current)==null||u.focus({preventScroll:!0}))},[a,l.compact]);const c=()=>{r==null||r(),requestAnimationFrame(()=>{var u,d;return(d=(u=i.current)==null?void 0:u.querySelector("button[aria-current=true],button"))==null?void 0:d.focus({preventScroll:!0})})};return n.createElement("div",{className:"a-collection"+(a?" detail-open":"")},n.createElement("div",{className:"a-collection-list",ref:i},e),n.createElement("div",{className:"a-collection-detail",ref:s,tabIndex:-1},r&&!l.compact&&n.createElement("button",{type:"button",className:"a-link a-collection-back","data-action":"view.update",onClick:c},n.createElement(Sa,null),"Back to ",o),t))}function xp({title:e,description:t,items:a,ids:r,onChange:o,onSave:i,onCancel:s,busy:l=!1,error:c,notice:u,action:d="view.update"}){const[p,m]=v.useState(!1);return n.createElement("section",{className:"a-order-editor"},n.createElement("h4",null,e),u&&n.createElement("p",{role:"status"},u),n.createElement("p",null,t),n.createElement("p",{className:"a-caption"},"Drag the handle or choose a position. Changes apply when you save."),n.createElement(kg,{items:a,ids:r,onChange:o,onDraggingChange:m,busy:l,className:"a-order-list",rowClassName:"a-order-item",floatingClassName:"a-order-item",savedHint:"Save order to apply.",renderItem:(h,{handle:f,index:g,move:E})=>n.createElement(n.Fragment,null,f,n.createElement("span",{className:"a-order-copy"},n.createElement("strong",null,h.label),n.createElement("small",null,h.description)),n.createElement("span",{className:"a-order-arrows"},n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===0,"aria-label":"Move "+h.label+" up","data-action":"view.update",onClick:()=>E(g-1)},n.createElement(Li,null)),n.createElement("button",{type:"button",className:"a-icon",disabled:l||g===r.length-1,"aria-label":"Move "+h.label+" down","data-action":"view.update",onClick:()=>E(g+1)},n.createElement(sg,null))),n.createElement("select",{"aria-label":"Position of "+h.label,value:g,disabled:l,"data-action":"view.update",onChange:y=>E(Number(y.target.value))},r.map((y,b)=>n.createElement("option",{key:b,value:b},b+1))))}),c&&n.createElement("p",{role:"alert",className:"a-danger"},c),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:l||p,"data-action":d,onClick:i},l?"Saving order…":"Save order"),n.createElement("button",{type:"button",className:"a-soft",disabled:l,"data-action":"view.update",onClick:s},"Cancel")))}const cr=e=>JSON.stringify(e,null,2),ms=e=>["queued","working","pending","running"].includes(e==null?void 0:e.phase);function gD({state:e,act:t}){var _,P,G,Z,D,ne,H,j,ie,Ee,me,_e,Je,De,ue,ye;v.useContext(Kr);const a=(_=e.view)==null?void 0:_.routingEditor,[r,o]=v.useState({name:"my-routing",scope:"global",matrix:null,newRole:"",...a}),i=v.useRef(r),[s,l]=v.useState({});v.useEffect(()=>{a&&(i.current=a,o(a))},[a]);const c=M=>{const Y={...i.current,...M};i.current=Y,o(Y),t("view.update",{patch:{routingEditor:Y}})},u=e.setup||{},d=u.providers||[],p=u.matrices||[],[m,h]=xa(e,t,"routing-profiles",p,M=>[M.name,M.description,M.source],"Filter routing profiles"),f=M=>{var Y;return s[M]||((Y=e.actionStatus)==null?void 0:Y[M])},g=async(M,Y={})=>{l(se=>({...se,[M]:{phase:"pending"}}));try{const se=await t(M,Y);return l(Fe=>({...Fe,[M]:se?null:{phase:"error",error:"Request could not be sent. Try again."}})),se}catch(se){l(Fe=>({...Fe,[M]:{phase:"error",error:se.message}}))}};v.useEffect(()=>{g("routing.list"),i.current.requested&&g("routing.show",{name:i.current.requested})},[]);const E=()=>({...r.profiles,...r.matrix?{[r.profileKey||r.name]:{matrix:r.matrix,name:r.name,role:r.role,candidate:r.candidate,rawText:r.rawText,raw:r.raw}}:{}}),y=M=>{const Y=E(),se=Y[M];se?c({...se,profileKey:M,requested:null,profiles:Y,order:null,error:"",detailOpen:!1,candidateOpen:!1}):(c({profileKey:M,requested:M,profiles:Y,order:null,error:""}),g("routing.show",{name:M}))};v.useEffect(()=>{if(u.matrix&&u.matrix.name===i.current.requested){const M=u.matrix;c({matrix:M,name:M.name,profileKey:M.name,requested:null,rawText:cr(M),raw:!1,role:Object.keys(M.roles||{})[0],candidate:0,detailOpen:!1,candidateOpen:!1,error:""})}},[u.matrix,r.requested]),v.useEffect(()=>{!i.current.matrix&&!i.current.requested&&p.length&&y(u.active||p[0].name)},[p]);const b=r.matrix||Mf(r.name),S=Object.entries(b.roles||{}),w=(P=b.roles)!=null&&P[r.role]?r.role:(G=S[0])==null?void 0:G[0],N=(Z=b.roles)==null?void 0:Z[w],x=(N==null?void 0:N.candidates)||[],A=Math.min(r.candidate||0,Math.max(0,x.length-1)),C=x[A],[O,k]=xa(e,t,"routing-roles",S,([M,Y])=>[M,Y.description,...(Y.candidates||[]).flatMap(se=>[se.provider,se.model])],"Filter task roles");v.useEffect(()=>{r.order&&r.orderOpen!==!1&&!Iu(x,w,r.order)&&c({order:Tc(x,w,r.order)})},[r.order,r.orderOpen,w,x]);const T=M=>c({matrix:M,rawText:cr(M),error:""}),I=M=>T(oD(b,w,A,M)),F=C?d.filter(M=>M.id===C.provider||M.module==="provider-"+C.provider||M.module===C.provider):[],z=F.find(M=>M.id===(C==null?void 0:C.provider)),q=z?[z]:F,W=[...new Map(q.flatMap(M=>{var Y;return(((Y=u.modelCatalogs)==null?void 0:Y[M.id])||[]).map(se=>[typeof se=="string"?se:se.id,se])}).filter(([M])=>M)).values()],X=z?(D=u.providerCatalogs)==null?void 0:D[z.id]:void 0;v.useEffect(()=>{var Y,se;const M=(Y=e.actionStatus)==null?void 0:Y["routing.save"];(M==null?void 0:M.phase)==="ready"&&((se=M.target)==null?void 0:se.name)===i.current.name&&c({profileKey:i.current.name})},[(H=(ne=e.actionStatus)==null?void 0:ne["routing.save"])==null?void 0:H.updatedAt]);const U=ms(f("routing.save"))||ms(f("routing.use"));return n.createElement("section",{className:"a-settings-section","data-part":"routing-settings","data-candidate-open":!!r.candidateOpen},n.createElement("div",{className:"a-settings-row"},n.createElement("p",null,"Choose models for each role. Routing uses the first resolvable choice."),n.createElement("button",{className:"a-icon","aria-label":"Refresh routing profiles","data-action":"routing.list",disabled:ms(f("routing.list")),onClick:()=>g("routing.list")},n.createElement(Mt,null))),u.routingCatalogError&&n.createElement(nt,{phase:"error",message:u.routingCatalogError}),n.createElement("div",{className:"a-routing-profile-picker"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-profile"},"Routing profile"),n.createElement("select",{id:"routing-profile",value:r.profileKey||"","data-action":"routing.show",onChange:M=>y(M.target.value)},n.createElement("option",{value:"",disabled:!0},"Choose a profile"),m.map(M=>n.createElement("option",{key:M.name,value:M.name},M.name,M.active||u.active===M.name?" · active":"")),r.profileKey&&!m.some(M=>M.name===r.profileKey)&&n.createElement("option",{value:r.profileKey},r.name," · draft"))),n.createElement("button",{className:"a-soft",disabled:!p.some(M=>M.name===r.profileKey)||u.active===r.profileKey||U||!!r.requested,"data-action":"routing.use",onClick:()=>g("routing.use",{name:r.profileKey,scope:r.scope})},"Use profile"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{const M=Mf();c({profiles:E(),matrix:M,name:M.name,profileKey:"new:"+Date.now(),requested:null,role:"general",candidate:0,rawText:cr(M),order:null,detailOpen:!1,candidateOpen:!1})}},n.createElement(Ln,null),"New profile")),r.requested&&n.createElement(nt,{phase:((j=f("routing.show"))==null?void 0:j.phase)==="error"?"error":"working",message:((ie=f("routing.show"))==null?void 0:ie.error)||"Opening "+r.requested+"…"}),r.requested&&((Ee=f("routing.show"))==null?void 0:Ee.phase)==="error"&&n.createElement("button",{className:"a-soft","data-action":"routing.show",onClick:()=>g("routing.show",{name:r.requested})},"Retry opening profile"),["routing.list","routing.use"].map(M=>{var Y;return((Y=f(M))==null?void 0:Y.phase)==="error"&&n.createElement(nt,{key:M,phase:"error",message:f(M).error})}),r.matrix&&n.createElement(n.Fragment,null,n.createElement("details",{className:"a-routing-profile-options",open:!!r.profileDetails},n.createElement("summary",{"data-action":"view.update",onClick:M=>{M.preventDefault(),c({profileDetails:!r.profileDetails})}},"Profile settings"),h,n.createElement("p",{className:"a-caption"},(me=p.find(M=>M.name===r.profileKey))==null?void 0:me.description),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"routing-name"},"Custom profile name"),n.createElement("input",{id:"routing-name",value:r.name,"data-action":"view.update",onChange:M=>c({name:M.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"routing-scope"},"Save for"),n.createElement("select",{id:"routing-scope",value:r.scope,"data-action":"view.update",onChange:M=>c({scope:M.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace"))))),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:w+" preference order",notice:r.order.notice,description:"Place your preferred choice first. Routing selects the first resolvable match; this is not a retry chain for failed API calls.",items:x.map((M,Y)=>({id:String(Y),label:M.model||"Choose a model",description:M.provider||"Choose a provider"})),ids:r.order.ids,onChange:M=>c({order:{...r.order,ids:M}}),onCancel:()=>c({order:null}),onSave:()=>{if(!Iu(x,w,r.order)){c({order:Tc(x,w,r.order)});return}const M=Pr(b,w,{candidates:r.order.ids.map(Y=>x[Number(Y)])});c({order:null,matrix:M,rawText:cr(M),candidate:0})}}):n.createElement(Co,{label:"roles",detailOpen:!!r.detailOpen,onBack:()=>c({detailOpen:!1,candidateOpen:!1}),list:n.createElement(n.Fragment,null,k,O.map(([M,Y])=>{var se;return n.createElement(Va,{key:M,id:M,label:M,description:Y.description||`${((se=Y.candidates)==null?void 0:se.length)||0} choices`,selected:M===w,onSelect:()=>c({role:M,candidate:0,detailOpen:!0,candidateOpen:!1,candidateRaw:!1})})}))},N&&n.createElement(n.Fragment,null,n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,w),n.createElement("button",{className:"a-icon a-danger","aria-label":"Remove role "+w,disabled:["general","fast"].includes(w),"data-action":"view.update",onClick:()=>{const M={...b,roles:{...b.roles}};delete M.roles[w],T(M)}},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-description"},"Role description"),n.createElement("input",{id:"routing-description","aria-label":w+" description",value:N.description||"",placeholder:"Describe this role","data-action":"view.update",onChange:M=>T(Pr(b,w,{description:M.target.value}))}),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,x.length," ordered choices"),n.createElement("button",{className:"a-soft",disabled:x.length<2,"data-action":"view.update",onClick:()=>c({orderOpen:!0,order:Tc(x,w,r.order)})},"Preference order")),n.createElement("div",{className:"a-routing-candidates"},x.map((M,Y)=>n.createElement(Va,{key:Y,id:String(Y),label:`${Y+1}. ${M.model||"Choose a model"}`,description:M.provider||"Choose a provider",selected:Y===A,onSelect:()=>c({candidate:Y,candidateOpen:!0,candidateRaw:!1})}))),C&&n.createElement("div",{className:"a-routing-selected"},n.createElement("div",{className:"a-settings-row"},n.createElement("h4",null,"Choice ",A+1),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove ${w} candidate ${A+1}`,"data-action":"view.update",onClick:()=>T(Pr(b,w,{candidates:x.filter((M,Y)=>Y!==A)}))},n.createElement(ea,null))),n.createElement("label",{htmlFor:"routing-candidate-provider"},"Provider or connection name"),n.createElement("input",{id:"routing-candidate-provider","aria-label":`${w} provider ${A+1}`,list:"routing-provider-options",value:C.provider||"",placeholder:"For example, anthropic or opus","data-action":"view.update",onChange:M=>I({provider:M.target.value})}),n.createElement("datalist",{id:"routing-provider-options"},[...new Set(d.flatMap(M=>[M.id,M.module.replace(/^provider-/,"")]))].map(M=>n.createElement("option",{key:M,value:M}))),n.createElement("p",{className:"a-caption"},"Use a provider family for a portable profile, or a connection name for a specific account and configuration."),n.createElement("label",{htmlFor:`routing-${w}-${A}`},"Model ID or pattern"),n.createElement(wp,{editable:!0,catalogKey:C.provider,id:`routing-${w}-${A}`,label:`${w} model ${A+1}`,value:C.model||"",entry:X,models:W,state:e,act:t,placeholder:"Model ID or pattern, e.g. claude-sonnet-*",onChange:M=>I({model:M})}),n.createElement("p",{className:"a-caption"},"Patterns are resolved by the routing module. Model lists are suggestions and do not limit what you can enter.",q.length>0?" Suggestions from "+q.map(M=>M.id).join(", ")+".":""),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":!!r.candidateRaw,onClick:()=>c({candidateRaw:!r.candidateRaw,candidateText:cr(C)})},"Edit choice configuration"),r.candidateRaw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Choice configuration JSON",className:"a-json-editor",value:r.candidateText,"data-action":"view.update",onChange:M=>c({candidateText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.candidateText);if(!M.provider||!M.model)throw new Error("Include a provider and model.");const Y=[...x];Y[A]=M,T(Pr(b,w,{candidates:Y}))}catch(M){c({error:M.message})}}},"Apply choice configuration"))),n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>{const M=Pr(b,w,{candidates:[...x,{provider:"",model:""}]});c({matrix:M,rawText:cr(M),candidate:x.length,candidateOpen:!0,candidateRaw:!1})}},n.createElement(Ln,null),"Add fallback model"))),n.createElement("div",{className:"a-routing-add"},n.createElement("input",{"aria-label":"New routing role",list:"routing-role-options",value:r.newRole||"",placeholder:"Add a role","data-action":"view.update",onChange:M=>c({newRole:M.target.value})}),n.createElement("datalist",{id:"routing-role-options"},(u.roles||[]).map(M=>n.createElement("option",{value:M,key:M}))),n.createElement("button",{className:"a-soft",disabled:!((_e=r.newRole)!=null&&_e.trim())||!!((Je=b.roles)!=null&&Je[r.newRole.trim()]),"data-action":"view.update",onClick:()=>{const M=r.newRole.trim(),Y=Pr(b,M,{description:"",candidates:[{provider:"",model:""}]});c({matrix:Y,rawText:cr(Y),newRole:"",role:M,candidate:0,detailOpen:!0,candidateOpen:!0})}},n.createElement(Ln,null),"Add role")),n.createElement("div",{className:"a-routing-advanced"},n.createElement("button",{className:"a-link","aria-expanded":!!r.raw,"data-action":"view.update",onClick:()=>c({raw:!r.raw,rawText:cr(b)})},r.raw?"Hide":"Show"," full profile JSON"),r.raw&&n.createElement(n.Fragment,null,n.createElement("textarea",{"aria-label":"Routing matrix JSON",className:"a-json-editor",spellCheck:!1,value:r.rawText,"data-action":"view.update",onChange:M=>c({rawText:M.target.value})}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const M=tr(r.rawText);if(!M.roles||typeof M.roles!="object"||Array.isArray(M.roles))throw new Error("A profile needs a roles object.");T(M)}catch(M){c({error:M.message})}}},"Update draft from JSON"))),r.error&&n.createElement("p",{className:"a-danger",role:"alert"},r.error),n.createElement(Rn,{active:!r.order||r.orderOpen===!1},n.createElement("button",{className:"a-primary",disabled:U||!!r.requested||!!r.order&&r.orderOpen!==!1||!r.name.trim()||!S.length||S.some(([,M])=>{var Y;return!((Y=M.candidates)!=null&&Y.length)||M.candidates.some(se=>!se.provider||!se.model)}),"data-action":"routing.save",onClick:()=>g("routing.save",{name:r.name.trim(),matrix:{...b,name:r.name.trim()},scope:r.scope,activate:!0})},n.createElement($c,null),u.active===r.name?"Save active profile":"Save and use profile")),n.createElement("p",{className:"a-caption"},"General and fast roles are required. Saving applies to future conversation preparation."),n.createElement(nt,{phase:(De=f("routing.save"))==null?void 0:De.phase,message:((ue=f("routing.save"))==null?void 0:ue.error)||(ms(f("routing.save"))?"Saving routing profile…":((ye=f("routing.save"))==null?void 0:ye.phase)==="ready"?"Routing profile saved and selected.":"")})))}const ni=e=>JSON.stringify(e,null,2);function vD(e,t,a,r){var c;const o=(c=e.view)==null?void 0:c[t],[i,s]=v.useState({...a,...o});return v.useEffect(()=>{o&&s(u=>({...u,...o}))},[o]),[i,u=>{const d={...i,...u};s(d),r("view.update",{patch:{[t]:d}})}]}function bD({state:e,session:t,act:a,navigate:r=()=>{}}){var oe,Ze,it,zt,ct,qt,le,fe,xe,ze,Ye,ht,bt,ft,Ce,gt,Et,vt,at;const[o,i]=vD(e,"providerEditor",{id:"",module:"",source:"",config:"{}",scope:"global",model:"",effort:"",advanced:!1,credentialMode:(Ze=(oe=e.view)==null?void 0:oe.providerEditor)!=null&&Ze.id?"private":"environment",envVar:""},a),s=ee=>i({dirty:!0,...ee}),l=v.useRef({}),c=v.useRef(!1),[u,d]=v.useState(""),[p,m]=v.useState(o.config);v.useEffect(()=>{var ee;m(c.current?((ee=l.current[o.selectionKey??o.id])==null?void 0:ee.configText)??o.config:o.config),c.current=!1},[o.config,o.selectionKey]);const h=e.setup||{},f=(h.providers||[]).filter(ee=>ee.enabled!==!1),g=f.find(ee=>ee.id===o.id),E=v.useRef(Date.now()/1e3),y=v.useRef(!1),[b,S]=v.useState({}),w=(ee,Re=o.id)=>{var et;const ae=ee+":"+Re,Le=(et=h.operations)==null?void 0:et[ae],Oe=b[ae];return Oe&&(!Le||Le.commandId!==Oe.commandId)?Oe:Le},N=ee=>["queued","working","pending"].includes(ee==null?void 0:ee.phase),x=async(ee,Re={})=>{const ae=ee+":"+(["providers.credentials","providers.schema"].includes(ee)?Re.module:Re.id||""),Le={phase:"pending",commandId:"local-"+Date.now(),envVar:Re.envVar||""};S(Oe=>({...Oe,[ae]:Le}));try{const Oe=await a(ee,{...t&&!["providers.loginCancel","providers.loginStatus"].includes(ee)?{sessionId:t.id}:{},...Re});return S(et=>({...et,[ae]:Oe?null:{phase:"error",error:"The request could not be sent. Please retry."}})),Oe}catch(Oe){S(et=>({...et,[ae]:{phase:"error",error:Oe.message}}))}};v.useEffect(()=>{y.current=!1,E.current=h.providersLoadedAt||Date.now()/1e3,x("providers.list")},[t==null?void 0:t.workspace]);const A=((it=h.credentialCheck)==null?void 0:it.module)===o.module&&(o.envVar?h.credentialCheck.envVar===o.envVar:!h.credentialCheck.requestedEnvVar)?h.credentialCheck:null,C=A||((g==null?void 0:g.module)===o.module?g.credential:null),O=o.envVar||(C==null?void 0:C.envVar)||"",k=w("providers.credentials",o.module),T=k&&k.envVar===(o.envVar||"")?k:null,I=w("providers.models"),F=w("providers.schema",o.module),z=w("providers.test"),q=w("providers.list",""),W=o.credentialMode||"environment",X=o.module!=="provider-openai-chatgpt";v.useEffect(()=>{if(!o.module||W!=="environment"||!X)return;const ee=setTimeout(()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}}),250);return()=>clearTimeout(ee)},[o.module,o.envVar,W]);const U=["providers.save","providers.remove","providers.login","providers.move","providers.reorder"].some(ee=>N(w(ee))),_=((ct=(zt=h.providerCatalogs)==null?void 0:zt[o.id])==null?void 0:ct.metadata)||((qt=h.metadata)==null?void 0:qt[o.module])||(((le=h.providerMetadata)==null?void 0:le.module)===o.module?h.providerMetadata:null);v.useEffect(()=>{if(!/^provider-[A-Za-z0-9_.-]+$/.test(o.module)||_)return;const ee=setTimeout(()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}}),250);return()=>clearTimeout(ee)},[o.module,t==null?void 0:t.workspace]);const P=zl(((fe=h.modelCatalogs)==null?void 0:fe[o.id])||((h.modelsProviderId||h.providerId)===o.id?h.models:[])),G=((xe=h.login)==null?void 0:xe.providerId)===o.id?h.login:null,Z=(G==null?void 0:G.status)||(G==null?void 0:G.phase),D=Jw(G==null?void 0:G.url);let ne,H="";try{ne=tr(p)}catch(ee){H=ee.message}const[j,ie]=xa(e,a,"providers",f,ee=>{var Re,ae;return[ee.id,ee.module,(Re=ee.config)==null?void 0:Re.default_model,(ae=ee.config)==null?void 0:ae.model]},"Filter providers"),Ee=Or(o.authMode||((ze=g==null?void 0:g.config)==null?void 0:ze.auth_mode)),me=t&&["working","starting","running","stopping","busy"].includes(t.status),_e=ee=>{var xt,Ut,rt,Xe,$e,Nt,Zt,rn;c.current=!0;const Re=o.selectionKey??o.id??"";l.current[Re]={apiKey:u,configText:p};const{connections:ae,...Le}=o,Oe={...ae,[Re]:Le},et=(ee==null?void 0:ee.id)||"",It=Oe[et]||(ee?{modelEntry:"catalog",dirty:!1,authMode:Or((xt=ee.config)==null?void 0:xt.auth_mode),credentialMode:(Ut=ee.credential)!=null&&Ut.hasStoredKey||!ee.credential&&ee.credentialsConfigured?"private":"environment",envVar:((rt=ee.credential)==null?void 0:rt.envVar)||"",id:ee.id,module:ee.module,source:ee.source||"",config:ni(ee.config||{}),model:((Xe=ee.config)==null?void 0:Xe.default_model)||(($e=ee.config)==null?void 0:$e.model)||"",effort:((Nt=ee.config)==null?void 0:Nt.reasoning_effort)||""}:{modelEntry:"catalog",dirty:!1,id:"",module:"",source:"",config:"{}",model:"",effort:"",credentialMode:"environment",envVar:""});d(((Zt=l.current[et])==null?void 0:Zt.apiKey)||""),m(((rn=l.current[et])==null?void 0:rn.configText)??It.config),i({...It,connections:Oe,selectionKey:et,detailOpen:!0,order:null})};v.useEffect(()=>{var Re,ae,Le,Oe,et,st;if(y.current||!f.length||!h.providersLoadedAt||h.providersLoadedAtIt.id===o.id)||(!o.id&&!o.module?f[0]:null);ee&&!o.dirty&&i({id:ee.id,selectionKey:ee.id,module:ee.module,source:ee.source||"",config:ni(ee.config||{}),model:((Re=ee.config)==null?void 0:Re.default_model)||((ae=ee.config)==null?void 0:ae.model)||"",effort:((Le=ee.config)==null?void 0:Le.reasoning_effort)||"",authMode:Or((Oe=ee.config)==null?void 0:Oe.auth_mode),credentialMode:(et=ee.credential)!=null&&et.hasStoredKey||!ee.credential&&ee.credentialsConfigured?"private":"environment",envVar:((st=ee.credential)==null?void 0:st.envVar)||"",dirty:!1})},[h.providersLoadedAt]);const Je=v.useRef("");v.useEffect(()=>{var ee;if(!((G==null?void 0:G.status)!=="completed"||G.loginId===Je.current||!g)){Je.current=G.loginId;try{const Re={...tr(p)};for(const Le of["auth_mode","token_file_path","host_file_path","login_on_mount"])Le in(g.config||{})&&(Re[Le]=g.config[Le]);const ae=ni(Re);m(ae),i({config:ae,authMode:Or((ee=g.config)==null?void 0:ee.auth_mode)})}catch{}}},[G==null?void 0:G.loginId,G==null?void 0:G.status,(Ye=g==null?void 0:g.config)==null?void 0:Ye.auth_mode]);const De=w("providers.remove");v.useEffect(()=>{(De==null?void 0:De.phase)==="ready"&&De.updatedAt>=E.current&&(delete l.current[o.id],d(""),m("{}"),i({id:"",module:"",config:"{}",model:"",dirty:!1,detailOpen:!1,connections:{...o.connections,[o.id]:void 0}}))},[De==null?void 0:De.updatedAt]);const ue=w("providers.save");v.useEffect(()=>{(ue==null?void 0:ue.phase)==="ready"&&ue.updatedAt>=E.current&&(d(""),l.current[o.selectionKey??o.id]={apiKey:"",configText:p},s({dirty:!1,connections:{...o.connections,[o.selectionKey??o.id]:void 0}}))},[ue==null?void 0:ue.updatedAt]),v.useEffect(()=>{var ee;((ee=w("providers.reorder",""))==null?void 0:ee.phase)==="ready"&&o.order&&i({order:null})},[(ht=w("providers.reorder",""))==null?void 0:ht.updatedAt]);const ye=(ee,Re={})=>x(ee,{id:o.id,...Re}),M=yp(_,{...ne,default_model:o.model,model:o.model}).filter(ee=>o.module!=="provider-openai-chatgpt"||ee.id!=="auth_mode"),Y=(ee,Re)=>{const ae={...ne};Re===""?delete ae[ee]:ae[ee]=Re,m(ni(ae)),s({config:ni(ae),dirty:!0,...ee==="reasoning_effort"?{effort:Re}:{}})},se=async()=>{await x("providers.save",{...o.id?{id:o.id}:{},module:o.module.trim(),...o.source.trim()?{source:o.source.trim()}:{},config:{...ne,...o.model?{default_model:o.model}:{}},scope:o.scope,...X&&W==="environment"&&O?{apiKeyEnv:O}:u&&W==="private"?{apiKey:u}:{}})},Fe=!!u||p!==o.config||Object.values(l.current).some(ee=>ee.apiKey),je=!!o.dirty||Fe||Object.values(o.connections||{}).some(ee=>ee==null?void 0:ee.dirty);return Gw("providers",{label:"Provider configuration",dirty:je,review:()=>{r("providers");const ee=Object.entries(o.connections||{}).find(([,Re])=>Re==null?void 0:Re.dirty);!o.dirty&&!Fe&&ee?_e(f.find(Re=>Re.id===ee[0])||null):i({detailOpen:!0})},discard:()=>{l.current={},d(""),m("{}"),i({id:"",selectionKey:"",module:"",source:"",config:"{}",model:"",effort:"",dirty:!1,connections:{},detailOpen:!1})}}),n.createElement("section",{className:"a-settings-section","data-part":"provider-settings"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Model providers"),n.createElement("p",null,"Connect a provider and choose models for your conversations.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh providers","data-operation-pending":N(q)||void 0,"aria-busy":N(q)||void 0,"data-action":"providers.list",disabled:N(q),onClick:()=>x("providers.list")},n.createElement(Mt,null))),N(q)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading your saved providers…"),(q==null?void 0:q.error)&&n.createElement("p",{className:"a-danger",role:"alert"},q.error),!f.length&&!N(q)&&n.createElement("p",{className:"a-caption"},"No saved providers yet. Add a connection below."),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,f.length," saved connections"),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>_e(null)},n.createElement(Ln,null),"Add provider"),n.createElement("button",{className:"a-soft",disabled:f.length<2||U,"data-action":"view.update",onClick:()=>i({orderOpen:!0,order:o.order||{ids:f.map(ee=>ee.id),expectedIds:f.map(ee=>ee.id),scope:o.scope}})},"Preference order")),o.order&&o.orderOpen!==!1?n.createElement(xp,{title:"Provider preference order",description:"Provider priority breaks ties after routing matches a model. Saving for "+({global:"all workspaces",project:"this project",local:"this workspace"}[o.order.scope]||o.order.scope)+". Routing profile choices stay separate.",items:f.map(ee=>({id:ee.id,label:ee.id,description:ee.module})),ids:o.order.ids,onChange:ee=>i({order:{...o.order,ids:ee}}),onCancel:()=>i({order:null}),busy:N(w("providers.reorder","")),error:(bt=w("providers.reorder",""))==null?void 0:bt.error,action:"providers.reorder",onSave:()=>x("providers.reorder",{...o.order})}):n.createElement(Co,{label:"providers",detailOpen:!!o.detailOpen,onBack:()=>i({detailOpen:!1}),list:n.createElement(n.Fragment,null,ie,n.createElement(Xt,{name:"provider-list",busy:N(q)},j.map(ee=>{var Re,ae;return n.createElement(Va,{key:ee.id,id:ee.id,label:ee.id,description:(((Re=ee.config)==null?void 0:Re.default_model)||((ae=ee.config)==null?void 0:ae.model)||ee.module)+" · "+(ee.credentialsConfigured?"credentials ready":ee.keySource||"credentials not configured"),selected:ee.id===(o.selectionKey??o.id),onSelect:()=>_e(ee)})})))},n.createElement("div",{className:"a-settings-provider-detail"},n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"provider-id"},"Provider instance name"),n.createElement("input",{id:"provider-id",value:o.id,"data-action":"view.update",onChange:ee=>s({id:ee.target.value}),placeholder:"openai"})),n.createElement("div",null,n.createElement("label",{htmlFor:"provider-scope"},"Save for"),n.createElement("select",{id:"provider-scope",value:o.scope,"data-action":"view.update",onChange:ee=>s({scope:ee.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project (shareable)"),n.createElement("option",{value:"local"},"This workspace (private)")))),n.createElement(Xt,{name:"provider-models",busy:N(I)},n.createElement("label",{htmlFor:"provider-model"},"Default model"),n.createElement(wp,{editable:!0,catalogKey:o.id,id:"provider-model",label:"Default model",value:o.model,entry:(ft=h.providerCatalogs)==null?void 0:ft[o.id],models:P,state:e,act:a,onChange:ee=>s({model:ee})})),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!g||N(I),"data-operation-pending":N(I)||void 0,"aria-busy":N(I)||void 0,"data-action":"providers.models",onClick:()=>ye("providers.models",{refresh:!0})},n.createElement(Mt,null),N(I)?"Discovering models…":"Refresh models"),n.createElement("button",{className:"a-soft",disabled:!g||N(z),"data-operation-pending":N(z)||void 0,"aria-busy":N(z)||void 0,"data-action":"providers.test",onClick:()=>ye("providers.test")},n.createElement(Pt,null),N(z)?"Testing provider…":"Test connection"),n.createElement("button",{className:"a-soft",disabled:!g||U,"data-action":"providers.login",onClick:()=>ye("providers.login",{authMode:Ee,scope:o.scope})},n.createElement(Kk,null),g!=null&&g.accountConnected?"Reconnect account":"Provider sign-in")),n.createElement(nt,{phase:I==null?void 0:I.phase,message:N(I)?"Discovering available models…":(I==null?void 0:I.error)||((I==null?void 0:I.phase)==="ready"?`${P.length?`Found ${P.length} models. Choose one above.`:"This provider returned no models. Enter a model ID manually."}`:"")}),n.createElement(nt,{phase:z!=null&&z.error?"error":N(z)?"working":((Ce=h.test)==null?void 0:Ce.reachable)===!1?"error":"ready",message:N(z)?"Testing provider connection…":(z==null?void 0:z.error)||((z==null?void 0:z.phase)==="ready"||((gt=h.test)==null?void 0:gt.providerId)===o.id?((Et=h.test)==null?void 0:Et.reachable)!==!1?"Provider check passed":"Provider check failed":""),detail:!N(z)&&!(z!=null&&z.error)&&((vt=h.test)==null?void 0:vt.providerId)===o.id?`${h.test.modelCount??0} models returned. This checks the provider’s model catalog; no chat request was sent.`:void 0}),n.createElement("p",{className:"a-caption"},"Checks use saved provider settings. Save changes before testing."),n.createElement(Zw,{key:o.id,state:e,id:o.id,sessionId:t==null?void 0:t.id,act:a,disabled:!g||U}),o.module==="provider-openai-chatgpt"&&n.createElement(n.Fragment,null,n.createElement(Ep,{account:g==null?void 0:g.account}),n.createElement(Kw,{mode:Ee,onChange:ee=>i({authMode:ee}),disabled:U||["starting","waiting"].includes(Z)})),G&&(o.module==="provider-openai-chatgpt"?n.createElement(Au,{login:G,busy:U,onCancel:()=>ye("providers.loginCancel"),onRetry:()=>ye("providers.login",{authMode:Ee,scope:o.scope}),onEnablePlan:()=>ye("providers.login",{authMode:"chatgpt_plan",scope:o.scope,enablePlan:!0}),welcomeDismissed:o.welcomedLoginId===G.loginId,onWelcomeDismiss:()=>i({welcomedLoginId:G.loginId})}):n.createElement("div",{className:"a-selection-card",role:"status"},n.createElement("strong",null,"Provider sign-in · ",Z),(G.instructions||[]).map((ee,Re)=>n.createElement("p",{key:Re},ee)),D&&n.createElement("a",{href:D,target:"_blank",rel:"noopener noreferrer","data-action":"providers.login",className:"a-link"},"Open secure provider sign-in"),G.error&&n.createElement("p",{className:"a-danger"},G.error),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft","data-action":"providers.loginStatus",onClick:()=>a("providers.loginStatus",{id:o.id})},"Check sign-in status"),["starting","waiting"].includes(Z)&&n.createElement("button",{className:"a-soft","data-action":"providers.loginCancel",onClick:()=>a("providers.loginCancel",{id:o.id})},"Cancel sign-in")))),n.createElement(Xt,{name:"provider-options",busy:N(F),className:"a-provider-options"},n.createElement("h4",null,"Provider options"),N(F)&&n.createElement("p",{className:"a-caption",role:"status"},"Loading options from this provider…"),(F==null?void 0:F.error)&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-danger"},F.error," You can still edit advanced configuration."),n.createElement("button",{className:"a-link","data-action":"providers.schema",onClick:()=>x("providers.schema",{module:o.module,...o.id?{id:o.id}:{}})},"Retry loading options")),M.map(ee=>{var Le;const Re=(ne==null?void 0:ne[ee.id])??"",ae="provider-option-"+ee.id;return n.createElement("div",{key:ee.id},n.createElement("label",{htmlFor:ae},ee.display_name||ee.id),(Le=ee.choices)!=null&&Le.length?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(ee.id,Oe.target.value)},n.createElement("option",{value:""},"Provider default",ee.default!=null?` (${ee.default})`:""),Re!==""&&!ee.choices.includes(String(Re))&&n.createElement("option",{value:String(Re)},String(Re)," (saved)"),ee.choices.map(Oe=>n.createElement("option",{key:Oe,value:Oe},Oe))):ee.field_type==="boolean"?n.createElement("select",{id:ae,value:String(Re),"data-action":"view.update",onChange:Oe=>Y(ee.id,Oe.target.value===""?"":Oe.target.value==="true")},n.createElement("option",{value:""},"Provider default",ee.default!=null?` (${ee.default})`:""),n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):n.createElement("input",{id:ae,value:Re,"data-action":"view.update",placeholder:ee.default||"Provider default",onChange:Oe=>Y(ee.id,Oe.target.value)}),n.createElement("p",{className:"a-caption"},ee.prompt))}),_&&!M.length&&n.createElement("p",{className:"a-caption"},"This provider has no additional options for the selected model.")),g&&n.createElement(n.Fragment,null,n.createElement(Tu,{credential:g.credential}),n.createElement("button",{className:"a-link","data-action":"providers.list",disabled:N(q),onClick:()=>x("providers.list")},n.createElement(Mt,null),"Refresh credentials")),n.createElement("details",{className:"a-provider-access",open:o.accessOpen??!(g!=null&&g.credentialsConfigured)},n.createElement("summary",{"data-action":"view.update",onClick:ee=>{ee.preventDefault(),i({accessOpen:!(o.accessOpen??!(g!=null&&g.credentialsConfigured))})}},"Provider & access · ",g!=null&&g.accountConnected?"Account connected":g!=null&&g.credentialsConfigured?"Credentials configured":"Setup needed")," ",n.createElement("label",{htmlFor:"provider-preset"},"Provider"),n.createElement("select",{id:"provider-preset",value:Ic.some(ee=>ee.module===o.module)?o.module:"custom","data-action":"view.update",onChange:ee=>{const Re=ee.target.value==="custom"?"":ee.target.value;d(""),s({module:Re,envVar:"",credentialMode:["provider-chat-completions","provider-ollama","provider-vllm"].includes(Re)?"private":"environment",...!o.id&&Re?{id:Re.replace("provider-","")}:{}})}},n.createElement("option",{value:"custom"},"Custom provider module"),Ic.map(ee=>n.createElement("option",{key:ee.module,value:ee.module},ee.name))),!Ic.some(ee=>ee.module===o.module)&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-module"},"Provider module"),n.createElement("input",{id:"provider-module",value:o.module,"data-action":"view.update",onChange:ee=>s({module:ee.target.value}),placeholder:"provider-custom"})),X?n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key-source"},"API key source"),n.createElement("select",{id:"provider-key-source",value:W,"data-action":"view.update",onChange:ee=>{d(""),s({credentialMode:ee.target.value})}},n.createElement("option",{value:"environment"},"Environment variable"),n.createElement("option",{value:"private"},"Private saved key")),W==="environment"?n.createElement(Xt,{name:"provider-credentials",busy:N(T)},n.createElement("label",{htmlFor:"provider-key-env"},"Environment variable name"),n.createElement("input",{id:"provider-key-env",value:O,"data-action":"view.update",onChange:ee=>s({envVar:ee.target.value}),placeholder:(C==null?void 0:C.defaultEnvVar)||"MY_PROVIDER_API_KEY",spellCheck:!1,autoComplete:"off"}),(C==null?void 0:C.defaultEnvVar)&&n.createElement("p",{className:"a-caption"},"Default: ",n.createElement("code",null,C.defaultEnvVar),!!((at=C.alternatives)!=null&&at.length)&&n.createElement(n.Fragment,null," · Also supported: ",C.alternatives.join(", "))),n.createElement(nt,{phase:N(T)?"working":T!=null&&T.error||A&&!(C!=null&&C.available)?"error":"ready",message:N(T)?"Checking environment variable…":(T==null?void 0:T.error)||(A||!o.envVar&&C?C!=null&&C.available?"Found — this variable will supply the key.":"Not found in the app environment. Set it before launching the app, then restart.":""),detail:A!=null&&A.checkedAt&&!N(T)?`Checked ${new Date(A.checkedAt*1e3).toLocaleTimeString()}`:void 0}),n.createElement("button",{className:"a-link","data-action":"providers.credentials",disabled:N(T)||!o.module||!!o.envVar&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(o.envVar),onClick:()=>x("providers.credentials",{module:o.module,...o.envVar?{envVar:o.envVar}:{}})},N(T)?"Checking…":"Check variable"),n.createElement("p",{className:"a-caption"},"Reads the backend’s launch environment and private key file. Only the variable name is saved. Key previews show only the beginning and end of longer keys.")):n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-key"},"API key"),n.createElement("input",{id:"provider-key",type:"password",autoComplete:"new-password","data-private":"true","data-action":"providers.save",value:u,onChange:ee=>{d(ee.target.value),i({dirty:!0})},placeholder:g!=null&&g.credentialsConfigured?"Leave blank to keep current credentials":"Stored privately on this computer"}),n.createElement("p",{className:"a-caption"},"The full key stays private on this computer; only a masked preview is shown."))):n.createElement("p",{className:"a-caption"},"This provider uses account sign-in rather than an API key.")),n.createElement("button",{className:"a-link","aria-expanded":o.advanced,"data-action":"view.update",onClick:()=>i({advanced:!o.advanced})},o.advanced?"Hide":"Show"," advanced configuration"),o.advanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"provider-source"},"Module source (optional)"),n.createElement(Ma,{id:"provider-source",value:o.source,onChange:ee=>s({source:ee}),state:e,act:a,placeholder:"git+https://… or a local module folder"}),n.createElement("label",{htmlFor:"provider-config"},"Provider configuration (JSON)"),n.createElement("textarea",{id:"provider-config",className:"a-json-editor",value:p,spellCheck:!1,"data-private":"true","data-action":"providers.save",onChange:ee=>{const Re=ee.target.value;m(Re);try{tr(Re),s({config:Re})}catch{}}})),H&&n.createElement("p",{className:"a-danger"},H),["providers.save","providers.remove"].map(ee=>{const Re=w(ee);return Re&&n.createElement("p",{className:Re.error?"a-danger":"a-caption",role:"status",key:ee},Re.error||(N(Re)?"Saving provider settings…":ee==="providers.save"?"Provider saved. New conversations will use these settings.":"Provider removed."))}),n.createElement(Rn,{active:!!o.detailOpen},n.createElement("button",{className:"a-primary",disabled:!o.module.trim()||!!H||U||X&&W==="environment"&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(O),"data-operation-pending":N(ue)||void 0,"aria-busy":N(ue)||void 0,"data-action":"providers.save",onClick:se},n.createElement(Pt,null),"Save provider"),n.createElement("button",{className:"a-soft a-danger",disabled:!g||U,"data-operation-pending":N(w("providers.remove"))||void 0,"aria-busy":N(w("providers.remove"))||void 0,"data-action":"providers.remove",onClick:()=>x("providers.remove",{id:o.id,scope:o.scope})},n.createElement(ea,null),"Remove")),t&&g&&n.createElement("div",{className:"a-provider-session"},n.createElement("button",{className:"a-soft",disabled:!o.model||me||U,"data-action":"runtime.control",onClick:()=>a("runtime.control",{sessionId:t.id,operation:"provider.select",args:{instance:o.id,model:o.model,...ne!=null&&ne.reasoning_effort?{effort:ne.reasoning_effort}:{}}})},"Use model in this conversation"),n.createElement("p",{className:"a-caption"},"Current-session selection requires the provider to be mounted by its bundle.")))))}const yD={open:!1,tab:"modules",scope:"global",section:"tools",id:"",module:"",source:"",config:"{}",enabled:!0,sourceKind:"module",sourceName:"",sourceUri:"",sourceSection:"tools",behavioral:!1,behaviorResultsExpanded:!1},Df=[["tools","Tools"],["hooks","Hooks"],["providers","Providers"],["orchestrator","Orchestrator"],["context","Context manager"]];function ED({state:e,act:t}){var O,k,T,I,F,z,q,W,X,U,_,P,G,Z,D,ne,H;const a=(O=e.view)==null?void 0:O.registryDraft,[r,o]=v.useState({...yD,...a});v.useEffect(()=>{a&&o(j=>({...j,...a}))},[a]);const i=j=>{const ie={...r,...j};o(ie),t("view.update",{patch:{registryDraft:ie}})},[s,l]=v.useState(r.config);v.useEffect(()=>{l(r.config)},[r.config]);const c=e.registry||{},u=((k=e.management)==null?void 0:k.phase)==="working",d=["queued","working"].includes((I=(T=e.actionStatus)==null?void 0:T["modules.validate"])==null?void 0:I.phase)&&((q=(z=(F=e.actionStatus)==null?void 0:F["modules.validate"])==null?void 0:z.target)==null?void 0:q.id)===r.id,p=c.modules||[],m=c.sources||[],h=((W=c.validation)==null?void 0:W.id)===r.id?c.validation:null,[f,g]=xa(e,t,"registry-modules",p,j=>[j.id,j.module,j.section,j.source],"Filter registered modules"),[E,y]=xa(e,t,"registry-sources",m,j=>[j.name,j.kind,j.source],"Filter source overrides");let b={},S="";try{b=tr(s)}catch(j){S=j.message}const w=((X=c.sourceValidation)==null?void 0:X.kind)===r.sourceKind&&((U=c.sourceValidation)==null?void 0:U.name)===r.sourceName.trim()&&((_=c.sourceValidation)==null?void 0:_.submittedSource)===r.sourceUri.trim()&&((P=c.sourceValidation)==null?void 0:P.scope)===r.scope&&((G=c.sourceValidation)==null?void 0:G.section)===r.sourceSection?c.sourceValidation:null,N={kind:r.sourceKind,name:r.sourceName.trim(),source:r.sourceUri.trim(),scope:r.scope,...r.sourceKind==="module"?{section:r.sourceSection}:{}},x=["sources.validate","sources.save"].some(j=>{var ie,Ee;return["queued","working"].includes((Ee=(ie=e.actionStatus)==null?void 0:ie[j])==null?void 0:Ee.phase)}),A=j=>{const ie=JSON.stringify(j.config||{},null,2);l(ie),i({section:j.section,id:j.id,module:j.module,source:j.source||"",config:ie,enabled:j.enabled!==!1})},C=()=>t(r.tab==="modules"?"modules.list":"sources.list",{scope:r.scope});return n.createElement(Pa,{id:"registries",title:"Advanced module & source registries",summary:"Register modules and override their sources",state:e,act:t},n.createElement("section",{className:"a-settings-section a-registry","data-part":"registries"},n.createElement("div",{className:"a-maintenance-content"},n.createElement("p",null,"Register individual modules or override where named modules and bundles are loaded from. Most setups can use community bundles above."),n.createElement("nav",{className:"a-settings-nav","aria-label":"Registry sections"},[["modules","Modules"],["sources","Source overrides"]].map(([j,ie])=>n.createElement("button",{key:j,className:r.tab===j?"selected":"","data-action":"view.update",onClick:()=>i({tab:j})},ie))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-scope"},"Configuration scope"),n.createElement("select",{id:"registry-scope",value:r.scope,"data-action":"view.update",onChange:j=>i({scope:j.target.value})},n.createElement("option",{value:"global"},"All workspaces"),n.createElement("option",{value:"project"},"This project"),n.createElement("option",{value:"local"},"This workspace (private)"))),n.createElement("button",{className:"a-soft",disabled:u,"data-action":r.tab==="modules"?"modules.list":"sources.list",onClick:C},n.createElement(Mt,null),"Load registry")),r.tab==="modules"?n.createElement(n.Fragment,null,g,n.createElement("div",{className:"a-provider-list"},f.map(j=>n.createElement("button",{key:j.section+":"+j.id,className:r.id===j.id&&r.section===j.section?"selected":"","data-action":"view.update",onClick:()=>A(j)},n.createElement("strong",null,j.id),n.createElement("small",null,j.section," · ",j.enabled===!1?"disabled":"enabled"," · ",j.scope||r.scope))),n.createElement("button",{"data-action":"view.update",onClick:()=>{l("{}"),i({id:"",module:"",source:"",config:"{}",enabled:!0})}},n.createElement(Ln,null),"Add module")),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"registry-section"},"Module type"),n.createElement("select",{id:"registry-section",value:r.section,"data-action":"view.update",onChange:j=>i({section:j.target.value})},Df.map(([j,ie])=>n.createElement("option",{key:j,value:j},ie)))),n.createElement("div",null,n.createElement("label",{htmlFor:"registry-id"},"Instance name (optional)"),n.createElement("input",{id:"registry-id",value:r.id,"data-action":"view.update",onChange:j=>i({id:j.target.value})}))),n.createElement("label",{htmlFor:"registry-module"},"Module name"),n.createElement("input",{id:"registry-module",value:r.module,"data-action":"view.update",onChange:j=>i({module:j.target.value}),placeholder:"tool-example"}),n.createElement("label",{htmlFor:"registry-source"},"Source (optional)"),n.createElement(Ma,{id:"registry-source",state:e,act:t,value:r.source,onChange:j=>i({source:j}),placeholder:"git+https://… or /local/path"}),n.createElement("label",{htmlFor:"registry-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"registry-config",className:"a-json-editor",value:s,"data-action":"modules.save","data-private":"true",spellCheck:!1,onChange:j=>{const ie=j.target.value;l(ie);try{tr(ie),i({config:ie})}catch{}}}),S&&n.createElement("p",{className:"a-danger"},S),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.enabled,"data-action":"view.update",onChange:j=>i({enabled:j.target.checked})}),"Enabled"),n.createElement("label",{className:"a-inline-checkbox"},n.createElement("input",{type:"checkbox",checked:r.behavioral,"data-action":"view.update",onChange:j=>i({behavioral:j.target.checked})}),"Also run module behavior tests"),n.createElement("p",{className:"a-caption"},"Behavior tests run the module’s code in an isolated process."),n.createElement("div",{className:"a-dialog-actions"},n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||!!S||!r.module.trim(),"data-action":"modules.save",onClick:()=>t("modules.save",{section:r.section,module:r.module.trim(),...r.id?{id:r.id}:{},...r.source?{source:r.source}:{},config:b,enabled:r.enabled,scope:r.scope})},n.createElement(Pt,null),"Save module")),n.createElement("button",{className:"a-soft",disabled:u||!r.id,"data-operation-pending":d||void 0,"aria-busy":d||void 0,"data-action":"modules.validate",onClick:()=>t("modules.validate",{section:r.section,id:r.id,scope:r.scope,behavioral:r.behavioral})},"Validate core contract"),n.createElement("button",{className:"a-soft a-danger",disabled:u||!r.id,"data-action":"modules.remove",onClick:()=>t("modules.remove",{section:r.section,id:r.id,scope:r.scope})},n.createElement(ea,null),"Remove")),n.createElement(Xt,{name:"module-validation",busy:d},((ne=(D=(Z=e.actionStatus)==null?void 0:Z["modules.validate"])==null?void 0:D.target)==null?void 0:ne.id)===r.id&&n.createElement(nt,{phase:e.actionStatus["modules.validate"].phase==="ready"&&(h==null?void 0:h.passed)===!1?"error":e.actionStatus["modules.validate"].phase,message:e.actionStatus["modules.validate"].error||(e.actionStatus["modules.validate"].phase==="ready"?h!=null&&h.passed?"Module validation passed":"Module validation failed":"Validating module…")}),h&&n.createElement("div",{className:"a-selection-card"},n.createElement("strong",null,h.id,": ",h.passed?"validation passed":"validation needs attention"),n.createElement("ul",{className:"a-catalog-list"},(h.checks||[]).map((j,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:j.passed?"ready":"error",message:j.name,detail:j.message})))),h.behavioral&&n.createElement("div",null,n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.behaviorResultsExpanded,onClick:()=>i({behaviorResultsExpanded:!r.behaviorResultsExpanded})},h.behavioral.passed?"Behavior tests passed":"Behavior tests need attention"," · ",(h.behavioral.tests||[]).length," tests · ",r.behaviorResultsExpanded?"Hide":"Show"," results"),r.behaviorResultsExpanded&&n.createElement("ul",{className:"a-catalog-list"},(h.behavioral.tests||[]).map((j,ie)=>n.createElement("li",{key:ie},n.createElement(nt,{phase:j.status==="failed"?"error":j.status==="skipped"?"neutral":"ready",message:j.name,detail:j.status})))))))):n.createElement(n.Fragment,null,y,n.createElement("div",{className:"a-routing-profiles"},E.map(j=>n.createElement("div",{key:j.kind+":"+j.name},n.createElement("span",null,n.createElement("strong",null,j.name),n.createElement("small",null,j.kind," · ",j.source)),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>i({sourceKind:j.kind,sourceName:j.name,sourceUri:j.source})},"Edit"),n.createElement("button",{className:"a-icon a-danger","aria-label":`Remove source ${j.name}`,disabled:u,"data-action":"sources.remove",onClick:()=>t("sources.remove",{kind:j.kind,name:j.name,scope:r.scope})},n.createElement(ea,null))))),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"source-kind"},"Source type"),n.createElement("select",{id:"source-kind",value:r.sourceKind,"data-action":"view.update",onChange:j=>i({sourceKind:j.target.value})},n.createElement("option",{value:"module"},"Module"),n.createElement("option",{value:"bundle"},"Bundle"))),n.createElement("div",null,n.createElement("label",{htmlFor:"source-name"},"Registered name"),n.createElement("input",{id:"source-name",value:r.sourceName,"data-action":"view.update",onChange:j=>i({sourceName:j.target.value}),placeholder:"tool-example"}))),n.createElement("label",{htmlFor:"source-uri"},"Repository URL or local path"),n.createElement(Ma,{id:"source-uri",state:e,act:t,value:r.sourceUri,onChange:j=>i({sourceUri:j}),placeholder:"git+https://… or /local/path"}),r.sourceKind==="module"&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"source-section"},"Module type to validate"),n.createElement("select",{id:"source-section",value:r.sourceSection,"data-action":"view.update",onChange:j=>i({sourceSection:j.target.value})},Df.map(([j,ie])=>n.createElement("option",{key:j,value:j},ie))),n.createElement("p",{className:"a-caption"},"Check the candidate before replacing the saved source. Validation checks the module contract; it does not start a conversation.")),n.createElement("div",{className:"a-dialog-actions"},r.sourceKind==="module"&&n.createElement("button",{className:"a-soft",disabled:u||x||!N.name||!N.source,"data-action":"sources.validate",onClick:()=>t("sources.validate",N)},"Validate without saving"),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:u||x||!N.name||!N.source,"data-action":"sources.save",onClick:()=>t("sources.save",{...N,...r.sourceKind==="module"?{validate:!0}:{}})},n.createElement(Pt,null),r.sourceKind==="module"?"Validate & save source":"Save source override"))),n.createElement(Xt,{name:"source-validation",busy:x},x&&n.createElement(nt,{phase:"working",message:"Validating candidate source…"}),!x&&w&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:w.passed?"ready":"error",message:w.saved?"Candidate validated and saved":w.passed?"Candidate validated; nothing saved":"Validation failed; saved source unchanged"}),(H=w.checks)==null?void 0:H.map((j,ie)=>n.createElement(nt,{key:ie,phase:j.passed?"ready":"error",message:j.name,detail:j.message}))))),n.createElement("p",{className:"a-caption"},"Saved configuration applies when sessions are prepared again. Use environment references for credentials; configure provider keys under Setup."))))}function Sp(e){var a;const t=[];for(const r of["providers","tools","hooks"])for(const[o,i]of(Array.isArray(e==null?void 0:e[r])?e[r]:[]).entries())t.push({key:`${r}:${o}`,section:r,index:o,module:i.module||"Unnamed module",id:i.instance_id||i.id||i.module,enabled:i.enabled!==!1,source:i.source,config:i.config||{},entry:i});for(const r of["orchestrator","context"]){const o=(a=e==null?void 0:e.session)==null?void 0:a[r];o&&t.push({key:`session:${r}`,section:r,index:r,module:typeof o=="string"?o:o.module,id:o.id||o.module||o,enabled:o.enabled!==!1,source:o.source,config:o.config||{},entry:o,required:!0})}return t}function Ff(e,t,a){const r=structuredClone(e),o=Sp(r).find(l=>l.key===t);if(!o)throw new Error("Select a module to edit.");const s={...typeof o.entry=="string"?{module:o.entry}:o.entry,...a};if(o.required){if(a.enabled===!1)throw new Error("The session requires an orchestrator and a context module.");r.session[o.section]=s}else r[o.section][o.index]=s;return r}function wD(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Configuration must be a JSON object.");return t}const ur=e=>JSON.stringify(e,null,2),kD={source:"",selectedUri:"",alias:"",role:"behavior",exportName:"my-amplifier",exportDescription:""};function Xw(e,t,a,r){const[o,i]=v.useState({...t,...e});v.useEffect(()=>{e&&i(l=>({...l,...e}))},[e]);function s(l){const c={...o,...l};i(c),r("view.update",{patch:{[a]:c}})}return[o,s]}function xD({state:e,session:t,act:a}){var x,A,C,O;const[r,o]=Xw((x=e.view)==null?void 0:x.bundleManager,kD,"bundleManager",a),i=Array.isArray(e.bundles)?e.bundles:((A=e.bundles)==null?void 0:A.entries)||[],[s,l]=v.useState({});v.useEffect(()=>{l(k=>Object.fromEntries(Object.entries(k).filter(([T,I])=>i.some(F=>F.id===T&&F.enabled!==I))))},[e.bundles]);const c=(C=e.actionStatus)==null?void 0:C["bundles.toggle"];v.useEffect(()=>{(c==null?void 0:c.phase)==="error"&&l(k=>{var I;const T={...k};return delete T[(I=c.target)==null?void 0:I.id],T})},[c]);const u=async(k,T)=>{l(I=>({...I,[k]:T}));try{if(!await a("bundles.toggle",{id:k,enabled:T}))throw new Error("Request not sent")}catch{l(I=>{const F={...I};return delete F[k],F})}},d=i.find(k=>k.id===r.entryId)||i[0],p=i.filter(k=>k.role!=="standalone"&&k.enabled!==!1),m=(O=e.actionStatus)==null?void 0:O["bundles.reorder"];v.useEffect(()=>{(m==null?void 0:m.phase)==="ready"&&r.order&&o({order:null})},[m==null?void 0:m.commandId,m==null?void 0:m.phase]);const h=e.bundleDiscovery||{},f=h.candidates||[],[g,E]=xa(e,a,"bundle-discovery",f,k=>[k.display_name,k.name,k.path,k.uri,k.kind,k.description],"Filter discovered bundles"),[y,b]=xa(e,a,"app-bundles",i,k=>[k.name,k.uri,k.role],"Filter app bundles"),S=f.find(k=>k.uri===r.selectedUri),w=e.management||{},N=Object.entries(e.actionStatus||{}).some(([k,T])=>k.startsWith("bundle")&&["queued","running","pending","working","discovering","applying"].includes(T.phase));return v.useEffect(()=>{a("bundles.list",{})},[]),n.createElement("div",{className:"a-bundle-pane"},n.createElement(Pa,{id:"add-bundles",title:"Add capabilities",summary:"Browse community bundle repositories",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(qr,null),n.createElement("div",null,n.createElement("h3",null,"Build your Amplifier"),n.createElement("p",null,"Add capabilities from community repositories, then shape the modules they compose into."))),w.error&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,w.error)),N&&n.createElement("div",{className:"a-management-status",role:"status"},n.createElement(Mt,{className:"a-progress-spinner"}),w.detail||"Updating your configuration…"),!N&&w.detail&&n.createElement("p",{className:"a-caption",role:"status"},w.detail),n.createElement("label",{htmlFor:"bundle-source"},"Repository or bundle URL"),n.createElement("div",{className:"a-inline-form"},n.createElement("input",{id:"bundle-source",type:"url",value:r.source,placeholder:"https://github.com/owner/amplifier-bundle","data-action":"view.update",onChange:k=>o({source:k.target.value})}),n.createElement("button",{className:"a-primary",disabled:!r.source.trim()||N,"data-action":"bundle.discover",onClick:()=>a("bundle.discover",{url:r.source.trim()})},n.createElement(To,null),"Browse")),n.createElement("p",{className:"a-caption"},"Browse a repository’s YAML and Markdown bundles before choosing what to add."),f.length>0&&n.createElement("div",{className:"a-discovery","aria-label":"Discovered bundles"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,f.length," ",f.length===1?"bundle found":"bundles found"),h.revision&&n.createElement("code",null,h.revision.slice(0,9))),E,n.createElement("div",{className:"a-candidates"},g.map(k=>n.createElement("label",{className:`a-candidate ${(S==null?void 0:S.uri)===k.uri?"selected":""}`,key:k.uri},n.createElement("input",{type:"radio",name:"bundle-candidate",checked:(S==null?void 0:S.uri)===k.uri,"data-action":"view.update",onChange:()=>o({selectedUri:k.uri,alias:k.name||"",role:k.kind==="standalone"?"standalone":"behavior"})}),n.createElement("span",null,n.createElement("strong",null,k.display_name||k.name||k.path),n.createElement("small",null,k.path||k.uri),k.description&&n.createElement("p",null,k.description)),n.createElement("span",{className:"a-kind-tag"},k.kind||"bundle")))),n.createElement("p",{className:"a-caption"},"Type suggestions are based on file contents. Choose how you want to use the bundle below.")),(S||r.selectedUri)&&n.createElement("div",{className:"a-selection-card"},n.createElement("label",{htmlFor:"bundle-add-role"},"Use this bundle as"),n.createElement("select",{id:"bundle-add-role",value:r.role,"data-action":"view.update",onChange:k=>o({role:k.target.value})},n.createElement("option",{value:"behavior"},"An app capability — compose into sessions"),n.createElement("option",{value:"standalone"},"A standalone bundle — register an alias")),n.createElement("label",{htmlFor:"bundle-alias"},r.role==="standalone"?"Bundle alias":"Display name"),n.createElement("input",{id:"bundle-alias",value:r.alias,"data-action":"view.update",onChange:k=>o({alias:k.target.value}),placeholder:"my-capabilities"}),n.createElement("p",{className:"a-caption a-wrap"},r.selectedUri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-primary",disabled:N||!r.selectedUri||r.role==="standalone"&&!r.alias.trim(),"data-action":"bundles.add",onClick:()=>a("bundles.add",{uri:r.selectedUri,...S!=null&&S.reviewId?{reviewId:S.reviewId}:{},name:r.alias.trim()||void 0,role:r.role})},n.createElement(Ln,null),r.role==="standalone"?"Register bundle":"Add capability"))))),n.createElement(Pa,{id:"app-bundles",title:"App bundles",summary:`${i.length} configured · inspect capabilities and aliases`,state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-row"},n.createElement("div",null,n.createElement("h3",null,"Your app bundles"),n.createElement("p",null,"Capabilities extend your conversations. Standalone aliases are available when starting a conversation.")),n.createElement("button",{className:"a-icon","aria-label":"Refresh app bundles","data-action":"bundles.list",onClick:()=>a("bundles.list")},n.createElement(Mt,null))),n.createElement("div",{className:"a-collection-toolbar"},n.createElement("span",null,i.length," configured · ",p.length," enabled capabilities"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:p.length<2||N,onClick:()=>o({orderOpen:!0,order:r.order||{ids:p.map(k=>k.id),expectedIds:p.map(k=>k.id)}})},"Composition order")),r.order&&r.orderOpen!==!1?n.createElement(xp,{title:"Bundle composition order",description:"Capabilities compose from top to bottom. Later settings can override earlier ones. Disabled entries and standalone aliases are outside this chain.",items:p.map(k=>({id:k.id,label:k.name||k.uri,description:"App capability"})),ids:r.order.ids,onChange:k=>o({order:{...r.order,ids:k}}),onCancel:()=>o({order:null}),busy:["queued","working"].includes(m==null?void 0:m.phase),error:m==null?void 0:m.error,action:"bundles.reorder",onSave:()=>a("bundles.reorder",r.order)}):i.length?n.createElement(Co,{label:"bundles",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,b,y.map(k=>n.createElement(Va,{key:k.id,id:k.id,label:k.name||k.uri,description:k.role==="standalone"?"Standalone alias":"App capability",checked:s[k.id]??k.enabled!==!1,disabled:N,checkLabel:`Enable ${k.name||k.uri}`,checkAction:"bundles.toggle",onCheck:T=>u(k.id,T),selected:k.id===(d==null?void 0:d.id),onSelect:()=>o({entryId:k.id,detailOpen:!0})})))},d&&n.createElement(n.Fragment,null,n.createElement("h4",null,d.name||"Bundle"),n.createElement("p",null,d.role==="standalone"?"Standalone alias · choose it when starting a conversation.":"App capability · composes into prepared conversations."),n.createElement("p",{className:"a-caption"},d.enabled===!1?"Disabled":d.role==="standalone"?"Available as "+d.name:"Position "+(p.findIndex(k=>k.id===d.id)+1)+" of "+p.length+" in composition"),n.createElement("h5",null,"Source"),n.createElement("p",{className:"a-caption a-wrap"},d.uri),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft a-danger","aria-label":`Remove ${d.name||"bundle"}`,disabled:N,"data-action":"bundles.remove",onClick:()=>a("bundles.remove",{id:d.id})},n.createElement(ea,null),"Remove bundle")),n.createElement("p",{className:"a-caption"},"Changes apply to future conversation preparation. Inspect conversation modules to change a loaded session."))):n.createElement("div",{className:"a-settings-empty"},n.createElement(ax,null),n.createElement("span",null,"Your app has no additional bundles yet. Browse a repository to add one.")))),n.createElement(Pa,{id:"loaded-modules",title:"Loaded session modules",summary:t?`Inspect and edit the running mount plan for ${t.title}`:"Select a conversation to inspect its mount plan",state:e,act:a},n.createElement(SD,{state:e,session:t,act:a})),n.createElement(ED,{state:e,act:a}),n.createElement(Pa,{id:"share-bundle",title:"Save and share",summary:"Export this session as a reusable bundle",state:e,act:a},n.createElement("section",{className:"a-settings-section"},n.createElement("div",{className:"a-settings-heading"},n.createElement(wa,null),n.createElement("div",null,n.createElement("h3",null,"Share your setup"),n.createElement("p",null,"Export the current session’s bundle and applied configuration for others to load with Amplifier Foundation."))),n.createElement("label",{htmlFor:"bundle-export-name"},"Bundle name"),n.createElement("input",{id:"bundle-export-name",value:r.exportName,"data-action":"view.update",onChange:k=>o({exportName:k.target.value})}),n.createElement("label",{htmlFor:"bundle-export-description"},"Description"),n.createElement("input",{id:"bundle-export-description",value:r.exportDescription,"data-action":"view.update",onChange:k=>o({exportDescription:k.target.value})}),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!t||N||!r.exportName.trim(),"data-action":"bundle.export",onClick:()=>a("bundle.export",{sessionId:t.id,name:r.exportName.trim(),description:r.exportDescription})},n.createElement(wa,null),"Export app bundle")),n.createElement("p",{className:"a-caption"},"Exports include bundle references and configuration. Provider credentials stay on this machine."))))}function SD({state:e,session:t,act:a}){var w,N,x,A;const[r,o]=Xw((w=e.view)==null?void 0:w.moduleEditor,{sessionId:"",text:"",selectedKey:"",configText:"",name:"my-amplifier",description:"",showRaw:!1,configAdvanced:!1},"moduleEditor",a),i=(t==null?void 0:t.configuration)||(((N=e.configuration)==null?void 0:N.sessionId)===(t==null?void 0:t.id)?e.configuration:null),s=i==null?void 0:i.plan;e.management;const l=(x=e.actionStatus)==null?void 0:x["configuration.apply"],c=(A=e.actionStatus)==null?void 0:A["configuration.inspect"],u=!!(t!=null&&t.configurationBusy)||["queued","working"].includes(c==null?void 0:c.phase)||["queued","working"].includes(l==null?void 0:l.phase),d=!!t&&["working","running","busy","starting","stopping"].includes(t.status);v.useEffect(()=>{t&&a("configuration.inspect",{id:t.id})},[t==null?void 0:t.id]),v.useEffect(()=>{var C,O,k;s&&t&&(r.sessionId!==t.id||!r.text||((C=t.pendingConfiguration)==null?void 0:C.phase)==="ready"&&r.appliedAt!==((O=t.pendingConfiguration)==null?void 0:O.appliedAt))&&o({sessionId:t.id,text:ur(s),selectedKey:"",configText:"",appliedAt:(k=t.pendingConfiguration)==null?void 0:k.appliedAt})},[t==null?void 0:t.id,s]);let p=null,m="";try{r.sessionId===(t==null?void 0:t.id)&&r.text&&(p=wD(r.text))}catch(C){m=C.message}const h=Sp(p),f=h.find(C=>C.key===r.selectedKey),[g,E]=xa(e,a,"loaded-modules",h,C=>[C.id,C.module,C.section,C.source],"Filter loaded modules"),y=!!p&&ur(p)!==ur(s);function b(C,O){try{const k=Ff(p,C,O);o({text:ur(k),...C===r.selectedKey&&O.config?{configText:ur(O.config)}:{}})}catch(k){o({parseError:k.message})}}function S(C){o({selectedKey:C.key,detailOpen:!0,configText:ur(C.config),parseError:""})}return n.createElement("section",{className:"a-settings-section a-module-settings"},n.createElement("div",{className:"a-settings-heading"},n.createElement(Os,null),n.createElement("div",null,n.createElement("h3",null,"Running mount plan"),n.createElement("p",null,t?`Inspect the loaded configuration behind “${t.title}”.`:"Start or select a conversation to inspect its composed configuration."))),t&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:c==null?void 0:c.phase,message:(c==null?void 0:c.error)||(["queued","working"].includes(c==null?void 0:c.phase)?"Reading the loaded AmplifierSession mount plan…":"")}),n.createElement("div",{className:"a-settings-row"},n.createElement("span",{className:"a-caption a-wrap"},t.bundle),n.createElement("button",{className:"a-soft",disabled:u,"data-action":"configuration.inspect",onClick:()=>a("configuration.inspect",{id:t.id})},n.createElement(Mt,null),s?"Refresh configuration":"Load configuration")),s&&n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"The fully composed plan includes your root bundle and app capabilities. Edits below apply to this conversation’s mounted configuration. Apply changes to reload modules and preserve the conversation history."),n.createElement(Co,{label:"modules",detailOpen:!!r.detailOpen,onBack:()=>o({detailOpen:!1}),list:n.createElement(n.Fragment,null,E,g.map(C=>n.createElement(Va,{key:C.key,id:C.key,label:C.id,description:C.section+(C.required?" · required":""),checked:C.enabled,disabled:C.required,checkLabel:`Enable ${C.id}`,onCheck:O=>b(C.key,{enabled:O}),selected:C.key===r.selectedKey,onSelect:()=>S(C)})))},f?n.createElement(n.Fragment,null,n.createElement("h4",null,f.module),f.source&&n.createElement("p",{className:"a-caption a-wrap"},f.source),n.createElement("div",{className:"a-module-fields"},Object.entries(f.config).map(([C,O])=>{const k=/api.?key|password|secret|(?:access|refresh|github|auth).?token/i.test(C),T="module-field-"+C;return n.createElement("div",{key:C},n.createElement("label",{htmlFor:T},C.replaceAll("_"," ")),k?n.createElement("p",{className:"a-caption"},"Credential preserved. Manage keys in Model providers."):typeof O=="boolean"?n.createElement("select",{id:T,value:String(O),"data-action":"view.update",onChange:I=>b(f.key,{config:{...f.config,[C]:I.target.value==="true"}})},n.createElement("option",{value:"true"},"On"),n.createElement("option",{value:"false"},"Off")):O===null||typeof O=="object"?n.createElement("p",{className:"a-caption"},Array.isArray(O)?`${O.length} items`:"Structured value"," · edit in advanced configuration below."):n.createElement("input",{id:T,type:typeof O=="number"?"number":"text",value:O,"data-action":"view.update",onChange:I=>{typeof O=="number"&&!I.target.value||b(f.key,{config:{...f.config,[C]:typeof O=="number"?Number(I.target.value):I.target.value}})}}))})),n.createElement("button",{className:"a-link","data-action":"view.update","aria-expanded":r.configAdvanced,onClick:()=>o({configAdvanced:!r.configAdvanced})},r.configAdvanced?"Hide":"Edit"," advanced configuration"),r.configAdvanced&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"module-config"},"Module configuration (JSON)"),n.createElement("textarea",{id:"module-config",className:"a-json-editor",value:r.configText,spellCheck:!1,"data-action":"view.update",onChange:C=>{try{tr(C.target.value),o({configText:C.target.value,parseError:""})}catch(O){O.message.includes("private API key")?o({parseError:O.message}):o({configText:C.target.value,parseError:""})}}}),n.createElement("button",{className:"a-soft","data-action":"view.update",onClick:()=>{try{const C=tr(r.configText);o({text:ur(Ff(p,f.key,{config:C})),parseError:""})}catch(C){o({parseError:C.message})}}},n.createElement(Pt,null),"Update draft"))):n.createElement("div",{className:"a-settings-empty"},n.createElement(Os,null),n.createElement("span",null,"Select a module to edit its configuration."))),(m||r.parseError)&&n.createElement("div",{className:"a-alert",role:"alert"},n.createElement("span",null,m||r.parseError)),n.createElement("div",{className:"a-module-plan-options"},n.createElement("button",{className:"a-link","data-action":"view.update",onClick:()=>o({showRaw:!r.showRaw})},r.showRaw?"Hide":"Edit"," full configuration JSON"),r.showRaw&&n.createElement(n.Fragment,null,n.createElement("label",{htmlFor:"full-module-plan"},"Full composed plan"),n.createElement("textarea",{id:"full-module-plan",className:"a-json-editor a-full-plan",spellCheck:!1,value:r.text,"data-action":"view.update",onChange:C=>o({text:C.target.value,parseError:""})})),d&&n.createElement("p",{className:"a-caption"},"Work is active. Apply when idle will queue these changes until this turn and its worker lanes finish.")),n.createElement(Rn,null,n.createElement("button",{className:"a-primary",disabled:!p||!!m||u||!y,"data-action":"configuration.apply",onClick:()=>a("configuration.apply",{id:t.id,config:p,whenIdle:!0})},n.createElement(Pt,null),d?"Apply when idle":"Apply to loaded session"),n.createElement("button",{className:"a-soft","data-action":"view.update",disabled:!y&&!r.parseError&&!m,onClick:()=>o({text:ur(s),selectedKey:"",configText:"",parseError:""})},"Revert draft"),n.createElement("span",{className:"a-caption"},y?"Unapplied changes":"Saved configuration")),t.pendingConfiguration&&n.createElement(n.Fragment,null,n.createElement(nt,{phase:t.pendingConfiguration.phase==="queued"?"pending":t.pendingConfiguration.phase==="applying"?"working":t.pendingConfiguration.phase,message:t.pendingConfiguration.error||t.pendingConfiguration.detail||"Applying mount-plan changes…"}),t.pendingConfiguration.phase==="queued"&&n.createElement("button",{className:"a-soft","data-action":"configuration.cancel",onClick:()=>a("configuration.cancel",{id:t.id})},"Cancel queued changes")),n.createElement("div",{className:"a-custom-bundle"},n.createElement("h4",null,"Keep this as a custom bundle"),n.createElement("p",null,"Save the applied configuration under your own name. Use Export below to share it. Apply any pending changes first."),n.createElement("div",{className:"a-form-grid"},n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-name"},"Name"),n.createElement("input",{id:"custom-bundle-name",value:r.name,"data-action":"view.update",onChange:C=>o({name:C.target.value})})),n.createElement("div",null,n.createElement("label",{htmlFor:"custom-bundle-description"},"Description"),n.createElement("input",{id:"custom-bundle-description",value:r.description,"data-action":"view.update",onChange:C=>o({description:C.target.value})}))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{className:"a-soft",disabled:!p||!!m||y||!r.name.trim()||u,"data-action":"bundle.save",onClick:()=>a("bundle.save",{sessionId:t.id,name:r.name.trim(),description:r.description})},n.createElement(wa,null),"Save custom bundle"))))))}function ek(e,t){const[a,r]=v.useState({visibility:"hidden"});return v.useLayoutEffect(()=>{var c,u;if(!e)return;const o=(c=t.current)==null?void 0:c.querySelector(".a-compact-popover"),i=(u=t.current)==null?void 0:u.querySelector("button");if(!o||!i)return;const s=()=>{const d=i.getBoundingClientRect(),p=Math.min(340,window.innerWidth-24),m=o.getBoundingClientRect().height;r({width:p,left:Math.max(12,Math.min(d.left,window.innerWidth-p-12)),top:Math.max(12,Math.min(d.top-m-10,window.innerHeight-m-12)),visibility:"visible"})};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{l.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[e,t]),a}const _i=(e,t)=>{var a,r;return((r=(a=e.registeredBundles)==null?void 0:a.find(o=>o.value===t))==null?void 0:r.label)||t||"Bundle"},Cp={};function tk(e){return e.compact?n.createElement(CD,{...e}):n.createElement(ND,{...e})}function CD({state:e,session:t,act:a,working:r}){var A,C,O,k,T;const o=Ja(e),i=Ag(e),s=((A=e.view)==null?void 0:A.composerBundle)||Cp,[l,c]=v.useState(s),[u,d]=v.useState(!1),[p,m]=v.useState(""),h=v.useRef(!1);v.useEffect(()=>c(s),[s]);const f=I=>{const F={...l,...I};c(F),a("view.update",{patch:{composerBundle:F}})},g=(t==null?void 0:t.bundle)||o.bundle||i.bundle||(((C=e.bundleDefaults)==null?void 0:C.workspacePath)===o.workspace?e.bundleDefaults.effective:""),E=l.open&&l.sessionId===((t==null?void 0:t.id)||null),y=v.useRef(null),b=ek(E,y);il(E,y,()=>f({open:!1})),v.useEffect(()=>{var I;(I=e.registeredBundles)!=null&&I.length||a("bundles.list",{})},[]);const S=e.registeredBundles||[],w=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1;async function N(I,F=!1){if(!h.current){h.current=!0,d(!0),m(""),f({bundle:I});try{await a(t?"bundle.switch":"view.update",t?{sessionId:t.id,bundle:I,resetModel:F}:{patch:{newSessionDraft:{...o,bundle:I}}})}catch(z){m(z.message)}finally{h.current=!1,d(!1)}}}const x=(t==null?void 0:t.bundlePreview)&&t.bundlePreview.bundle===l.bundle&&t.bundlePreview.modelCompatible===!1&&((O=t==null?void 0:t.bundleChange)==null?void 0:O.phase)!=="ready";return n.createElement("div",{className:"a-model-control a-bundle-control",ref:y},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle",disabled:!!w,"aria-expanded":!!E,"data-action":"view.update",onClick:()=>f({open:!E,sessionId:(t==null?void 0:t.id)||null,bundle:g})},n.createElement(qr,null),n.createElement("span",null,g?_i(e,g):i.phase==="error"?"Bundle unavailable":"Loading bundle…"),n.createElement(el,null)),E&&n.createElement("section",{className:"a-model-popover a-compact-popover",style:b,"aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>f({open:!1})},n.createElement(nn,null))),n.createElement("select",{"aria-label":"Registered root bundles",value:g||"",disabled:r||u||(t==null?void 0:t.configurationBusy),"data-action":t?"bundle.switch":"view.update",onChange:I=>N(I.target.value)},!g&&n.createElement("option",{value:"",disabled:!0},"Loading bundles…"),g&&!S.some(I=>I.value===g)&&n.createElement("option",{value:g},_i(e,g)),S.map(I=>n.createElement("option",{key:I.value,value:I.value},I.label||I.value))),((k=S.find(I=>I.value===g))==null?void 0:k.description)&&n.createElement("p",{className:"a-caption a-composer-bundle-description"},S.find(I=>I.value===g).description),x&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("button",{type:"button",className:"a-soft",disabled:u||r,onClick:()=>N(l.bundle,!0)},"Use the new bundle’s model")),(p||((T=t==null?void 0:t.bundleChange)==null?void 0:T.phase)==="error")&&n.createElement("small",{className:"a-danger",role:"status"},p||t.bundleChange.error)))}function ND({state:e,session:t,act:a,working:r}){var O,k,T,I,F;const o=((O=e.view)==null?void 0:O.composerBundle)||Cp,[i,s]=v.useState(o),[l,c]=v.useState(null),u=v.useRef(!1);v.useEffect(()=>s(o),[o]);const d=z=>{const q={...i,...z};s(q),a("view.update",{patch:{composerBundle:q}})},p=Ja(e),m=(t==null?void 0:t.bundle)||p.bundle||((k=e.bundleDefaults)==null?void 0:k.effective)||((T=e.settings)==null?void 0:T.bundle)||"work",h=i.open&&i.sessionId===((t==null?void 0:t.id)||null),f=v.useRef(null);il(h,f,()=>d({open:!1}));const g=t==null?void 0:t.bundleChange,E=t==null?void 0:t.bundlePreview,y=!!l||!!(t!=null&&t.configurationBusy)||(g==null?void 0:g.phase)==="working",b=(E==null?void 0:E.bundle)===i.bundle&&(E==null?void 0:E.previewId),S=(t==null?void 0:t.workspaceAvailable)===!1||(t==null?void 0:t.historyReadOnlyReason)||(t==null?void 0:t.historyLoaded)===!1,w=r||y||S||!((I=i.bundle)!=null&&I.trim()),N=b&&!E.modelCompatible&&!i.resetModel,x=l||(g==null?void 0:g.action),A=x==="bundle.preview"?"Previewing bundle changes…":x==="bundle.fork"?"Creating a conversation with this bundle…":"Switching bundle…";async function C(z){if(!u.current){u.current=!0,c(z);try{await a(z,z==="view.update"?{patch:{newSessionDraft:{...Ja(e),bundle:i.bundle},composerBundle:{},panel:null}}:{sessionId:t.id,bundle:i.bundle,...z!=="bundle.preview"?{...b?{previewId:E.previewId}:{},resetModel:!!i.resetModel}:{}})}finally{u.current=!1,c(null)}}}return n.createElement("div",{className:"a-model-control a-bundle-control",ref:f},n.createElement("button",{type:"button",className:"a-model-trigger a-bundle-trigger","aria-label":"Conversation bundle","aria-expanded":!!h,"data-action":"view.update",onClick:()=>d({open:!h,sessionId:(t==null?void 0:t.id)||null,bundle:m,resetModel:!1})},n.createElement(qr,null),n.createElement("span",null,!t&&!p.bundle?"Workspace default":_i(e,m)),n.createElement(el,null)),h&&n.createElement("section",{className:"a-model-popover a-bundle-popover","aria-label":"Choose conversation bundle"},n.createElement("div",{className:"a-settings-row"},n.createElement("strong",null,"Conversation bundle"),n.createElement("button",{type:"button",className:"a-icon","aria-label":"Close bundle settings","data-action":"view.update",onClick:()=>d({open:!1})},n.createElement(nn,null))),n.createElement("p",null,"Choose the tools, agents, and instructions for this conversation."),n.createElement(Ng,{id:"conversation-bundle",value:i.bundle||m,onChange:z=>d({bundle:z,resetModel:!1}),state:e,act:a}),t?n.createElement(n.Fragment,null,n.createElement("p",{className:"a-caption"},"Switch directly, or preview the changes first. Switching keeps history and compatible model choices, and resets previous module edits, modes, and budget overrides."),b&&n.createElement("div",{className:"a-bundle-changes","aria-label":"Bundle changes"},Object.entries(E.changes||{}).map(([z,q])=>{var W,X,U,_;return n.createElement("div",{key:z},n.createElement("strong",null,z[0].toUpperCase()+z.slice(1)),"after"in q?n.createElement("p",null,q.before||"None"," → ",q.after||"None"):n.createElement(n.Fragment,null,((W=q.added)==null?void 0:W.length)>0&&n.createElement("p",null,"Add: ",q.added.join(", ")),((X=q.removed)==null?void 0:X.length)>0&&n.createElement("p",null,"Remove: ",q.removed.join(", ")),!((U=q.added)!=null&&U.length)&&!((_=q.removed)!=null&&_.length)&&n.createElement("p",null,"Same set; settings may change.")))}),n.createElement("p",null,"Instructions are replaced. Enabled app capabilities and shared settings still apply."),((F=E.appCapabilities)==null?void 0:F.length)>0&&n.createElement("details",null,n.createElement("summary",null,"Added app capabilities (",E.appCapabilities.length,")"),n.createElement("ul",null,E.appCapabilities.map(z=>n.createElement("li",{key:z,className:"a-wrap"},z)))),!E.modelCompatible&&n.createElement(n.Fragment,null,n.createElement("p",null,"Your pinned model is unavailable in this bundle."),n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:!!i.resetModel,"data-action":"view.update",onChange:z=>d({resetModel:z.target.checked})})," Use the new bundle’s model"))),n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w||N||i.bundle===m,"data-action":"bundle.switch",onClick:()=>C("bundle.switch")},"Switch bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:w,"data-action":"bundle.preview",onClick:()=>C("bundle.preview")},"Preview changes"),n.createElement("button",{type:"button",className:"a-soft",disabled:w||N,"data-action":"bundle.fork",onClick:()=>C("bundle.fork")},"Fork with this bundle")),r&&n.createElement("p",null,"Finish this turn and its workers to preview or switch bundles."),(y||g)&&n.createElement(nt,{phase:y?"working":g.phase,message:y?A:g.error||(g.phase==="ready"?g.action==="bundle.preview"?"Preview ready":g.action==="bundle.fork"?"Fork created":"Bundle switched":"")})):n.createElement("div",{className:"a-dialog-actions"},n.createElement("button",{type:"button",className:"a-primary",disabled:w,"data-action":"view.update",onClick:()=>C("view.update")},"Use bundle"),n.createElement("button",{type:"button",className:"a-soft",disabled:y||!p.bundle,"data-action":"view.update",onClick:()=>a("view.update",{patch:{newSessionDraft:{...p,bundle:""},composerBundle:{}}})},"Use workspace default"))))}function RD({state:e,act:t}){var h,f;const a=e.bundleDefaults||{},r=((h=e.view)==null?void 0:h.bundleDefaultsDraft)||Cp,[o,i]=v.useState(r),[s,l]=v.useState(!1),c=v.useRef(!1);v.useEffect(()=>i(r),[r]);const u=o.scope||"app",d=o.bundle??a[u]??"",p=g=>{const E={...o,...g};i(E),t("view.update",{patch:{bundleDefaultsDraft:E}})};async function m(g){var E;if(!c.current){c.current=!0,l(!0);try{await t("bundle.default",{scope:u,bundle:g,workspace:a.workspacePath||((E=e.settings)==null?void 0:E.workspace)})}finally{c.current=!1,l(!1)}}}return n.createElement("div",null,n.createElement("label",{htmlFor:"bundle-default-scope"},"Default applies to"),n.createElement("select",{id:"bundle-default-scope",value:u,"data-action":"view.update",onChange:g=>p({scope:g.target.value,bundle:a[g.target.value]||""})},n.createElement("option",{value:"app"},"This Unified app"),n.createElement("option",{value:"workspace"},"This workspace on this computer"),n.createElement("option",{value:"shared"},"Shared Amplifier settings (including CLI)")),n.createElement("label",{htmlFor:"default-bundle"},"Default bundle for new conversations"),n.createElement(Ng,{id:"default-bundle",value:d,state:e,act:t,onChange:g=>p({bundle:g})}),n.createElement(Rn,null,n.createElement("button",{type:"button",className:"a-primary",disabled:s||!d.trim(),"data-action":"bundle.default",onClick:()=>m(d.trim())},"Save default"),n.createElement("button",{type:"button",className:"a-soft",disabled:s,"data-action":"bundle.default",onClick:async()=>{await m(null),p({bundle:""})}},"Use inherited default")),n.createElement("p",{className:"a-caption"},"New conversations here use ",n.createElement("strong",null,_i(e,a.effective||((f=e.settings)==null?void 0:f.bundle)))," from ",{workspace:"workspace settings",app:"this Unified app",shared:"shared Amplifier settings"}[a.source]||"shared Amplifier settings",". Workspace settings take priority over this app, then shared settings. Existing conversations keep their selected bundles."),u==="workspace"&&a.workspaceInherited&&n.createElement("p",{className:"a-caption"},"Clearing this computer’s override inherits the project’s ",_i(e,a.workspaceInherited)," default."))}const ao={page:"home",serverId:"",toolName:"",repository:"",ref:"",path:"",extras:"",connection:{id:"",name:"",transport:"stdio",command:"",args:"",env:"",cwd:"",url:"",headers:"",auth:"environment",installationId:""},values:{},raw:!1,json:"{}"},jt=e=>["running","working","queued","pending","connecting","installing"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase)),eo=e=>{var t;return["failed","error","interrupted"].includes((e==null?void 0:e.status)||(e==null?void 0:e.phase))||!!(e!=null&&e.error)||((t=e==null?void 0:e.result)==null?void 0:t.isError)===!0},Za=e=>JSON.stringify(e,null,2),ai=e=>Array.isArray(e)?e:Object.values(e||{}),Pi=e=>e.replace(/[_.-]+/g," ").replace(/^./,t=>t.toUpperCase()),Ta=e=>(e==null?void 0:e.repository)||(e==null?void 0:e.repo)||(e==null?void 0:e.url)||"",TD=e=>jt(e)?"working":eo(e)?"error":"ready",ID={"smartTools.catalog":"Catalog refreshed","smartTools.inspect":"Source inspected","smartTools.install":"Installation complete","smartTools.configure":"Connection saved","smartTools.connect":"Connected","smartTools.disconnect":"Disconnected","smartTools.remove":"Connection removed","smartTools.call":"Tool finished","smartTools.open":"Opened in canvas","smartTools.reconnect":"Reconnected","smartTools.schemas":"Tool fields loaded","smartTools.discover":"Tool definitions found","smartTools.uninstall":"Package uninstalled","smartTools.authStart":"Sign-in started","smartTools.authCancel":"Sign-in cancelled","smartTools.authForget":"Local sign-in removed","smartTools.accountAccept":"Account change accepted; reconnect explicitly"};function AD({value:e}){return typeof e=="string"?n.createElement("p",null,e):!Array.isArray(e)||e.some(t=>typeof t!="string"&&typeof(t==null?void 0:t.name)!="string")?n.createElement("pre",null,Za(e)):n.createElement("ul",{className:"a-smart-setup-requirements"},e.map((t,a)=>typeof t=="string"?n.createElement("li",{key:a},t):n.createElement("li",{key:a},n.createElement("strong",null,t.name),t.optional&&n.createElement("small",null," · Optional"),typeof t.purpose=="string"&&n.createElement("p",null,t.purpose),typeof t.install=="string"&&(/^https?:\/\//.test(t.install)?n.createElement("a",{href:t.install,target:"_blank",rel:"noreferrer"},"Setup instructions",n.createElement(sa,null)):n.createElement("p",null,t.install)),Object.keys(t).some(r=>!["name","optional","purpose","install"].includes(r))&&n.createElement("details",null,n.createElement("summary",null,"More requirement details"),n.createElement("pre",null,Za(t))))))}function _D(e,t){var l;const a=(l=e.view)==null?void 0:l.smartToolsEditor,[r,o]=v.useState({...ao,...a}),i=v.useRef(r);return v.useLayoutEffect(()=>{a&&(i.current={...ao,...a},o(i.current))},[a]),[r,c=>{const u={...i.current,...c};i.current=u,o(u),t("view.update",{patch:{smartToolsEditor:u}})}]}function PD(e,t,a={}){return[...e].reverse().find(r=>r.action===t&&Object.entries(a).every(([o,i])=>{var l,c;const s=((l=r.target)==null?void 0:l[o])??((c=r.args)==null?void 0:c[o])??(o==="id"?r.serverId:o==="name"?r.tool||r.name:r[o]);return r.target||r.args?(s??"")===(i??""):s==null||s===i}))}function ga({operation:e,busyMessage:t}){var r;if(!e)return null;const a=e.error||((r=e.result)!=null&&r.isError?"The tool reported an error. See its result below.":jt(e)?t||"Working…":ID[e.action]||"Finished");return n.createElement(nt,{phase:TD(e),message:typeof a=="string"?a:Za(a),detail:e.status==="interrupted"?"The previous app run ended before this request finished. Review the tool state before retrying.":void 0})}function OD({operation:e}){if(!e||jt(e)||e.result==null)return null;const t=e.result,a=!!(t&&typeof t=="object"&&t.$resource),r=a?t.summary??t.preview??null:t,o=typeof r=="string"?r:r==null?"":Za(r);return n.createElement("div",{className:"a-smart-result"},n.createElement("h4",null,"Result"),o&&n.createElement("pre",{tabIndex:0},o.slice(0,24e3)),a?n.createElement("p",{className:"a-caption"},"The full result is saved",typeof t.bytes=="number"?` (${Math.ceil(t.bytes/1024).toLocaleString()} KB)`:"",". Ask your agent to inspect it or show the details you need."):o.length>24e3&&n.createElement("p",{className:"a-caption"},"Showing the first 24,000 characters. The full result is saved and available for your agent to inspect."))}function MD(e){const t=e.split(` `).map(r=>r.trim()).filter(Boolean),a={};for(const r of t){const o=/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*([A-Za-z_][A-Za-z0-9_]*)$/.exec(r);if(!o)throw new Error("Use CHILD_VARIABLE=APP_VARIABLE on each line. Enter variable names, not secret values.");if(Object.hasOwn(a,o[1]))throw new Error(`The variable ${o[1]} appears more than once.`);a[o[1]]=o[2]}return a}function zD(e){const t={};for(const a of e.split(` `).map(r=>r.trim()).filter(Boolean)){const r=/^([A-Za-z][A-Za-z0-9-]*)\s*=\s*([A-Za-z_][A-Za-z0-9_]*)$/.exec(a);if(!r)throw new Error("Use HEADER_NAME=APP_VARIABLE, never credential values.");if(Object.keys(t).some(o=>o.toLowerCase()===r[1].toLowerCase()))throw new Error("Header names must be unique.");t[r[1]]=r[2]}return t}function _c(e,t,a,r){var i;if(a||!(e!=null&&e.properties)||e.oneOf||e.anyOf||e.$ref){const s=JSON.parse(r);if(!s||typeof s!="object"||Array.isArray(s))throw new Error("Tool arguments must be a JSON object.");return s}const o={};for(const[s,l]of Object.entries(e.properties)){let c=t[s]??(l.default==null?"":l.enum||typeof l.default=="object"?Za(l.default):String(l.default));if(c===""){if((i=e.required)!=null&&i.includes(s))throw new Error(`${l.title||Pi(s)} is required.`);continue}if(l.enum)c=JSON.parse(c);else if(l.type==="boolean")c=c==="true";else if(l.type==="integer"||l.type==="number"){if(c=Number(c),!Number.isFinite(c)||l.type==="integer"&&!Number.isInteger(c))throw new Error(`${l.title||Pi(s)} must be ${l.type==="integer"?"a whole number":"a number"}.`)}else(l.type==="object"||l.type==="array"||l.oneOf||l.anyOf||l.$ref||Array.isArray(l.type))&&(c=JSON.parse(c));o[s]=c}return o}function LD({schema:e,values:t,edit:a}){return Object.entries(e.properties||{}).map(([r,o])=>{var m,h;const i=`smart-tool-field-${r}`,s=o.title||Pi(r),l=(m=e.required)==null?void 0:m.includes(r),c=o.type==="object"||o.type==="array"||o.oneOf||o.anyOf||o.$ref||Array.isArray(o.type),u=o.default==null?"":o.enum||c?Za(o.default):String(o.default),d=t[r]??u,p={id:i,value:d,"data-action":"view.update",onChange:f=>a({...t,[r]:f.target.value}),"aria-describedby":o.description?i+"-hint":void 0};return n.createElement("div",{className:"a-smart-field",key:r},n.createElement("label",{htmlFor:i},s,l&&n.createElement("span",{className:"a-smart-required"},"Required")),o.enum?n.createElement("select",{...p},n.createElement("option",{value:""},l?"Choose…":"Tool default"),o.enum.map((f,g)=>n.createElement("option",{key:g,value:JSON.stringify(f)},typeof f=="string"?f:JSON.stringify(f)))):o.type==="boolean"?n.createElement("select",{...p},n.createElement("option",{value:""},l?"Choose…":"Tool default"),n.createElement("option",{value:"true"},"Yes"),n.createElement("option",{value:"false"},"No")):c?n.createElement("textarea",{...p,className:"a-json-editor",spellCheck:!1,placeholder:o.type==="array"?"[]":"{}"}):o.type==="number"||o.type==="integer"?n.createElement("input",{...p,type:"number",step:o.type==="integer"?"1":"any",min:o.minimum,max:o.maximum}):n.createElement("textarea",{...p,rows:2,placeholder:((h=o.examples)==null?void 0:h[0])==null?"":String(o.examples[0])}),o.description&&n.createElement("p",{id:i+"-hint",className:"a-caption"},o.description))})}function DD({state:e,act:t,simple:a=!1,navigateSettings:r}){var ft,Ce,gt,Et,vt,at,ee,Re,ae,Le,Oe,et,st,It,xt,Ut,rt,Xe,$e,Nt,Zt,rn,In,yn,Fn,Gn,An,Jt,dn,ut,ve,ge,At,Ot,Kt,Q,Yt,En,qn,pn,wn,mn,_n,on,pt,mt;const[o,i]=_D(e,t),s=v.useRef(!1),[l,c]=v.useState(null),[u,d]=v.useState(""),[p,m]=v.useState(null),h=e.smartTools||{},f=ai(h.servers),g=ai(h.catalog),E=ai(h.installations).filter(V=>!V.supersededBy&&!V.stagedFrom),y=ai(h.operations),b=f.find(V=>V.id===o.serverId),S=ai(b==null?void 0:b.tools).filter(V=>{var ke,Ge;return(((Ge=(ke=V._meta)==null?void 0:ke.ui)==null?void 0:Ge.visibility)||["model","app"]).includes("model")}),w=S.find(V=>V.name===o.toolName),N=w&&{...w,...(b==null?void 0:b.loadedSchemaRevision)===(b==null?void 0:b.catalogRevision)?(ft=b==null?void 0:b.loadedSchemas)==null?void 0:ft[o.toolName]:{}},x=!!(N!=null&&N.inputSchema)&&(b==null?void 0:b.catalogState)!=="stale",A=(V,ke={})=>(l==null?void 0:l.action)===V?l:PD(y,V,ke),C=async(V,ke={})=>{d(""),c({action:V,status:"pending",target:ke});try{const Ge=await t(V,ke);if(!Ge||Ge.accepted===!1)throw new Error("The request could not be sent. Please try again.");return c(null),Ge}catch(Ge){return c({action:V,status:"failed",error:Ge.message,target:ke}),null}},O=(V,ke={})=>{d(""),c(null),i({page:V,catalogReview:!1,catalogInstalling:!1,returnPage:V==="source"&&o.page==="catalog"?"catalog":null,...ke})},k={...ao.connection,...o.connection},T=V=>i({connection:{...k,...V}}),I=[...y].reverse().find(jt),F=jt(l)||y.some(V=>{var ke,Ge,Dt;return jt(V)&&(o.page==="source"?((ke=V.target)==null?void 0:ke.repository)===o.repository.trim():o.page==="connection"?V.action==="smartTools.configure"&&(((Ge=V.target)==null?void 0:Ge.id)||"")===k.id:["server","tool"].includes(o.page)?((Dt=V.target)==null?void 0:Dt.id)===(b==null?void 0:b.id):!1)}),[z,q]=xa(e,t,"smart-tool-connections",f,V=>[V.name,V.command,V.status],"Filter connections"),[W,X,U]=xa(e,t,"smart-tool-catalog",g,V=>[V.name,V.id,V.description,Ta(V)],a?"Search tools":"Filter catalog",{simple:a}),[_,P]=xa(e,t,"smart-tool-actions-"+((b==null?void 0:b.id)||""),S,V=>[V.name,V.title,V.description],"Filter tools"),G=A("smartTools.installBatch"),Z=jt(G),D=V=>E.some(ke=>Ta(ke).replace(/\.git$/,"")===Ta(V).replace(/\.git$/,"")&&(ke.path||".")===(V.path||".")),ne=o.catalogSelection||[],H=g.filter(V=>ne.includes(V.id)&&!D(V)),j=Math.max(1,Math.min(o.catalogPage||1,Math.ceil(W.length/40)||1)),ie=W.length>50,Ee=ie?W.slice((j-1)*40,j*40):W,me=g.find(V=>V.id===o.catalogId)||Ee[0],_e=(V,ke)=>i({catalogSelection:ke?[...new Set([...ne,V])]:ne.filter(Ge=>Ge!==V)}),Je=V=>i({catalogSelection:[...new Set([...ne,...V.filter(ke=>!D(ke)).map(ke=>ke.id)])]});v.useEffect(()=>{i({catalogPage:1})},[U]);const De=o.page==="tool"?"server":"home",ue=V=>O("connection",{connection:V?{id:V.id,name:V.name,command:V.command,args:(V.args||[]).join(` `),env:Object.entries(V.env||{}).map(([ke,Ge])=>ke+"="+Ge).join(` diff --git a/amplifier_web/static/assets/arc-CxD3pp7w.js b/amplifier_web/static/assets/arc-D2jKxjLS.js similarity index 98% rename from amplifier_web/static/assets/arc-CxD3pp7w.js rename to amplifier_web/static/assets/arc-D2jKxjLS.js index 396a0082a..6d3db2f6f 100644 --- a/amplifier_web/static/assets/arc-CxD3pp7w.js +++ b/amplifier_web/static/assets/arc-D2jKxjLS.js @@ -1 +1 @@ -import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-BQ5lTCZr.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,B,a){var O=I-l,i=D-h,n=B-v,d=a-A,u=d*O-n*i;if(!(u*ur*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,C=rn(c-f),t=c>f;if(a||(a=n=O()),sy))a.moveTo(0,0);else if(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(Cy?x>y?(e=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),pr*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,C=rn(c-f),t=c>f;if(a||(a=n=O()),sy))a.moveTo(0,0);else if(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(Cy?x>y?(e=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),ps?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=O[tt],O[tt]=O[H],O[H]=k;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(k)||(a.nodesInRelativeHorizontal.push(k),a.nodeToRelativeConstraintMapHorizontal.set(k,[]),a.dummyToNodeForVerticalAlignment.has(k)?a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(k).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,k=0;k{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var Z=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?Z++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,Z=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var Z={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var Z=new Set;Ot[U].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(Z).x,Z.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(Z).y,Z.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],k=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(k).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var Z=void 0;if(U){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(Z.isParent()?w[U].push(b.get(Z.id())):w[U].push(Z.id()))})});var Nt=function(U){var Z=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[Z].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=ur(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await gr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` +import{p as qe}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{_ as ct,D as Qe,X as Je,l as Fe,b as Ke,a as je,n as _e,o as tr,g as er,s as rr,p as ir,A as ar,y as nr,B as or,c as Ee,b4 as Te,aj as pe,i as sr,j as hr,q as lr,ak as fr,b5 as cr}from"./mermaid.core-YRnlneqM.js";import{p as gr}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import{c as be}from"./cytoscape.esm-Ix0LnXOy.js";import{g as ur}from"./client-BPXDbY79.js";import"./app-DmCHnbVO.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=O[tt],O[tt]=O[H],O[H]=k;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(k)||(a.nodesInRelativeHorizontal.push(k),a.nodeToRelativeConstraintMapHorizontal.set(k,[]),a.dummyToNodeForVerticalAlignment.has(k)?a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(k,a.idToNodeMap.get(k).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,k=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,k=0;k{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var Z=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?Z++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,Z=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var Z={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var Z=new Set;Ot[U].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(Z).x,Z.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(Z).y,Z.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],k=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(k).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var Z=void 0;if(U){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(Z.isParent()?w[U].push(b.get(Z.id())):w[U].push(Z.id()))})});var Nt=function(U){var Z=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[Z].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=ur(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await gr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` .edge { stroke-width: ${I.archEdgeWidth}; stroke: ${I.archEdgeColor}; diff --git a/amplifier_web/static/assets/blockDiagram-I7D4REHJ-JIRyk-UT.js b/amplifier_web/static/assets/blockDiagram-I7D4REHJ-DIqSOQsY.js similarity index 99% rename from amplifier_web/static/assets/blockDiagram-I7D4REHJ-JIRyk-UT.js rename to amplifier_web/static/assets/blockDiagram-I7D4REHJ-DIqSOQsY.js index abd8edf25..b94c6a73a 100644 --- a/amplifier_web/static/assets/blockDiagram-I7D4REHJ-JIRyk-UT.js +++ b/amplifier_web/static/assets/blockDiagram-I7D4REHJ-DIqSOQsY.js @@ -1,4 +1,4 @@ -import{g as Pe}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{aC as Fe,aD as ye,aE as Me,aF as Ke,aG as Ye,aH as We,aI as Ve,aJ as Ue,aK as He,aL as Xe,aM as je,aN as Ge,aO as qe,aP as Je,aQ as Ze,aR as Qe,aS as $e,aT as et,aU as tt,aV as st,aW as rt,aX as it,aY as at,aZ as nt,a_ as ot,_ as g,y as j,j as J,a$ as ct,d as lt,l as m,p as ut,r as gt,c as me,P as ht,ay as dt,ax as pt,az as ft,k as St,b0 as xt,af as be,ag as Lt}from"./mermaid.core-BQ5lTCZr.js";import{c as yt}from"./channel-CSv1n6Zd.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";function mt(e){return Array.isArray(e)}function bt(e){if(Fe(e))return e;const n=ye(e);if(!wt(e))return{};if(mt(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Me(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(n==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(n==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(n==="[object Boolean]"||n==="[object Number]"||n==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return n==="[object String]"?_t(c,e):re(c,e),c}if(n==="[object Date]")return new Date(Number(e));if(n==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(n==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(n==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(n==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(n==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(ye(e)){case ot:case nt:case at:case it:case rt:case st:case tt:case et:case $e:case Qe:case Ze:case Je:case qe:case Ge:case je:case Xe:case He:case Ue:case Ve:case We:case Ye:case Ke:return!0;default:return!1}}function re(e,n){for(const l in n)Object.hasOwn(n,l)&&(e[l]=n[l])}function Et(e,n){const l=Object.getOwnPropertySymbols(n);for(let s=0;s=l)&&(e[s]=n[s])}function Dt(e,n){const l=Object.getPrototypeOf(n);l!==null&&typeof n.constructor=="function"&&Object.setPrototypeOf(e,l)}var ae=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),n=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],y=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var a=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[a-1]),u.setHierarchy(t[a-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[a]),typeof t[a].length=="number"?this.$=t[a]:this.$=[t[a]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[a-1]),this.$=[t[a-1]].concat(t[a]);break;case 14:u.getLogger().debug("Rule: link: ",t[a],h),this.$={edgeTypeStr:t[a],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[a-3],t[a-1],t[a]),this.$={edgeTypeStr:t[a],label:t[a-1]};break;case 18:const f=parseInt(t[a]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[a-2],t[a-1],t[a]," typestr: ",t[a-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[a-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[a-1].edgeTypeStr),K=u.edgeStrToThickness(t[a-1].edgeTypeStr),b=u.edgeStrToPattern(t[a-1].edgeTypeStr);this.$=[{id:t[a-2].id,label:t[a-2].label,type:t[a-2].type,directions:t[a-2].directions},{id:t[a-2].id+"-"+t[a].id,start:t[a-2].id,end:t[a].id,label:t[a-1].label,type:"edge",thickness:K,pattern:b,directions:t[a].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[a-1],t[a]),this.$={id:t[a-1].id,label:t[a-1].label,type:u.typeStr2Type(t[a-1].typeStr),directions:t[a-1].directions,widthInColumns:parseInt(t[a],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[a]),this.$={id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[a]),this.$={type:"column-setting",columns:t[a]==="auto"?-1:parseInt(t[a])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[a-2],t[a-1]),u.generateId(),this.$={...t[a-2],type:"composite",children:t[a-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[a-2],t[a-1],t[a]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[a-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[a]),this.$={id:t[a]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[a-1],t[a]),this.$={id:t[a-1],label:t[a].label,typeStr:t[a].typeStr,directions:t[a].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[a]),this.$=[t[a]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[a-1],t[a]),this.$=[t[a-1]].concat(t[a]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[a-2],t[a-1],t[a]),this.$={typeStr:t[a-2]+t[a],label:t[a-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[a-3],t[a-2]," #3:",t[a-1],t[a]),this.$={typeStr:t[a-3]+t[a],label:t[a-2],directions:t[a-1]};break;case 35:case 36:this.$={type:"classDef",id:t[a-1].trim(),css:t[a].trim()};break;case 37:this.$={type:"applyClass",id:t[a-1].trim(),styleClass:t[a].trim()};break;case 38:this.$={type:"applyStyles",id:t[a-1].trim(),stylesStr:t[a].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:n,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(y,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:n,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:n,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(y,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:n,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,a="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: +import{g as Pe}from"./chunk-5VM5RSS4-DuWyxJ-G.js";import{aC as Fe,aD as ye,aE as Me,aF as Ke,aG as Ye,aH as We,aI as Ve,aJ as Ue,aK as He,aL as Xe,aM as je,aN as Ge,aO as qe,aP as Je,aQ as Ze,aR as Qe,aS as $e,aT as et,aU as tt,aV as st,aW as rt,aX as it,aY as at,aZ as nt,a_ as ot,_ as g,y as j,j as J,a$ as ct,d as lt,l as m,p as ut,r as gt,c as me,P as ht,ay as dt,ax as pt,az as ft,k as St,b0 as xt,af as be,ag as Lt}from"./mermaid.core-YRnlneqM.js";import{c as yt}from"./channel-BcBgmgAp.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";function mt(e){return Array.isArray(e)}function bt(e){if(Fe(e))return e;const n=ye(e);if(!wt(e))return{};if(mt(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Me(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(n==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(n==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(n==="[object Boolean]"||n==="[object Number]"||n==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return n==="[object String]"?_t(c,e):re(c,e),c}if(n==="[object Date]")return new Date(Number(e));if(n==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(n==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(n==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(n==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(n==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(ye(e)){case ot:case nt:case at:case it:case rt:case st:case tt:case et:case $e:case Qe:case Ze:case Je:case qe:case Ge:case je:case Xe:case He:case Ue:case Ve:case We:case Ye:case Ke:return!0;default:return!1}}function re(e,n){for(const l in n)Object.hasOwn(n,l)&&(e[l]=n[l])}function Et(e,n){const l=Object.getOwnPropertySymbols(n);for(let s=0;s=l)&&(e[s]=n[s])}function Dt(e,n){const l=Object.getPrototypeOf(n);l!==null&&typeof n.constructor=="function"&&Object.setPrototypeOf(e,l)}var ae=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),n=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],y=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var a=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[a-1]),u.setHierarchy(t[a-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[a]),typeof t[a].length=="number"?this.$=t[a]:this.$=[t[a]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[a-1]),this.$=[t[a-1]].concat(t[a]);break;case 14:u.getLogger().debug("Rule: link: ",t[a],h),this.$={edgeTypeStr:t[a],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[a-3],t[a-1],t[a]),this.$={edgeTypeStr:t[a],label:t[a-1]};break;case 18:const f=parseInt(t[a]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[a-2],t[a-1],t[a]," typestr: ",t[a-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[a-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[a-1].edgeTypeStr),K=u.edgeStrToThickness(t[a-1].edgeTypeStr),b=u.edgeStrToPattern(t[a-1].edgeTypeStr);this.$=[{id:t[a-2].id,label:t[a-2].label,type:t[a-2].type,directions:t[a-2].directions},{id:t[a-2].id+"-"+t[a].id,start:t[a-2].id,end:t[a].id,label:t[a-1].label,type:"edge",thickness:K,pattern:b,directions:t[a].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[a-1],t[a]),this.$={id:t[a-1].id,label:t[a-1].label,type:u.typeStr2Type(t[a-1].typeStr),directions:t[a-1].directions,widthInColumns:parseInt(t[a],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[a]),this.$={id:t[a].id,label:t[a].label,type:u.typeStr2Type(t[a].typeStr),directions:t[a].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[a]),this.$={type:"column-setting",columns:t[a]==="auto"?-1:parseInt(t[a])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[a-2],t[a-1]),u.generateId(),this.$={...t[a-2],type:"composite",children:t[a-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[a-2],t[a-1],t[a]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[a-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[a]),this.$={id:t[a]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[a-1],t[a]),this.$={id:t[a-1],label:t[a].label,typeStr:t[a].typeStr,directions:t[a].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[a]),this.$=[t[a]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[a-1],t[a]),this.$=[t[a-1]].concat(t[a]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[a-2],t[a-1],t[a]),this.$={typeStr:t[a-2]+t[a],label:t[a-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[a-3],t[a-2]," #3:",t[a-1],t[a]),this.$={typeStr:t[a-3]+t[a],label:t[a-2],directions:t[a-1]};break;case 35:case 36:this.$={type:"classDef",id:t[a-1].trim(),css:t[a].trim()};break;case 37:this.$={type:"applyClass",id:t[a-1].trim(),styleClass:t[a].trim()};break;case 38:this.$={type:"applyStyles",id:t[a-1].trim(),stylesStr:t[a].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:n,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(y,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:n,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:n,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(y,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:n,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,a="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: `+b.showPosition()+` Expecting `+q.join(", ")+", got '"+(this.terminals_[B]||B)+"'":se="Parse error on line "+(f+1)+": Unexpected "+(B==M?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(se,{text:b.match,token:this.terminals_[B]||B,line:b.yylineno,loc:H,expected:q})}if(P[0]instanceof Array&&P.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(P[0]){case 1:o.push(B),L.push(b.yytext),t.push(b.yylloc),o.push(P[1]),B=null,w=b.yyleng,a=b.yytext,f=b.yylineno,H=b.yylloc;break;case 2:if(W=this.productions_[P[1]][1],U.$=L[L.length-W],U._$={first_line:t[t.length-(W||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(W||1)].first_column,last_column:t[t.length-1].last_column},ee&&(U._$.range=[t[t.length-(W||1)].range[0],t[t.length-1].range[1]]),te=this.performAction.apply(U,[a,w,f,R.yy,P[1],L,t].concat(K)),typeof te<"u")return te;W&&(o=o.slice(0,-1*W*2),L=L.slice(0,-1*W),t=t.slice(0,-1*W)),o.push(this.productions_[P[1]][0]),L.push(U.$),t.push(U._$),fe=O[o[o.length-2]][o[o.length-1]],o.push(fe);break;case 3:return!0}}return!0},"parse")},D=(function(){var T={EOF:1,parseError:g(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:g(function(h,i){return this.yy=i||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var i=h.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:g(function(h){var i=h.length,o=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var L=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===u.length?this.yylloc.first_column:0)+u[u.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[L[0],L[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(h){this.unput(this.match.slice(h))},"less"),pastInput:g(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var h=this.pastInput(),i=new Array(h.length+1).join("-");return h+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/c4Diagram-7LVT6UL2-DdetwEv8.js b/amplifier_web/static/assets/c4Diagram-7LVT6UL2-CyJ-OjiV.js similarity index 99% rename from amplifier_web/static/assets/c4Diagram-7LVT6UL2-DdetwEv8.js rename to amplifier_web/static/assets/c4Diagram-7LVT6UL2-CyJ-OjiV.js index fcdc8a7ee..c4ff32e1d 100644 --- a/amplifier_web/static/assets/c4Diagram-7LVT6UL2-DdetwEv8.js +++ b/amplifier_web/static/assets/c4Diagram-7LVT6UL2-CyJ-OjiV.js @@ -1,4 +1,4 @@ -import{d as Le}from"./chunk-F27PBJKO-35QGDevQ.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as be,j as Jt,w as je,k as $t,m as de}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Ut=(function(){var t=d(function(yt,m,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=m);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],b=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(m,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(m,x){if(x.recoverable)this.trace(m);else{var E=new Error(m);throw E.hash=x,E}},"parseError"),parse:d(function(m){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(m,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: +import{d as Le}from"./chunk-F27PBJKO-2GmsQB4U.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as be,j as Jt,w as je,k as $t,m as de}from"./mermaid.core-YRnlneqM.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var Ut=(function(){var t=d(function(yt,m,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=m);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],b=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(m,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:b,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(m,x){if(x.recoverable)this.trace(m);else{var E=new Error(m);throw E.hash=x,E}},"parseError"),parse:d(function(m){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(m,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: `+A.showPosition()+` Expecting `+Yt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":Gt="Parse error on line "+(xt+1)+": Unexpected "+(M==le?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(Gt,{text:A.match,token:this.terminals_[M]||M,line:A.yylineno,loc:Qt,expected:Yt})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Et+", token: "+M);switch(V[0]){case 1:E.push(M),D.push(A.yytext),i.push(A.yylloc),E.push(V[1]),M=null,oe=A.yyleng,p=A.yytext,xt=A.yylineno,Qt=A.yylloc;break;case 2:if(j=this.productions_[V[1]][1],Tt.$=D[D.length-j],Tt._$={first_line:i[i.length-(j||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(j||1)].first_column,last_column:i[i.length-1].last_column},Ne&&(Tt._$.range=[i[i.length-(j||1)].range[0],i[i.length-1].range[1]]),Kt=this.performAction.apply(Tt,[p,oe,xt,vt.yy,V[1],D,i].concat(De)),typeof Kt<"u")return Kt;j&&(E=E.slice(0,-1*j*2),D=D.slice(0,-1*j),i=i.slice(0,-1*j)),E.push(this.productions_[V[1]][0]),D.push(Tt.$),i.push(Tt._$),ue=Pt[E[E.length-2]][E[E.length-1]],E.push(ue);break;case 3:return!0}}return!0},"parse")},Oe=(function(){var yt={EOF:1,parseError:d(function(x,E){if(this.yy.parser)this.yy.parser.parseError(x,E);else throw new Error(x)},"parseError"),setInput:d(function(m,x){return this.yy=x||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var x=m.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:d(function(m){var x=m.length,E=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var _=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var D=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===_.length?this.yylloc.first_column:0)+_[_.length-E.length].length-E[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(m){this.unput(this.match.slice(m))},"less"),pastInput:d(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var m=this.pastInput(),x=new Array(m.length+1).join("-");return m+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/channel-BcBgmgAp.js b/amplifier_web/static/assets/channel-BcBgmgAp.js new file mode 100644 index 000000000..e85cc0fc0 --- /dev/null +++ b/amplifier_web/static/assets/channel-BcBgmgAp.js @@ -0,0 +1 @@ +import{ah as o,ai as n}from"./mermaid.core-YRnlneqM.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c}; diff --git a/amplifier_web/static/assets/channel-CSv1n6Zd.js b/amplifier_web/static/assets/channel-CSv1n6Zd.js deleted file mode 100644 index 63dbab77f..000000000 --- a/amplifier_web/static/assets/channel-CSv1n6Zd.js +++ /dev/null @@ -1 +0,0 @@ -import{ah as o,ai as n}from"./mermaid.core-BQ5lTCZr.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c}; diff --git a/amplifier_web/static/assets/chunk-2Q5K7J3B-DR5XPUmF.js b/amplifier_web/static/assets/chunk-2Q5K7J3B-Ca-MXWFO.js similarity index 66% rename from amplifier_web/static/assets/chunk-2Q5K7J3B-DR5XPUmF.js rename to amplifier_web/static/assets/chunk-2Q5K7J3B-Ca-MXWFO.js index 4044eaa0b..d506ed796 100644 --- a/amplifier_web/static/assets/chunk-2Q5K7J3B-DR5XPUmF.js +++ b/amplifier_web/static/assets/chunk-2Q5K7J3B-Ca-MXWFO.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-BQ5lTCZr.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; +import{_ as s}from"./mermaid.core-YRnlneqM.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; diff --git a/amplifier_web/static/assets/chunk-5VM5RSS4-XkKVGNmc.js b/amplifier_web/static/assets/chunk-5VM5RSS4-DuWyxJ-G.js similarity index 83% rename from amplifier_web/static/assets/chunk-5VM5RSS4-XkKVGNmc.js rename to amplifier_web/static/assets/chunk-5VM5RSS4-DuWyxJ-G.js index 96fc84bce..6cf7eb06f 100644 --- a/amplifier_web/static/assets/chunk-5VM5RSS4-XkKVGNmc.js +++ b/amplifier_web/static/assets/chunk-5VM5RSS4-DuWyxJ-G.js @@ -1,4 +1,4 @@ -import{_ as e}from"./mermaid.core-BQ5lTCZr.js";var l=e(()=>` +import{_ as e}from"./mermaid.core-YRnlneqM.js";var l=e(()=>` /* Font Awesome icon styling - consolidated */ .label-icon { display: inline-block; diff --git a/amplifier_web/static/assets/chunk-F27PBJKO-35QGDevQ.js b/amplifier_web/static/assets/chunk-F27PBJKO-2GmsQB4U.js similarity index 96% rename from amplifier_web/static/assets/chunk-F27PBJKO-35QGDevQ.js rename to amplifier_web/static/assets/chunk-F27PBJKO-2GmsQB4U.js index c333e3989..3126c386d 100644 --- a/amplifier_web/static/assets/chunk-F27PBJKO-35QGDevQ.js +++ b/amplifier_web/static/assets/chunk-F27PBJKO-2GmsQB4U.js @@ -1 +1 @@ -import{_ as i,j as l,T as d,G as o}from"./mermaid.core-BQ5lTCZr.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,h as b,g as c,x as d,m as e,w as f,f as g,y as h}; +import{_ as i,j as l,T as d,G as o}from"./mermaid.core-YRnlneqM.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,h as b,g as c,x as d,m as e,w as f,f as g,y as h}; diff --git a/amplifier_web/static/assets/chunk-IMKFNOWR-D_IoXv7y.js b/amplifier_web/static/assets/chunk-IMKFNOWR-qeP8E-nc.js similarity index 99% rename from amplifier_web/static/assets/chunk-IMKFNOWR-D_IoXv7y.js rename to amplifier_web/static/assets/chunk-IMKFNOWR-qeP8E-nc.js index 0339b8e11..e7ac55e29 100644 --- a/amplifier_web/static/assets/chunk-IMKFNOWR-D_IoXv7y.js +++ b/amplifier_web/static/assets/chunk-IMKFNOWR-qeP8E-nc.js @@ -1,4 +1,4 @@ -import{g as ee}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as se}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as S,l as b,c as F,v as ie,x as re,a as ae,b as ne,g as oe,s as le,n as ce,o as he,S as ue,k as K,p as de,j as Dt}from"./mermaid.core-BQ5lTCZr.js";import{f as fe}from"./chunk-F27PBJKO-35QGDevQ.js";import{p as pe}from"./app-zsnl1T1T.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],I=[1,20],v=[1,21],x=[1,22],$=[1,23],O=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(R){n.length=n.length-2*R,_.length=_.length-R,r.length=r.length-R}S(te,"popStack");function wt(){var R;return R=g.pop()||D.lex()||et,typeof R!="number"&&(R instanceof Array&&(g=R,R=g.pop()),R=u.symbols_[R]||R),R}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,It,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: +import{g as ee}from"./chunk-XXDRQBXY-CEoTwp0p.js";import{s as se}from"./chunk-POPQ4Y6H-OaNnn-K8.js";import{_ as S,l as b,c as F,v as ie,x as re,a as ae,b as ne,g as oe,s as le,n as ce,o as he,S as ue,k as K,p as de,j as Dt}from"./mermaid.core-YRnlneqM.js";import{f as fe}from"./chunk-F27PBJKO-2GmsQB4U.js";import{p as pe}from"./app-DmCHnbVO.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],I=[1,20],v=[1,21],x=[1,22],$=[1,23],O=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:I,26:v,27:x,28:$,29:O,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(R){n.length=n.length-2*R,_.length=_.length-R,r.length=r.length-R}S(te,"popStack");function wt(){var R;return R=g.pop()||D.lex()||et,typeof R!="number"&&(R instanceof Array&&(g=R,R=g.pop()),R=u.symbols_[R]||R),R}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,It,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: `+D.showPosition()+` Expecting `+ft.join(", ")+", got '"+(this.terminals_[w]||w)+"'":bt="Parse error on line "+(G+1)+": Unexpected "+(w==et?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(bt,{text:D.match,token:this.terminals_[w]||w,line:D.yylineno,loc:_t,expected:ft})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+w);switch(N[0]){case 1:n.push(w),_.push(D.yytext),r.push(D.yylloc),n.push(N[1]),w=null,q=D.yyleng,c=D.yytext,G=D.yylineno,_t=D.yylloc;break;case 2:if(M=this.productions_[N[1]][1],Q.$=_[_.length-M],Q._$={first_line:r[r.length-(M||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(M||1)].first_column,last_column:r[r.length-1].last_column},Zt&&(Q._$.range=[r[r.length-(M||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(Q,[c,q,G,H.yy,N[1],_,r].concat(Tt)),typeof mt<"u")return mt;M&&(n=n.slice(0,-1*M*2),_=_.slice(0,-1*M),r=r.slice(0,-1*M)),n.push(this.productions_[N[1]][0]),_.push(Q.$),r.push(Q._$),It=Y[n[n.length-2]][n[n.length-1]],n.push(It);break;case 3:return!0}}return!0},"parse")},Qt=(function(){var U={EOF:1,parseError:S(function(u,n){if(this.yy.parser)this.yy.parser.parseError(u,n);else throw new Error(u)},"parseError"),setInput:S(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:S(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:S(function(l){var u=l.length,n=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===g.length?this.yylloc.first_column:0)+g[g.length-n.length].length-n[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:S(function(){return this._more=!0,this},"more"),reject:S(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:S(function(l){this.unput(this.match.slice(l))},"less"),pastInput:S(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:S(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:S(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/chunk-JWPE2WC7-wq4F1yC9.js b/amplifier_web/static/assets/chunk-JWPE2WC7-DQLdNA-f.js similarity index 78% rename from amplifier_web/static/assets/chunk-JWPE2WC7-wq4F1yC9.js rename to amplifier_web/static/assets/chunk-JWPE2WC7-DQLdNA-f.js index 887ce1430..85aabc2bd 100644 --- a/amplifier_web/static/assets/chunk-JWPE2WC7-wq4F1yC9.js +++ b/amplifier_web/static/assets/chunk-JWPE2WC7-DQLdNA-f.js @@ -1 +1 @@ -import{_ as l}from"./mermaid.core-BQ5lTCZr.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; +import{_ as l}from"./mermaid.core-YRnlneqM.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; diff --git a/amplifier_web/static/assets/chunk-POPQ4Y6H-C_hQ_kWj.js b/amplifier_web/static/assets/chunk-POPQ4Y6H-OaNnn-K8.js similarity index 87% rename from amplifier_web/static/assets/chunk-POPQ4Y6H-C_hQ_kWj.js rename to amplifier_web/static/assets/chunk-POPQ4Y6H-OaNnn-K8.js index 67e3587bc..36a8ff372 100644 --- a/amplifier_web/static/assets/chunk-POPQ4Y6H-C_hQ_kWj.js +++ b/amplifier_web/static/assets/chunk-POPQ4Y6H-OaNnn-K8.js @@ -1 +1 @@ -import{_ as a,d as w,l as x}from"./mermaid.core-BQ5lTCZr.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; +import{_ as a,d as w,l as x}from"./mermaid.core-YRnlneqM.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; diff --git a/amplifier_web/static/assets/chunk-SVP7TREG-DegBQCYH.js b/amplifier_web/static/assets/chunk-SVP7TREG-Wjd95MYc.js similarity index 99% rename from amplifier_web/static/assets/chunk-SVP7TREG-DegBQCYH.js rename to amplifier_web/static/assets/chunk-SVP7TREG-Wjd95MYc.js index 1d51b8f61..47b03eb85 100644 --- a/amplifier_web/static/assets/chunk-SVP7TREG-DegBQCYH.js +++ b/amplifier_web/static/assets/chunk-SVP7TREG-Wjd95MYc.js @@ -1,4 +1,4 @@ -import{_ as p,l as k,D as H,y as B,p as q,E as G,d as U,i as j,c as K}from"./mermaid.core-BQ5lTCZr.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),k.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),k.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};k.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&k.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),k.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` +import{_ as p,l as k,D as H,y as B,p as q,E as G,d as U,i as j,c as K}from"./mermaid.core-YRnlneqM.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),k.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),k.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};k.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&k.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),k.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` `),k.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),ie=p(()=>O,"getAccDescription"),ne=Y,ae=P,oe={clear:J,setTitle:Y,getTitle:P,addRule:Q,getRules:Z,getRule:V,setAccTitle:ee,getAccTitle:te,setAccDescription:re,getAccDescription:ie,setDiagramTitle:ne,getDiagramTitle:ae},f={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},le=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,se=/^[\w "',.-]+$/,de=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),L=p(e=>e?Object.keys(e).every(i=>i==="railroad"||de.has(i)):!1,"isRailroadStyleOptions"),ce=p(e=>e?"railroad"in e&&e.railroad?e.railroad:L(e)?e:{}:{},"extractRailroadOverrides"),me=p(e=>{if(!e||L(e))return{};const{railroad:i,svgId:a,theme:n,look:t,...r}=e;return r},"extractThemeOverrides"),m=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return le.test(a)?a:i},"sanitizeColorValue"),I=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return se.test(a)?a:i},"sanitizeFontFamilyValue"),F=p((e,i)=>{const a=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(a)&&a>=0?a:i},"sanitizeNumberValue"),he=p(e=>{const i=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(i)&&i>0?i:void 0},"parseThemeFontSize"),pe=p(e=>{const i=I(e.fontFamily,f.fontFamily),a=he(e.fontSize)??f.fontSize;return{...f,fontFamily:i,fontSize:a,terminalFill:m(e.secondBkg??e.secondaryColor,f.terminalFill),terminalStroke:m(e.secondaryBorderColor??e.lineColor,f.terminalStroke),terminalTextColor:m(e.secondaryTextColor??e.textColor,f.terminalTextColor),nonTerminalFill:m(e.mainBkg??e.background,f.nonTerminalFill),nonTerminalStroke:m(e.primaryBorderColor??e.lineColor,f.nonTerminalStroke),nonTerminalTextColor:m(e.primaryTextColor??e.textColor,f.nonTerminalTextColor),lineColor:m(e.lineColor,f.lineColor),markerFill:m(e.lineColor,f.markerFill),commentFill:m(e.labelBackground??e.tertiaryColor,f.commentFill),commentStroke:m(e.tertiaryBorderColor??e.lineColor,f.commentStroke),commentTextColor:m(e.tertiaryTextColor??e.textColor,f.commentTextColor),specialFill:m(e.tertiaryColor??e.secondaryColor,f.specialFill),specialStroke:m(e.tertiaryBorderColor??e.secondaryBorderColor,f.specialStroke),ruleNameColor:m(e.titleColor??e.textColor,f.ruleNameColor)}},"buildThemeDefaults"),E=p(e=>{const i=B(),a={...G(),...i.themeVariables??{},...me(e)},n=pe(a),t={...i.railroad??{},...ce(e)};return{compactMode:t.compactMode??n.compactMode,padding:F(t.padding,n.padding),verticalSeparation:F(t.verticalSeparation,n.verticalSeparation),horizontalSeparation:F(t.horizontalSeparation,n.horizontalSeparation),arcRadius:F(t.arcRadius,n.arcRadius),fontSize:F(t.fontSize,n.fontSize),fontFamily:I(t.fontFamily,n.fontFamily),terminalFill:m(t.terminalFill,n.terminalFill),terminalStroke:m(t.terminalStroke,n.terminalStroke),terminalTextColor:m(t.terminalTextColor,n.terminalTextColor),nonTerminalFill:m(t.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:m(t.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:m(t.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:m(t.lineColor,n.lineColor),strokeWidth:F(t.strokeWidth,n.strokeWidth),markerFill:m(t.markerFill,n.markerFill),commentFill:m(t.commentFill,n.commentFill),commentStroke:m(t.commentStroke,n.commentStroke),commentTextColor:m(t.commentTextColor,n.commentTextColor),specialFill:m(t.specialFill,n.specialFill),specialStroke:m(t.specialStroke,n.specialStroke),ruleNameColor:m(t.ruleNameColor,n.ruleNameColor),showMarkers:t.showMarkers??n.showMarkers,markerRadius:F(t.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),Te=p(e=>{const{fontFamily:i,fontSize:a,terminalFill:n,terminalStroke:t,terminalTextColor:r,nonTerminalFill:o,nonTerminalStroke:g,nonTerminalTextColor:l,lineColor:s,strokeWidth:h,markerFill:u,commentFill:c,commentStroke:w,commentTextColor:d,specialFill:T,specialStroke:z,ruleNameColor:S}=E(e);return` .railroad-diagram { font-family: ${i}; diff --git a/amplifier_web/static/assets/chunk-TICWLB2K--YXzYqRv.js b/amplifier_web/static/assets/chunk-TICWLB2K-CXDwtwC7.js similarity index 99% rename from amplifier_web/static/assets/chunk-TICWLB2K--YXzYqRv.js rename to amplifier_web/static/assets/chunk-TICWLB2K-CXDwtwC7.js index d18486cfd..5a735c4a7 100644 --- a/amplifier_web/static/assets/chunk-TICWLB2K--YXzYqRv.js +++ b/amplifier_web/static/assets/chunk-TICWLB2K-CXDwtwC7.js @@ -1,4 +1,4 @@ -import{g as st}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{g as it}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as at}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as g,l as we,c as F,u as rt,v as nt,x as Ve,j as fe,b as ut,a as lt,s as ct,g as ot,n as ht,o as dt,k as I,p as pt,q as At,i as ft,O as z}from"./mermaid.core-BQ5lTCZr.js";import{f as gt}from"./chunk-F27PBJKO-35QGDevQ.js";import{p as mt}from"./app-zsnl1T1T.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: +import{g as st}from"./chunk-5VM5RSS4-DuWyxJ-G.js";import{g as it}from"./chunk-XXDRQBXY-CEoTwp0p.js";import{s as at}from"./chunk-POPQ4Y6H-OaNnn-K8.js";import{_ as g,l as we,c as F,u as rt,v as nt,x as Ve,j as fe,b as ut,a as lt,s as ct,g as ot,n as ht,o as dt,k as I,p as pt,q as At,i as ft,O as z}from"./mermaid.core-YRnlneqM.js";import{f as gt}from"./chunk-F27PBJKO-2GmsQB4U.js";import{p as mt}from"./app-DmCHnbVO.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: `+D.showPosition()+` Expecting `+Ae.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Oe="Parse error on line "+(de+1)+": Unexpected "+(_==We?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Oe,{text:D.match,token:this.terminals_[_]||_,line:D.yylineno,loc:ve,expected:Ae})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+_);switch(L[0]){case 1:p.push(_),C.push(D.yytext),e.push(D.yylloc),p.push(L[1]),_=null,Ke=D.yyleng,t=D.yytext,de=D.yylineno,ve=D.yylloc;break;case 2:if(v=this.productions_[L[1]][1],U.$=C[C.length-v],U._$={first_line:e[e.length-(v||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(v||1)].first_column,last_column:e[e.length-1].last_column},et&&(U._$.range=[e[e.length-(v||1)].range[0],e[e.length-1].range[1]]),Ie=this.performAction.apply(U,[t,Ke,de,V.yy,L[1],C,e].concat($e)),typeof Ie<"u")return Ie;v&&(p=p.slice(0,-1*v*2),C=C.slice(0,-1*v),e=e.slice(0,-1*v)),p.push(this.productions_[L[1]][0]),C.push(U.$),e.push(U._$),je=ee[p[p.length-2]][p[p.length-1]],p.push(je);break;case 3:return!0}}return!0},"parse")},Je=(function(){var O={EOF:1,parseError:g(function(d,p){if(this.yy.parser)this.yy.parser.parseError(d,p);else throw new Error(d)},"parseError"),setInput:g(function(o,d){return this.yy=d||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var d=o.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:g(function(o){var d=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===l.length?this.yylloc.first_column:0)+l[l.length-p.length].length-p[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(o){this.unput(this.match.slice(o))},"less"),pastInput:g(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var o=this.pastInput(),d=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/chunk-XXDRQBXY-DdE0HtLo.js b/amplifier_web/static/assets/chunk-XXDRQBXY-CEoTwp0p.js similarity index 72% rename from amplifier_web/static/assets/chunk-XXDRQBXY-DdE0HtLo.js rename to amplifier_web/static/assets/chunk-XXDRQBXY-CEoTwp0p.js index 94a29fd52..c9902a1b8 100644 --- a/amplifier_web/static/assets/chunk-XXDRQBXY-DdE0HtLo.js +++ b/amplifier_web/static/assets/chunk-XXDRQBXY-CEoTwp0p.js @@ -1 +1 @@ -import{_ as a,j as o}from"./mermaid.core-BQ5lTCZr.js";var g=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{g}; +import{_ as a,j as o}from"./mermaid.core-YRnlneqM.js";var g=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{g}; diff --git a/amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js b/amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js deleted file mode 100644 index 2ea1526bf..000000000 --- a/amplifier_web/static/assets/classDiagram-ZZMXUADV-D0wKCQxK.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K--YXzYqRv.js";import{_ as i}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-5VM5RSS4-XkKVGNmc.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/classDiagram-ZZMXUADV-DGoLhpgF.js b/amplifier_web/static/assets/classDiagram-ZZMXUADV-DGoLhpgF.js new file mode 100644 index 000000000..be6fb127c --- /dev/null +++ b/amplifier_web/static/assets/classDiagram-ZZMXUADV-DGoLhpgF.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-CXDwtwC7.js";import{_ as i}from"./mermaid.core-YRnlneqM.js";import"./chunk-5VM5RSS4-DuWyxJ-G.js";import"./chunk-XXDRQBXY-CEoTwp0p.js";import"./chunk-POPQ4Y6H-OaNnn-K8.js";import"./chunk-F27PBJKO-2GmsQB4U.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js b/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js deleted file mode 100644 index 2ea1526bf..000000000 --- a/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K--YXzYqRv.js";import{_ as i}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-5VM5RSS4-XkKVGNmc.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-DGoLhpgF.js b/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-DGoLhpgF.js new file mode 100644 index 000000000..be6fb127c --- /dev/null +++ b/amplifier_web/static/assets/classDiagram-v2-VYDZK3BY-DGoLhpgF.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-CXDwtwC7.js";import{_ as i}from"./mermaid.core-YRnlneqM.js";import"./chunk-5VM5RSS4-DuWyxJ-G.js";import"./chunk-XXDRQBXY-CEoTwp0p.js";import"./chunk-POPQ4Y6H-OaNnn-K8.js";import"./chunk-F27PBJKO-2GmsQB4U.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/amplifier_web/static/assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js b/amplifier_web/static/assets/cose-bilkent-JH36ORCC-g-PZ3PJZ.js similarity index 99% rename from amplifier_web/static/assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js rename to amplifier_web/static/assets/cose-bilkent-JH36ORCC-g-PZ3PJZ.js index 40eb1fca2..0babe2976 100644 --- a/amplifier_web/static/assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js +++ b/amplifier_web/static/assets/cose-bilkent-JH36ORCC-g-PZ3PJZ.js @@ -1 +1 @@ -import{_ as V,l as k,j as lt}from"./mermaid.core-BQ5lTCZr.js";import{c as tt}from"./cytoscape.esm-Ix0LnXOy.js";import{g as gt}from"./client-BPXDbY79.js";import"./app-zsnl1T1T.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,q;function ft(){return q||(q=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var j=(c+F*W)%360,ht=(j+W)%360;y.branchRadialLayout(K,s,j,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render}; +import{_ as V,l as k,j as lt}from"./mermaid.core-YRnlneqM.js";import{c as tt}from"./cytoscape.esm-Ix0LnXOy.js";import{g as gt}from"./client-BPXDbY79.js";import"./app-DmCHnbVO.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,q;function ft(){return q||(q=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var j=(c+F*W)%360,ht=(j+W)%360;y.branchRadialLayout(K,s,j,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render}; diff --git a/amplifier_web/static/assets/cynefin-OW5HDTMX-C5aohCXI.js b/amplifier_web/static/assets/cynefin-OW5HDTMX-r2gVnQsI.js similarity index 99% rename from amplifier_web/static/assets/cynefin-OW5HDTMX-C5aohCXI.js rename to amplifier_web/static/assets/cynefin-OW5HDTMX-r2gVnQsI.js index 14290e853..b761047bf 100644 --- a/amplifier_web/static/assets/cynefin-OW5HDTMX-C5aohCXI.js +++ b/amplifier_web/static/assets/cynefin-OW5HDTMX-r2gVnQsI.js @@ -1,4 +1,4 @@ -var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./app-zsnl1T1T.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` +var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./app-DmCHnbVO.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` `,`\r `,"\r"],(function(a){function i(c,f,d,p){return new iv(c,f,d,p)}s(i,"create"),a.create=i;function o(c){let f=c;return!!(C.defined(f)&&C.string(f.uri)&&(C.undefined(f.languageId)||C.string(f.languageId))&&C.uinteger(f.lineCount)&&C.func(f.getText)&&C.func(f.positionAt)&&C.func(f.offsetAt))}s(o,"is"),a.is=o;function u(c,f){let d=c.getText(),p=l(f,(y,v)=>{let E=y.range.start.line-v.range.start.line;return E===0?y.range.start.character-v.range.start.character:E}),h=d.length;for(let y=p.length-1;y>=0;y--){let v=p[y],E=c.offsetAt(v.range.start),T=c.offsetAt(v.range.end);if(T<=h)d=d.substring(0,E)+v.newText+d.substring(T,d.length);else throw new Error("Overlapping edit");h=E}return d}s(u,"applyEdits"),a.applyEdits=u;function l(c,f){if(c.length<=1)return c;const d=c.length/2|0,p=c.slice(0,d),h=c.slice(d);l(p,f),l(h,f);let y=0,v=0,E=0;for(;y({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(V,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,R=o.boundaryAmplitude,_=i+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(i,f),Z=it(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,I=u.cx-C/2;M.attr("transform",`translate(${I}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),I=C*.15,G=-x/C,ht=$/C,et=M+G*I,nt=P+ht*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Vt();return` +import{p as xt}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{s as gt,g as $t,o as bt,n as wt,a as Ct,b as vt,_ as s,l as O,D as Dt,d as kt,p as At,A as U,y as Q,B as Tt,E as ot}from"./mermaid.core-YRnlneqM.js";import{p as Bt}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(V,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,R=o.boundaryAmplitude,_=i+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(i,f),Z=it(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,I=u.cx-C/2;M.attr("transform",`translate(${I}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),I=C*.15,G=-x/C,ht=$/C,et=M+G*I,nt=P+ht*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Vt();return` .cynefinDomain { stroke: none; } diff --git a/amplifier_web/static/assets/dagre-GXQ25YYZ-DqSq41IB.js b/amplifier_web/static/assets/dagre-GXQ25YYZ-BZfaRacC.js similarity index 98% rename from amplifier_web/static/assets/dagre-GXQ25YYZ-DqSq41IB.js rename to amplifier_web/static/assets/dagre-GXQ25YYZ-BZfaRacC.js index 0e77a1442..d080c619a 100644 --- a/amplifier_web/static/assets/dagre-GXQ25YYZ-DqSq41IB.js +++ b/amplifier_web/static/assets/dagre-GXQ25YYZ-BZfaRacC.js @@ -1,4 +1,4 @@ -import{_ as m,an as D,c as A,P as Y,l as p,ao as _,ap as z,aq as b,ar as H,as as J,at as T,au as R,av as F,aw as q,ax as C,ag as P,ae as W,ay as j,az as U}from"./mermaid.core-BQ5lTCZr.js";import{l as K}from"./layout-xx7K6ykp.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Q=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(E=>s.push(E));return}c.sort((E,x)=>E.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(E=>s.push(E));return}const w={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,w.width??0),n=ee(a,f,y,e,w),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:w.width,height:w.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),G=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=H(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=Q(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX +import{_ as m,an as D,c as A,P as Y,l as p,ao as _,ap as z,aq as b,ar as H,as as J,at as T,au as R,av as F,aw as q,ax as C,ag as P,ae as W,ay as j,az as U}from"./mermaid.core-YRnlneqM.js";import{l as K}from"./layout-B_w7f5cg.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Q=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(E=>s.push(E));return}c.sort((E,x)=>E.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(E=>s.push(E));return}const w={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,w.width??0),n=ee(a,f,y,e,w),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:w.width,height:w.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),G=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=H(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=Q(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX Node.id = `,f,` data=`,u.height,` Parent cluster`,s.height),e.setNode(s.id,u),e.parent(f)||(p.trace("Setting parent",f,s.id),e.setParent(f,s.id,u))}if(p.info("(Insert) Node XXX"+f+": "+JSON.stringify(e.node(f))),n!=null&&n.clusterNode){p.info("Cluster identified XBX",f,n.width,e.node(f));const{ranksep:u,nodesep:E}=e.graph();n.graph.setGraph({...n.graph.graph(),ranksep:u+25,nodesep:E});const x=await ne({element:l,graph:n.graph,diagramType:d,id:g,parentCluster:e.node(f),siteConfig:h}),S=x.elem;J(n,S),n.diff=x.diff||0,p.info("New compound node after recursive render XAX",f,"width",n.width,"height",n.height),T(S,n)}else e.children(f).length>0?(p.trace("Cluster - the non recursive path XBX",f,n.id,n,n.width,"Graph:",e),p.trace(R(n.id,e)),b.set(n.id,{id:R(n.id,e),node:n})):(p.trace("Node - the non recursive path XAX",f,l,e.node(f),L),await F(l,e.node(f),{config:h,dir:L}))})),await m(async()=>{const f=e.edges().map(async function(n){var E,x,S,X;const u=e.edge(n.v,n.w,n.name);if(p.info("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),p.info("Edge "+n.v+" -> "+n.w+": ",n," ",JSON.stringify(e.edge(n))),p.info("Fix",b,"ids:",n.v,n.w,"Translating: ",b.get(n.v),b.get(n.w)),a&&u.selfLoop){if(u.selfLoop.order!==1)return;const N={...u.originalEdge,...u,id:u.selfLoop.id,startLabelLeft:((E=u.originalEdge)==null?void 0:E.startLabelLeft)??u.startLabelLeft,startLabelRight:((x=u.originalEdge)==null?void 0:x.startLabelRight)??u.startLabelRight,endLabelLeft:((S=u.originalEdge)==null?void 0:S.endLabelLeft)??u.endLabelLeft,endLabelRight:((X=u.originalEdge)==null?void 0:X.endLabelRight)??u.endLabelRight};await C(o,N),u.width=N.width,u.height=N.height,u.labelStyle=N.labelStyle;return}await C(o,u)});await Promise.all(f)},"processEdges")();const{subGraphTitleTotalMargin:y}=q(h);return{elem:r,graph:e,groups:{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r},diagramType:d,id:g,mergeSelfLoops:a,subGraphTitleTotalMargin:y}},"measureDagreGraph"),k=m(t=>{p.info("############################################# XXX"),p.info("### Layout ### XXX"),p.info("############################################# XXX"),K(t)},"runDagreGraphLayout"),te=m((t,e,d)=>{const g=t.node(e);if(!g)return;const s={...g};return g!=null&&g.clusterNode?s.y=(g.y??0)+d:t.children(e).length>0?s.height=(g.height??0)+d:s.y=(g.y??0)+d/2,s},"normalizeDagreNode"),I=m((t,e)=>{V.forEach(d=>{e[d]!==void 0&&(t[d]=e[d])})},"applyDagreNodeLayout"),re=m((t,e,d,g)=>({...t,start:t.start??e,end:t.end??d,points:(t.points??[]).map(s=>({...s,y:typeof s.y=="number"?s.y+g:s.y}))}),"normalizeDagreEdge"),ae=m((t,e)=>{const{graph:d,mergeSelfLoops:g,subGraphTitleTotalMargin:s=0}=e,h=new Map(t.nodes.map(c=>[c.id,c]));D(d).forEach(c=>{const i=te(d,c,s);if(!i)return;I(d.node(c),i);const o=h.get(c);o&&I(o,i)});const L=s/2;return t.edges=M(d,L,{mergeSelfLoops:g}).map(({edge:c,start:i,end:o})=>re(c,i,o,L)),t},"applyDagreLayoutResult"),oe=m(async({elem:t,graph:e,groups:{clusters:d,edgePaths:g},diagramType:s,id:h,mergeSelfLoops:L,subGraphTitleTotalMargin:c})=>{let i=0;await Promise.all(D(e).map(async function(r){var w;const a=e.node(r);if(p.info("Position XBX => "+r+": ("+a.x,","+a.y,") width: ",a.width," height: ",a.height),a!=null&&a.clusterNode)a.y+=c,p.info("A tainted cluster node XBX1",r,a.id,a.width,a.height,a.x,a.y,e.parent(r)),b.get(a.id).node=a,P(a);else if(e.children(r).length>0){p.info("A pure cluster node XBX1",r,a.id,a.x,a.y,a.width,a.height,e.parent(r)),a.height+=c,e.node(a.parentId);const y=(a==null?void 0:a.padding)/2||0,f=((w=a==null?void 0:a.labelBBox)==null?void 0:w.height)||0,n=f-y||0;p.debug("OffsetY",n,"labelHeight",f,"halfPadding",y),await W(d,a),b.get(a.id).node=a}else{const y=e.node(a.parentId);a.y+=c/2,p.info("A regular node XBX1 - using the padding",a.id,"parent",a.parentId,a.width,a.height,a.x,a.y,"offsetY",a.offsetY,"parent",y,y==null?void 0:y.offsetY,a),P(a)}}));const o=c/2;return M(e,o,{mergeSelfLoops:L}).forEach(function({edge:r,start:a,end:w}){p.info("Edge "+a+" -> "+w+": "+JSON.stringify(r),r),r.points.forEach(u=>u.y+=o);const y=e.node(a),f=e.node(w),n=j(g,r,b,s,y,f,h);U(r,n)}),e.nodes().forEach(function(r){const a=e.node(r);p.info(r,a.type,a.diff),a.isGroup&&(i=a.diff)}),p.warn("Returning from recursive render XAX",t,i),{elem:t,diff:i}},"paintDagreLayoutCore"),ne=m(async t=>{const e=await G(t);return k(e.graph),await oe(e)},"renderDagreSubgraph"),O=m(t=>{var d,g,s,h,L,c;const e=new Y({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:((d=t.config)==null?void 0:d.nodeSpacing)||t.nodeSpacing||((s=(g=t.config)==null?void 0:g.flowchart)==null?void 0:s.nodeSpacing),ranksep:((h=t.config)==null?void 0:h.rankSpacing)||t.rankSpacing||((c=(L=t.config)==null?void 0:L.flowchart)==null?void 0:c.rankSpacing),marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return t.nodes.forEach(i=>{e.setNode(i.id,{...i}),i.parentId&&e.setParent(i.id,i.parentId)}),p.debug("Edges:",t.edges),t.edges.forEach(i=>{if(i.start===i.end){const o=i.start,l=o+"---"+o+"---1",r=o+"---"+o+"---2",a=e.node(o);e.setNode(l,{domId:l,id:l,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(l,a.parentId),e.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(r,a.parentId);const w=structuredClone(i),y=structuredClone(i),f=structuredClone(i),n=structuredClone(i);y.originalEdge=w,y.selfLoop={id:w.id,order:0},f.originalEdge=w,f.selfLoop={id:w.id,order:1},n.originalEdge=w,n.selfLoop={id:w.id,order:2},y.label="",y.arrowTypeEnd="none",y.endLabelLeft="",y.endLabelRight="",y.startLabelLeft="",y.id=o+"-cyclic-special-1",f.startLabelRight="",f.startLabelLeft="",f.endLabelLeft="",f.endLabelRight="",f.arrowTypeStart="none",f.arrowTypeEnd="none",f.id=o+"-cyclic-special-mid",n.label="",n.startLabelRight="",n.startLabelLeft="",n.arrowTypeStart="none",a.isGroup&&(y.fromCluster=o,n.toCluster=o),n.id=o+"-cyclic-special-2",n.arrowTypeStart="none",e.setEdge(o,l,y,o+"-cyclic-special-0"),e.setEdge(l,r,f,o+"-cyclic-special-1"),e.setEdge(r,o,n,o+"-cyclic-special-2")}else e.setEdge(i.start,i.end,{...i},i.id)}),_(e),{graph:e}},"prepareLayoutForDagre"),se=m(async(t,{element:e,preparedLayout:d})=>{const g=d??O(t),s=A(),h=await G({element:e,graph:g.graph,diagramType:t.type,id:t.diagramId,parentCluster:void 0,siteConfig:s});return g.measuredLayout=h,h},"measureDagreLayout"),ie=m((t,e)=>{var g;const d=(g=e.preparedLayout)==null?void 0:g.measuredLayout;if(!d)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return k(d.graph),ae(t,d),d},"runDagreLayoutCore"),de=m((t,{measure:e})=>D(e.graph).map(d=>e.graph.node(d)).filter(Boolean),"getDagrePaintNodes"),le=m((t,e,{measure:d})=>t?d.graph.node(t):void 0,"getDagreEdgeNode"),ue=z({prepareLayout:O,measureLayout:se,runLayoutCore:ie,paintOptions:{clusterDb:b,getNodes:de,getEdgeNode:le,skipNode:m((t,{measure:e})=>!e.graph.hasNode(t.id),"skipNode"),isCluster:m((t,{measure:e})=>e.graph.hasNode(t.id)&&(e.graph.children(t.id)??[]).length>0,"isCluster")}});export{ae as applyDagreLayoutResult,M as getEdgesToRender,se as measureDagreLayout,O as prepareLayoutForDagre,ue as render,ie as runDagreLayoutCore}; diff --git a/amplifier_web/static/assets/diagram-S7CK7UJ4-Bhn2u9og.js b/amplifier_web/static/assets/diagram-S7CK7UJ4-x7ODN_Fr.js similarity index 96% rename from amplifier_web/static/assets/diagram-S7CK7UJ4-Bhn2u9og.js rename to amplifier_web/static/assets/diagram-S7CK7UJ4-x7ODN_Fr.js index 3735bf02c..5b9044fa8 100644 --- a/amplifier_web/static/assets/diagram-S7CK7UJ4-Bhn2u9og.js +++ b/amplifier_web/static/assets/diagram-S7CK7UJ4-x7ODN_Fr.js @@ -1,4 +1,4 @@ -import{I as X}from"./chunk-2Q5K7J3B-DR5XPUmF.js";import{p as z}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{n as O,b as G,s as Y,o as P,g as F,a as Z,_ as g,A,l as E,D as j,d as q,y as D,p as U,i as J,aj as K,B as Q,ak as ee}from"./mermaid.core-BQ5lTCZr.js";import{p as te}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var L=/[─━│┃└┗├┣]/,_=/[└┗├┣]/,re=/[─━]/,T=/^[\s│┃]+$/,V=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,$=/^\s*%%/,ne=" ";function S(r){return r.some(t=>L.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` +import{I as X}from"./chunk-2Q5K7J3B-Ca-MXWFO.js";import{p as z}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{n as O,b as G,s as Y,o as P,g as F,a as Z,_ as g,A,l as E,D as j,d as q,y as D,p as U,i as J,aj as K,B as Q,ak as ee}from"./mermaid.core-YRnlneqM.js";import{p as te}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var L=/[─━│┃└┗├┣]/,_=/[└┗├┣]/,re=/[─━]/,T=/^[\s│┃]+$/,V=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,$=/^\s*%%/,ne=" ";function S(r){return r.some(t=>L.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` `),e=new Map;let i=-1;for(const[d,l]of t.entries())if(l.trim()==="treeView-beta"){i=d;break}if(i===-1)return{text:r,lineMap:e};const s=[];for(let d=i+1;d({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),U()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>A(ae,D().treeView),"getConfig"),le=g((r,t,e,i,s,o)=>{for(;r<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const n={id:x.records.cnt++,level:r,name:t,nodeType:e,icon:s,cssClass:i,description:o,children:[]};x.records.stack[x.records.stack.length-1].children.push(n),x.records.stack.push(n)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:F,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:O},I=de,he=g(r=>{z(r,I);for(const t of r.nodes){const e=typeof t.indent=="number"?t.indent:0;let i=t.name;const s=i.endsWith("/");s&&(i=i.slice(0,-1));const o=s?"directory":"file",n=t.classAnnotation||void 0,c=t.iconAnnotation,d=c!==void 0?c||"none":void 0,l=t.descAnnotation||void 0,u=l?J(l,D()):void 0;I.addNode(e,i,o,n,d,u)}},"populate"),pe={parse:g(async r=>{const{text:t,lineMap:e}=H(r);try{const i=await te("treeView",t);E.debug(i),he(i)}catch(i){throw e.size>0&&i instanceof Error&&(i.message=R(i.message,e)),i}},"parse")},C={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};function W(r,t){var s;const e=(s=t==null?void 0:t.filenameIcons)==null?void 0:s[r];if(e)return e;const i=r.lastIndexOf(".");if(i>0){const o=r.substring(i).toLowerCase(),n=t==null?void 0:t.extensionIcons;return(n==null?void 0:n[o])??(n==null?void 0:n[o.slice(1)])}}g(W,"detectIcon");function y(r,t){return r.includes(":")?r:r in C.icons||!t?`${C.prefix}:${r}`:`${t}:${r}`}g(y,"qualifyIcon");function k(r,t){if(r.icon!=="none"){if(r.icon)return y(r.icon,t.defaultIconPack);if(t.showIcons){if(r.nodeType==="file"){const e=W(r.name,t);if(e==="none")return;if(e)return y(e,t.defaultIconPack)}return`${C.prefix}:${r.nodeType==="directory"?"folder":"file"}`}}}g(k,"getNodeIcon");ee([{name:C.prefix,icons:C}]);var B=14,ge=4,fe=16,ue=g(async(r,t)=>{const e=[],i=g(o=>{const n=k(o,t);n&&e.push({icon:n,node:o}),o.children.forEach(i)},"collect");i(r);const s=await Promise.all(e.map(async({icon:o,node:n})=>({id:n.id,svg:await K(o,{height:B,width:B})})));return new Map(s.map(({id:o,svg:n})=>[o,n]))},"resolveNodeIcons"),we=g((r,t,e,i,s,o)=>{var b;const n=i.append("g");let c="treeView-node-label";e.nodeType==="directory"&&(c+=" treeView-node-dir"),e.cssClass&&(c+=` ${e.cssClass}`);const d=B+ge,l=k(e,s),u=l!==void 0;l&&n.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${r+s.paddingX}, ${t+s.paddingY})`).html(o.get(e.id)??"");const a=n.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",c),{height:p,width:h}=a.node().getBBox(),m=p+s.paddingY*2,w=r+s.paddingX+(u?d:0);a.attr("x",w),a.attr("y",t+m/2);const f=w+h,v=h+s.paddingX*2+(u?d:0);return e.BBox={x:r,y:t,width:v,height:m},(b=e.cssClass)!=null&&b.split(/\s+/).includes("highlight")&&n.insert("rect",":first-child").attr("x",r).attr("y",t+1).attr("width",0).attr("height",m-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:n,labelRightEdge:f,centerY:t+m/2}},"positionLabel"),N=g((r,t,e,i,s,o)=>r.append("line").attr("x1",t).attr("y1",e).attr("x2",i).attr("y2",s).attr("stroke-width",o).attr("class","treeView-node-line"),"positionLine"),me=g((r,t,e,i)=>{var u;let s=0,o=0;const n=[],c=g((a,p,h,m)=>{const w=m*(h.rowIndent+h.paddingX),f=we(w,s,p,a,h,i);n.push(f);const{height:v,width:b}=p.BBox;N(a,w-h.rowIndent,s+v/2,w,s+v/2,h.lineThickness),o=Math.max(o,w+b),s+=v},"drawNode"),d=g((a,p=0)=>{c(r,a,e,p),a.children.forEach(f=>{d(f,p+1)});const{x:h,y:m,height:w}=a.BBox;if(a.children.length){const{y:f,height:v}=a.children[a.children.length-1].BBox;N(r,h+e.paddingX,m+w,h+e.paddingX,f+v/2+e.lineThickness/2,e.lineThickness)}},"processNode");d(t);const l=n.filter(a=>a.node.description);if(l.length>0){const p=Math.max(...n.map(h=>h.labelRightEdge))+fe;for(const h of l){const w=h.nodeGroup.append("text").text(h.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",h.centerY).node().getBBox();o=Math.max(o,p+w.width+e.paddingX)}}for(const a of n)if((u=a.node.cssClass)!=null&&u.split(/\s+/).includes("highlight")){const p=a.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const h=o-a.node.BBox.x+8;p.attr("width",h),o=Math.max(o,a.node.BBox.x+h+2)}}return{totalHeight:s,totalWidth:o}},"drawTree"),ve=g(async(r,t,e,i)=>{E.debug(`Rendering treeView diagram `+r);const s=i.db,o=s.getRoot(),n=s.getConfig(),c=j(t),d=c.append("g");d.attr("class","tree-view");const l=await ue(o,n),{totalHeight:u,totalWidth:a}=me(d,o,n,l);c.attr("viewBox",`-${n.lineThickness/2} 0 ${a} ${u}`),q(c,u,a,n.useMaxWidth)},"draw"),xe={draw:ve},be=xe,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ie=g(({treeView:r})=>{const{labelFontSize:t,labelColor:e,lineColor:i,iconColor:s,descriptionColor:o,highlightBg:n,highlightStroke:c}=A(Ce,r);return` diff --git a/amplifier_web/static/assets/diagram-UQ7AKVKN-CsDpBRwj.js b/amplifier_web/static/assets/diagram-UQ7AKVKN-De0fNkzZ.js similarity index 95% rename from amplifier_web/static/assets/diagram-UQ7AKVKN-CsDpBRwj.js rename to amplifier_web/static/assets/diagram-UQ7AKVKN-De0fNkzZ.js index 878c01487..2fdc25548 100644 --- a/amplifier_web/static/assets/diagram-UQ7AKVKN-CsDpBRwj.js +++ b/amplifier_web/static/assets/diagram-UQ7AKVKN-De0fNkzZ.js @@ -1,4 +1,4 @@ -import{p as I}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{s as _,g as E,o as D,n as F,a as P,b as z,_ as c,D as G,p as B,A as w,y as C,B as W,l as b,E as V,d as H}from"./mermaid.core-BQ5lTCZr.js";import{p as j}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),U=W.radar,X=c(()=>w({...U,...C().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:z,getAccTitle:P,setDiagramTitle:F,getDiagramTitle:D,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),p=G(t),u=rt(p,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(u,n,v,o.ticks,o.graticule),nt(u,n,v,i),L(u,n,l,h,g,o.graticule,i),k(u,l,o.showLegend,i),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const u=2*p*Math.PI/n-Math.PI/2,g=o*Math.cos(u),h=o*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(u,l.curveTension)).attr("class",`radarCurve-${p}`):n==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rw({...U,...C().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:z,getAccTitle:P,setDiagramTitle:F,getDiagramTitle:D,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),p=G(t),u=rt(p,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(u,n,v,o.ticks,o.graticule),nt(u,n,v,i),L(u,n,l,h,g,o.graticule,i),k(u,l,o.showLegend,i),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const u=2*p*Math.PI/n-Math.PI/2,g=o*Math.cos(u),h=o*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(u,l.curveTension)).attr("class",`radarCurve-${p}`):n==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rhe({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let l;q(i)?(g.debug("source frame",i.sourceFrames),l=n.frames.filter(d=>i.sourceFrames.some(c=>c.$refText===d.name)),l.forEach(d=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:d})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const l={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,l)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,l),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ +import{p as oe}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{o as se,n as le,s as de,g as ce,a as me,b as ue,_ as o,l as g,c as T,j as xe,z as fe,p as ge,A as he,y as E,B as pe,i as P,w as S,al as be}from"./mermaid.core-YRnlneqM.js";import{p as ve,i as we}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var D="position frame",N="frame positioned",M="position relation",C="relation positioned",ye=o(function(e){g.debug("options str",e)},"setOptions"),Pe=o(function(){return{}},"getOptions"),Se=o(function(){O(),ge()},"clear");function O(){A={}}o(O,"reset");var ke=pe.eventmodeling,Me=o(()=>he({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let l;q(i)?(g.debug("source frame",i.sourceFrames),l=n.frames.filter(d=>i.sourceFrames.some(c=>c.$refText===d.name)),l.forEach(d=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:d})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const l={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,l)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,l),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,l),r=r.replaceAll(" "," "),r+="
")}const m=r!==void 0;m&&(c+=`

${r}`);const x={fontSize:l.fontSize,fontWeight:l.fontWeight,fontFamily:l.fontFamily},u=be(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(X,"calculateTextProps");function j(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:N,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(j,"decidePositionFrame");function G(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(G,"calculateX");function Y(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(Y,"calculateMaxRight");function $(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o($,"sortedSwimlanesArray");function z(e,n){const t=n,i=V(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,l=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,d={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=G(a,l,r),m=c+d.width+s.boxPadding,x=Y(Object.values(e.swimlanes),m);a.r=c+d.width,a.maxHeight=Math.max(a.maxHeight,d.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:d,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=$(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p0}o(q,"hasSourceFrame");function B(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(B,"findBoxByFrame");function J(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(J,"findBoxByLineIndex");function Q(e,n){const t=n;if(we(t.frame)||K(t.index,t.frame))return[];const i=B(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=B(e.boxes,t.sourceFrame):a=J(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:C,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(Q,"decidePositionRelation");function Z(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Z,"evolveRelationPositioned");var Fe={[D]:j,[M]:Q},Ee={[N]:z,[C]:Z};function ee(e,n){const t=Fe[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(ee,"decide");function te(e,n){const t=n.reduce((i,a)=>{const r=Ee[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(te,"evolve");function w(e,n){const t=ee(e,n);return te(e,t)}o(w,"dispatch");var F={getConfig:Me,setOptions:ye,getOptions:Pe,clear:Se,setAccTitle:ue,getAccTitle:me,getAccDescription:ce,setAccDescription:de,setDiagramTitle:le,getDiagramTitle:se,setAst:I,getDiagramProps:R,getState:W},Ae={parse:o(async e=>{const n=await ve("eventmodeling",e);g.debug(n),F.setAst(n),oe(n,F)},"parse")},k=T(),Re=k==null?void 0:k.eventmodeling;function ne(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(ne,"renderD3Box");function ie(e,n){return e>n}o(ie,"dirUpwards");function ae(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,l=a.targetBox.swimlane.y+n.swimlanePadding,d=ie(r,l),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${d} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),d?(x=r,u=l+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=l);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ae,"renderD3Relation");function re(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),l=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",d=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",l).attr("stroke",d),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(re,"renderD3Swimlane");var $e=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+` `,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:l}=T(),d=xe(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(re(d,m.maxR,c,r)),m.boxes.forEach(ne(d,c)),m.relations.forEach(ae(d,c,x,r)),d.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),fe(void 0,d,(l==null?void 0:l.padding)??30,l==null?void 0:l.useMaxWidth)},"draw"),Te={draw:$e},De=o(e=>"","getStyles"),Ne=De,Ue={parser:Ae,db:F,renderer:Te,styles:Ne};export{Ue as diagram}; diff --git a/amplifier_web/static/assets/diagram-VX7I27RA-DYKyI2lv.js b/amplifier_web/static/assets/diagram-VX7I27RA-B3oZVKXq.js similarity index 98% rename from amplifier_web/static/assets/diagram-VX7I27RA-DYKyI2lv.js rename to amplifier_web/static/assets/diagram-VX7I27RA-B3oZVKXq.js index 9bc947d61..63c8a453d 100644 --- a/amplifier_web/static/assets/diagram-VX7I27RA-DYKyI2lv.js +++ b/amplifier_web/static/assets/diagram-VX7I27RA-B3oZVKXq.js @@ -1,4 +1,4 @@ -import{p as ge}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as w,E as ye,y as ae,A as ee,D as Se,d as ve,l as te,bc as B,j as U,b as xe,a as be,n as we,o as Ce,g as Te,s as Le,B as $e,bd as Ae,p as Fe}from"./mermaid.core-BQ5lTCZr.js";import{s as Ne}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{p as Me}from"./cynefin-OW5HDTMX-C5aohCXI.js";import{b as O}from"./defaultLocale-DX6XiGOO.js";import{o as Q}from"./ordinal-Cboi1Yqb.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function je(t){return t.children}function Ye(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=u*u*W,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function p(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,u=i.x1-x,y=i.y1-x;u{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const p=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let u;try{const e=s.valueFormat||",";if(e==="$0,0")u=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";u=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);u=w(f=>"$"+O(o||"")(f),"valueFormat")}else u=O(e)}catch(e){te.error("Error creating format function:",e),u=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?u(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,pe=A?16:38,j=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);Y.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${pe}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(j,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(j,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${j}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?u(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(j,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` +import{p as ge}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{_ as w,E as ye,y as ae,A as ee,D as Se,d as ve,l as te,bc as B,j as U,b as xe,a as be,n as we,o as Ce,g as Te,s as Le,B as $e,bd as Ae,p as Fe}from"./mermaid.core-YRnlneqM.js";import{s as Ne}from"./chunk-POPQ4Y6H-OaNnn-K8.js";import{p as Me}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import{b as O}from"./defaultLocale-DX6XiGOO.js";import{o as Q}from"./ordinal-Cboi1Yqb.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function je(t){return t.children}function Ye(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=u*u*W,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function p(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,u=i.x1-x,y=i.y1-x;u{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const p=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let u;try{const e=s.valueFormat||",";if(e==="$0,0")u=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";u=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);u=w(f=>"$"+O(o||"")(f),"valueFormat")}else u=O(e)}catch(e){te.error("Error creating format function:",e),u=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?u(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,pe=A?16:38,j=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);Y.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${pe}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(j,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(j,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${j}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?u(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(j,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` .treemapNode.section { stroke: ${r.sectionStrokeColor}; stroke-width: ${r.sectionStrokeWidth}; diff --git a/amplifier_web/static/assets/diagram-Z3DM3KII-C7wRZKVi.js b/amplifier_web/static/assets/diagram-Z3DM3KII-WNIFVi0Q.js similarity index 94% rename from amplifier_web/static/assets/diagram-Z3DM3KII-C7wRZKVi.js rename to amplifier_web/static/assets/diagram-Z3DM3KII-WNIFVi0Q.js index 759549afd..d4c400184 100644 --- a/amplifier_web/static/assets/diagram-Z3DM3KII-C7wRZKVi.js +++ b/amplifier_web/static/assets/diagram-Z3DM3KII-WNIFVi0Q.js @@ -1,4 +1,4 @@ -import{p as $}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as b,A as m,D as C,d as S,l as w,b as D,a as T,n as P,o as z,g as A,s as E,y as F,B as W,p as _}from"./mermaid.core-BQ5lTCZr.js";import{p as N}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var L=W.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=P,this.getDiagramTitle=z,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=m({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,Y=b((e,t)=>{$(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,B]of p.entries())j(f,B,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=m(H,e);return` +import{p as $}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{_ as b,A as m,D as C,d as S,l as w,b as D,a as T,n as P,o as z,g as A,s as E,y as F,B as W,p as _}from"./mermaid.core-YRnlneqM.js";import{p as N}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var L=W.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=P,this.getDiagramTitle=z,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=m({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,Y=b((e,t)=>{$(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,B]of p.entries())j(f,B,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=m(H,e);return` .packetByte { font-size: ${t.byteFontSize}; } diff --git a/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-CsupTakH.js b/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-DyIJUwiI.js similarity index 87% rename from amplifier_web/static/assets/ebnfDiagram-PWID7BFC-CsupTakH.js rename to amplifier_web/static/assets/ebnfDiagram-PWID7BFC-DyIJUwiI.js index 31f96d2ee..a1ea54c24 100644 --- a/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-CsupTakH.js +++ b/amplifier_web/static/assets/ebnfDiagram-PWID7BFC-DyIJUwiI.js @@ -1 +1 @@ -import{g as l,r as m,d as n}from"./chunk-SVP7TREG-DegBQCYH.js";import{p}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as t,l as o}from"./mermaid.core-BQ5lTCZr.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; +import{g as l,r as m,d as n}from"./chunk-SVP7TREG-Wjd95MYc.js";import{p}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{_ as t,l as o}from"./mermaid.core-YRnlneqM.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; diff --git a/amplifier_web/static/assets/erDiagram-RLTQ6QDP-DV4h776D.js b/amplifier_web/static/assets/erDiagram-RLTQ6QDP-sS227ewn.js similarity index 99% rename from amplifier_web/static/assets/erDiagram-RLTQ6QDP-DV4h776D.js rename to amplifier_web/static/assets/erDiagram-RLTQ6QDP-sS227ewn.js index 6fcca5dc0..461ff47fb 100644 --- a/amplifier_web/static/assets/erDiagram-RLTQ6QDP-DV4h776D.js +++ b/amplifier_web/static/assets/erDiagram-RLTQ6QDP-sS227ewn.js @@ -1,4 +1,4 @@ -import{g as Ut}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as Kt}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,n as Ht,o as Qt,c as tt,l as F,k as Xt,p as Jt,q as $t,r as te,t as ee,u as se,v as ie,j as re,x as ne}from"./mermaid.core-BQ5lTCZr.js";import{c as ae}from"./channel-CSv1n6Zd.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: +import{g as Ut}from"./chunk-XXDRQBXY-CEoTwp0p.js";import{s as Kt}from"./chunk-POPQ4Y6H-OaNnn-K8.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,n as Ht,o as Qt,c as tt,l as F,k as Xt,p as Jt,q as $t,r as te,t as ee,u as se,v as ie,j as re,x as ne}from"./mermaid.core-YRnlneqM.js";import{c as ae}from"./channel-BcBgmgAp.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: `+m.showPosition()+` Expecting `+ut.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Tt="Parse error on line "+(lt+1)+": Unexpected "+(E==Lt?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Tt,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:Et,expected:ut})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(O[0]){case 1:d.push(E),_.push(m.yytext),t.push(m.yylloc),d.push(O[1]),E=null,Dt=m.yyleng,e=m.yytext,lt=m.yylineno,Et=m.yylloc;break;case 2:if(A=this.productions_[O[1]][1],U.$=_[_.length-A],U._$={first_line:t[t.length-(A||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(A||1)].first_column,last_column:t[t.length-1].last_column},Pt&&(U._$.range=[t[t.length-(A||1)].range[0],t[t.length-1].range[1]]),St=this.performAction.apply(U,[e,Dt,lt,Y.yy,O[1],_,t].concat(Yt)),typeof St<"u")return St;A&&(d=d.slice(0,-1*A*2),_=_.slice(0,-1*A),t=t.slice(0,-1*A)),d.push(this.productions_[O[1]][0]),_.push(U.$),t.push(U._$),Vt=$[d[d.length-2]][d[d.length-1]],d.push(Vt);break;case 3:return!0}}return!0},"parse")},Gt=(function(){var G={EOF:1,parseError:f(function(h,d){if(this.yy.parser)this.yy.parser.parseError(h,d);else throw new Error(h)},"parseError"),setInput:f(function(a,h){return this.yy=h||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var h=a.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:f(function(a){var h=a.length,d=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===i.length?this.yylloc.first_column:0)+i[i.length-d.length].length-d[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(a){this.unput(this.match.slice(a))},"less"),pastInput:f(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var a=this.pastInput(),h=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/flowDiagram-HODETNUW-Bfis7KwQ.js b/amplifier_web/static/assets/flowDiagram-HODETNUW-BRjqrD7u.js similarity index 99% rename from amplifier_web/static/assets/flowDiagram-HODETNUW-Bfis7KwQ.js rename to amplifier_web/static/assets/flowDiagram-HODETNUW-BRjqrD7u.js index e5833b168..170e0f44d 100644 --- a/amplifier_web/static/assets/flowDiagram-HODETNUW-Bfis7KwQ.js +++ b/amplifier_web/static/assets/flowDiagram-HODETNUW-BRjqrD7u.js @@ -1,4 +1,4 @@ -import{g as Xt}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{g as Qt}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as Jt}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as k,b3 as Zt,F as Mt,l as $,c as ke,u as $t,v as e1,x as rt,b as t1,s as s1,n as i1,a as r1,g as a1,o as n1,k as u1,H as o1,J as l1,c9 as c1,q as st,j as it,p as h1,b6 as d1,r as p1}from"./mermaid.core-BQ5lTCZr.js";import{f as f1}from"./chunk-F27PBJKO-35QGDevQ.js";import{p as g1}from"./app-zsnl1T1T.js";import{c as b1}from"./channel-CSv1n6Zd.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` +import{g as Xt}from"./chunk-5VM5RSS4-DuWyxJ-G.js";import{g as Qt}from"./chunk-XXDRQBXY-CEoTwp0p.js";import{s as Jt}from"./chunk-POPQ4Y6H-OaNnn-K8.js";import{_ as k,b3 as Zt,F as Mt,l as $,c as ke,u as $t,v as e1,x as rt,b as t1,s as s1,n as i1,a as r1,g as a1,o as n1,k as u1,H as o1,J as l1,c9 as c1,q as st,j as it,p as h1,b6 as d1,r as p1}from"./mermaid.core-YRnlneqM.js";import{f as f1}from"./chunk-F27PBJKO-2GmsQB4U.js";import{p as g1}from"./app-DmCHnbVO.js";import{c as b1}from"./channel-BcBgmgAp.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` `)?d=m+` `:d=`{ `+m+` diff --git a/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js b/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-Dr_9OMcR.js similarity index 99% rename from amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js rename to amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-Dr_9OMcR.js index 531df1385..d9e412415 100644 --- a/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js +++ b/amplifier_web/static/assets/ganttDiagram-EL5Y4UJY-Dr_9OMcR.js @@ -1,4 +1,4 @@ -import{be as on,bf as On,bg as cn,bh as un,bi as ln,bj as ue,bk as Hn,g as Nn,s as Pn,o as Vn,n as Rn,a as zn,b as qn,_ as d,c as Yt,j as Zt,d as Bn,bl as it,l as Tt,k as Zn,G as Xn,p as Gn,x as jn}from"./mermaid.core-BQ5lTCZr.js";import{g as oe}from"./client-BPXDbY79.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-BcEdwvr4.js";import{i as er}from"./init-Gi6I4Gst.js";import"./app-zsnl1T1T.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: +import{be as on,bf as On,bg as cn,bh as un,bi as ln,bj as ue,bk as Hn,g as Nn,s as Pn,o as Vn,n as Rn,a as zn,b as qn,_ as d,c as Yt,j as Zt,d as Bn,bl as it,l as Tt,k as Zn,G as Xn,p as Gn,x as jn}from"./mermaid.core-YRnlneqM.js";import{g as oe}from"./client-BPXDbY79.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-61bSIS_K.js";import{i as er}from"./init-Gi6I4Gst.js";import"./app-DmCHnbVO.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: `+H.showPosition()+` Expecting `+Bt.join(", ")+", got '"+(this.terminals_[A]||A)+"'":ce="Parse error on line "+(K+1)+": Unexpected "+(A==O?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(ce,{text:H.match,token:this.terminals_[A]||A,line:H.yylineno,loc:N,expected:Bt})}if(Z[0]instanceof Array&&Z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+A);switch(Z[0]){case 1:b.push(A),I.push(H.yytext),o.push(H.yylloc),b.push(Z[1]),A=null,l=H.yyleng,u=H.yytext,K=H.yylineno,N=H.yylloc;break;case 2:if(ut=this.productions_[Z[1]][1],at.$=I[I.length-ut],at._$={first_line:o[o.length-(ut||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(ut||1)].first_column,last_column:o[o.length-1].last_column},V&&(at._$.range=[o[o.length-(ut||1)].range[0],o[o.length-1].range[1]]),st=this.performAction.apply(at,[u,l,K,J.yy,Z[1],I,o].concat(j)),typeof st<"u")return st;ut&&(b=b.slice(0,-1*ut*2),I=I.slice(0,-1*ut),o=o.slice(0,-1*ut)),b.push(this.productions_[Z[1]][0]),I.push(at.$),o.push(at._$),He=W[b[b.length-2]][b[b.length-1]],b.push(He);break;case 3:return!0}}return!0},"parse")},C=(function(){var D={EOF:1,parseError:d(function(g,b){if(this.yy.parser)this.yy.parser.parseError(g,b);else throw new Error(g)},"parseError"),setInput:d(function(c,g){return this.yy=g||this.yy||{},this._input=c,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var g=c.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},"input"),unput:d(function(c){var g=c.length,b=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),b.length-1&&(this.yylineno-=b.length-1);var I=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:b?(b.length===m.length?this.yylloc.first_column:0)+m[m.length-b.length].length-b[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[I[0],I[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(c){this.unput(this.match.slice(c))},"less"),pastInput:d(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var c=this.pastInput(),g=new Array(c.length+1).join("-");return c+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js b/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-CKFZpt0Z.js similarity index 99% rename from amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js rename to amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-CKFZpt0Z.js index 93103df06..54fa189dc 100644 --- a/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js +++ b/amplifier_web/static/assets/gitGraphDiagram-WWUBYQGX-CKFZpt0Z.js @@ -1,4 +1,4 @@ -import{I as he}from"./chunk-2Q5K7J3B-DR5XPUmF.js";import{p as $e}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{o as fe,n as ge,s as ue,g as ye,a as xe,b as me,_ as $,y as Q,l as k,j as pe,c as z,x as be,z as we,p as ke,k as L,A as ve,B as Ce,C as Ee}from"./mermaid.core-BQ5lTCZr.js";import{p as Be}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=Ce.gitGraph,D=$(()=>ve({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),ke()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),B=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{B.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=B.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=B.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=B.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` +import{I as he}from"./chunk-2Q5K7J3B-Ca-MXWFO.js";import{p as $e}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{o as fe,n as ge,s as ue,g as ye,a as xe,b as me,_ as $,y as Q,l as k,j as pe,c as z,x as be,z as we,p as ke,k as L,A as ve,B as Ce,C as Ee}from"./mermaid.core-YRnlneqM.js";import{p as Be}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=Ce.gitGraph,D=$(()=>ve({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),ke()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),B=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{B.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=B.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=B.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=B.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` ${o-n/2-M/2},${u+I} ${o-n/2-M/2},${u-I} ${t.posWithOffset-n/2-M},${u-x-I} diff --git a/amplifier_web/static/assets/infoDiagram-27XIBGKW-D1rVSJoO.js b/amplifier_web/static/assets/infoDiagram-27XIBGKW-CR9oYlVY.js similarity index 68% rename from amplifier_web/static/assets/infoDiagram-27XIBGKW-D1rVSJoO.js rename to amplifier_web/static/assets/infoDiagram-27XIBGKW-CR9oYlVY.js index 8f11a928c..a496378a4 100644 --- a/amplifier_web/static/assets/infoDiagram-27XIBGKW-D1rVSJoO.js +++ b/amplifier_web/static/assets/infoDiagram-27XIBGKW-CR9oYlVY.js @@ -1,2 +1,2 @@ -import{_ as e,l as s,D as n,d as i}from"./mermaid.core-BQ5lTCZr.js";import{p}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var g={parse:e(async r=>{const a=await p("info",r);s.debug(a)},"parse")},d={version:"11.17.2"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,o)=>{s.debug(`rendering info diagram +import{_ as e,l as s,D as n,d as i}from"./mermaid.core-YRnlneqM.js";import{p}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var g={parse:e(async r=>{const a=await p("info",r);s.debug(a)},"parse")},d={version:"11.17.2"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,o)=>{s.debug(`rendering info diagram `+r);const t=n(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),l={draw:c},w={parser:g,db:m,renderer:l};export{w as diagram}; diff --git a/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-B42RhGud.js b/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-BQdVBYth.js similarity index 99% rename from amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-B42RhGud.js rename to amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-BQdVBYth.js index 2efb07d5a..db562f6c2 100644 --- a/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-B42RhGud.js +++ b/amplifier_web/static/assets/ishikawaDiagram-5VMMS53U-BQdVBYth.js @@ -1,4 +1,4 @@ -import{_ as o,c as ot,L as ut,D as dt,am as yt,p as ft,k as pt,n as it,a as gt,b as kt,g as mt,s as wt,o as _t,d as bt}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(j,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,q,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`: +import{_ as o,c as ot,L as ut,D as dt,am as yt,p as ft,k as pt,n as it,a as gt,b as kt,g as mt,s as wt,o as _t,d as bt}from"./mermaid.core-YRnlneqM.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(j,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,q,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`: `+b.showPosition()+` Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),q=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof q<"u")return q;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-CkgASPQL.js b/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-B118or3e.js similarity index 98% rename from amplifier_web/static/assets/journeyDiagram-3NMN7TZE-CkgASPQL.js rename to amplifier_web/static/assets/journeyDiagram-3NMN7TZE-B118or3e.js index ed92d0bba..e8873a490 100644 --- a/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-CkgASPQL.js +++ b/amplifier_web/static/assets/journeyDiagram-3NMN7TZE-B118or3e.js @@ -1,4 +1,4 @@ -import{g as gt}from"./chunk-5VM5RSS4-XkKVGNmc.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-F27PBJKO-35QGDevQ.js";import{g as _t,s as vt,a as bt,b as wt,o as Tt,n as St,_ as s,c as R,j as X,d as $t,p as Mt}from"./mermaid.core-BQ5lTCZr.js";import{d as it}from"./arc-CxD3pp7w.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: +import{g as gt}from"./chunk-5VM5RSS4-DuWyxJ-G.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-F27PBJKO-2GmsQB4U.js";import{g as _t,s as vt,a as bt,b as wt,o as Tt,n as St,_ as s,c as R,j as X,d as $t,p as Mt}from"./mermaid.core-YRnlneqM.js";import{d as it}from"./arc-D2jKxjLS.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: `+_.showPosition()+` Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/kanban-definition-UXKFOSKX-C_T9GYcq.js b/amplifier_web/static/assets/kanban-definition-UXKFOSKX-B4aZ932z.js similarity index 99% rename from amplifier_web/static/assets/kanban-definition-UXKFOSKX-C_T9GYcq.js rename to amplifier_web/static/assets/kanban-definition-UXKFOSKX-B4aZ932z.js index f21e51a92..87522a2e8 100644 --- a/amplifier_web/static/assets/kanban-definition-UXKFOSKX-C_T9GYcq.js +++ b/amplifier_web/static/assets/kanban-definition-UXKFOSKX-B4aZ932z.js @@ -1,4 +1,4 @@ -import{_ as c,l as te,c as W,D as fe,ae as ye,af as be,ag as me,X as _e,B as Y,i as G,H as ke,J as Ee,U as Se,V as le,W as ce}from"./mermaid.core-BQ5lTCZr.js";import{g as Ne}from"./chunk-5VM5RSS4-XkKVGNmc.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],U=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],H=[1,35],M=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:U}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:H,11:M}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:U}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:H,11:M}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`: +import{_ as c,l as te,c as W,D as fe,ae as ye,af as be,ag as me,X as _e,B as Y,i as G,H as ke,J as Ee,U as Se,V as le,W as ce}from"./mermaid.core-YRnlneqM.js";import{g as Ne}from"./chunk-5VM5RSS4-DuWyxJ-G.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],U=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],H=[1,35],M=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:U}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:H,11:M}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:U}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:H,11:M}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`: `+m.showPosition()+` Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/layout-xx7K6ykp.js b/amplifier_web/static/assets/layout-B_w7f5cg.js similarity index 99% rename from amplifier_web/static/assets/layout-xx7K6ykp.js rename to amplifier_web/static/assets/layout-B_w7f5cg.js index 09fa1bfb3..76e92d143 100644 --- a/amplifier_web/static/assets/layout-xx7K6ykp.js +++ b/amplifier_web/static/assets/layout-B_w7f5cg.js @@ -1 +1 @@ -import{bm as B,bn as y,bo as ye,bp as V,bq as U,br as Ue,bs as oe,bt as We,bu as In,bv as qe,bw as _n,bx as kn,by as jn,bz as ue,bA as An,bB as Mn,bC as xe,bD as Oe,bE as fe,bF as de,bG as G,bH as Xe,bI as He,bJ as Rn,bK as T,bL as Sn,bM as $n,bN as Fn,bO as Ee,bP as Bn,bQ as Ke,bR as N,bS as Gn,bT as Dn,bU as Yn,bV as S,bW as ze,bX as Je,bY as Vn,bZ as se,b_ as Ze,b$ as Un,c0 as Qe,c1 as Wn,c2 as qn,P as x,c3 as c,c4 as Xn,c5 as m,c6 as M,c7 as P,c8 as W}from"./mermaid.core-BQ5lTCZr.js";var Hn=/\s/;function Kn(e){for(var n=e.length;n--&&Hn.test(e.charAt(n)););return n}var zn=/^\s+/;function Jn(e){return e&&e.slice(0,Kn(e)+1).replace(zn,"")}var Te=NaN,Zn=/^[-+]0x[0-9a-f]+$/i,Qn=/^0b[01]+$/i,er=/^0o[0-7]+$/i,nr=parseInt;function rr(e){if(typeof e=="number")return e;if(B(e))return Te;if(y(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=y(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Jn(e);var r=Qn.test(e);return r||er.test(e)?nr(e.slice(2),r?2:8):Zn.test(e)?Te:+e}var Pe=1/0,tr=17976931348623157e292;function $(e){if(!e)return e===0?e:0;if(e=rr(e),e===Pe||e===-Pe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ir(e){var n=$(e),r=n%1;return n===n?r?n-r:n:0}var Le=Object.create,ar=(function(){function e(){}return function(n){if(!y(n))return{};if(Le)return Le(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function or(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&k(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),n=Object(n);++t2?n[2]:void 0;for(i&&k(n[0],n[1],i)&&(t=1);++r-1?i[o?n[a]:a]:void 0}}var Mt=Math.max;function Rt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var i=r==null?0:ir(r);return i<0&&(i=Mt(t+i,0)),Dn(e,N(n),i)}var le=At(Rt);function ln(e,n){var r=-1,t=U(e)?Array(e.length):[];return Yn(e,function(i,o,a){t[++r]=n(i,o,a)}),t}function g(e,n){var r=T(e)?S:ln;return r(e,N(n))}function St(e,n){return e==null?e:Ke(e,ze(n),H)}function $t(e,n){return e&&Je(e,ze(n))}function Ft(e,n){return e>n}var Bt=Object.prototype,Gt=Bt.hasOwnProperty;function Dt(e,n){return e!=null&&Gt.call(e,n)}function hn(e,n){return e!=null&&Vn(e,n,Dt)}function vn(e,n){return en||o&&a&&f&&!u&&!d||t&&a&&f||!r&&f||!i)return 1;if(!t&&!o&&!d&&e=u)return f;var d=r[t];return f*(d=="desc"?-1:1)}}return e.index-n.index}function Xt(e,n,r){n.length?n=S(n,function(o){return T(o)?function(a){return Qe(a,o.length===1?o[0]:o)}:o}):n=[se];var t=-1;n=S(n,de(N));var i=ln(e,function(o,a,u){var f=S(n,function(d){return d(o)});return{criteria:f,index:++t,value:o}});return Ut(i,function(o,a){return qt(o,a,r)})}function Ht(e,n){return Vt(e,n,function(r,t){return Wn(e,t)})}var Y=pr(function(e,n){return e==null?{}:Ht(e,n)}),Kt=Math.ceil,zt=Math.max;function Jt(e,n,r,t){for(var i=-1,o=zt(Kt((n-e)/(r||1)),0),a=Array(o);o--;)a[++i]=e,e+=r;return a}function Zt(e){return function(n,r,t){return t&&typeof t!="number"&&k(n,r,t)&&(r=t=void 0),n=$(n),r===void 0?(r=n,n=0):r=$(r),t=t===void 0?n1&&k(e,n[0],n[1])?n=[]:r>2&&k(n[0],n[1],n[2])&&(n=[n[0]]),Xt(e,qe(n),[])}),Qt=0;function pe(e){var n=++Qt;return qn(e)+n}function ei(e,n,r){for(var t=-1,i=e.length,o=n.length,a={};++t0;--u)if(a=n[u].dequeue(),a){t=t.concat(J(e,n,r,a,!0));break}}}return t}function J(e,n,r,t,i){var o=i?[]:void 0;return c(e.inEdges(t.v),function(a){var u=e.edge(a),f=e.node(a.v);i&&o.push({v:a.v,w:a.w}),f.out-=u,ae(n,r,f)}),c(e.outEdges(t.v),function(a){var u=e.edge(a),f=a.w,d=e.node(f);d.in-=u,ae(n,r,d)}),e.removeNode(t.v),o}function ui(e,n){var r=new x,t=0,i=0;c(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(e.edges(),function(u){var f=r.edge(u.v,u.w)||0,d=n(u),s=f+d;r.setEdge(u.v,u.w,s),i=Math.max(i,r.node(u.v).out+=d),t=Math.max(t,r.node(u.w).in+=d)});var o=L(i+t+3).map(function(){return new ri}),a=t+1;return c(r.nodes(),function(u){ae(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function ae(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function fi(e){var n=e.graph().acyclicer==="greedy"?ai(e,r(e)):di(e);c(n,function(t){var i=e.edge(t);e.removeEdge(t),i.forwardName=t.name,i.reversed=!0,e.setEdge(t.w,t.v,i,pe("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function di(e){var n=[],r={},t={};function i(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(e.outEdges(o),function(a){Object.prototype.hasOwnProperty.call(r,a.w)?n.push(a):i(a.w)}),delete r[o])}return c(e.nodes(),i),n}function si(e){c(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function I(e,n,r,t){var i;do i=pe(t);while(e.hasNode(i));return r.dummy=n,e.setNode(i,r),i}function ci(e){var n=new x().setGraph(e.graph());return c(e.nodes(),function(r){n.setNode(r,e.node(r))}),c(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),n}function pn(e){var n=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return c(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),c(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Re(e,n){var r=e.x,t=e.y,i=n.x-r,o=n.y-t,a=e.width/2,u=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var f,d;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),f=u*i/o,d=u):(i<0&&(a=-a),f=a,d=a*o/i),{x:r+f,y:t+d}}function z(e){var n=g(L(bn(e)+1),function(){return[]});return c(e.nodes(),function(r){var t=e.node(r),i=t.rank;m(i)||(n[i][t.order]=r)}),n}function li(e){var n=j(g(e.nodes(),function(r){return e.node(r).rank}));c(e.nodes(),function(r){var t=e.node(r);hn(t,"rank")&&(t.rank-=n)})}function hi(e){var n=j(g(e.nodes(),function(o){return e.node(o).rank})),r=[];c(e.nodes(),function(o){var a=e.node(o).rank-n;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=e.graph().nodeRankFactor;c(r,function(o,a){m(o)&&a%i!==0?--t:t&&c(o,function(u){e.node(u).rank+=t})})}function Se(e,n,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),I(e,"border",i,n)}function bn(e){return O(g(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function vi(e,n){var r={lhs:[],rhs:[]};return c(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function pi(e,n){return n()}function bi(e){function n(r){var t=e.children(r),i=e.node(r);if(t.length&&c(t,n),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;oa.lim&&(u=a,f=!0);var d=M(n.edges(),function(s){return f===Be(e,e.node(s.v),u)&&f!==Be(e,e.node(s.w),u)});return ve(d,function(s){return A(n,s)})}function Pn(e,n,r,t){var i=r.v,o=r.w;e.removeEdge(i,o),e.setEdge(t.v,t.w,{}),ge(e),we(e,n),ki(e,n)}function ki(e,n){var r=le(e.nodes(),function(i){return!n.node(i).parent}),t=Ii(e,r);t=t.slice(1),c(t,function(i){var o=e.node(i).parent,a=n.edge(i,o),u=!1;a||(a=n.edge(o,i),u=!0),n.node(i).rank=n.node(o).rank+(u?a.minlen:-a.minlen)})}function ji(e,n,r){return e.hasEdge(n,r)}function Be(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Ai(e){switch(e.graph().ranker){case"network-simplex":Ge(e);break;case"tight-tree":Ri(e);break;case"longest-path":Mi(e);break;default:Ge(e)}}var Mi=be;function Ri(e){be(e),gn(e)}function Ge(e){E(e)}function Si(e){var n=I(e,"root",{},"_root"),r=$i(e),t=O(P(r))-1,i=2*t+1;e.graph().nestingRoot=n,c(e.edges(),function(a){e.edge(a).minlen*=i});var o=Fi(e)+1;c(e.children(),function(a){Ln(e,n,i,o,t,r,a)}),e.graph().nodeRankFactor=i}function Ln(e,n,r,t,i,o,a){var u=e.children(a);if(!u.length){a!==n&&e.setEdge(n,a,{weight:0,minlen:r});return}var f=Se(e,"_bt"),d=Se(e,"_bb"),s=e.node(a);e.setParent(f,a),s.borderTop=f,e.setParent(d,a),s.borderBottom=d,c(u,function(l){Ln(e,n,r,t,i,o,l);var h=e.node(l),p=h.borderTop?h.borderTop:l,v=h.borderBottom?h.borderBottom:l,w=h.borderTop?t:2*t,_=p!==v?1:i-o[a]+1;e.setEdge(f,p,{weight:w,minlen:_,nestingEdge:!0}),e.setEdge(v,d,{weight:w,minlen:_,nestingEdge:!0})}),e.parent(a)||e.setEdge(n,f,{weight:0,minlen:i+o[a]})}function $i(e){var n={};function r(t,i){var o=e.children(t);o&&o.length&&c(o,function(a){r(a,i+1)}),n[t]=i}return c(e.children(),function(t){r(t,1)}),n}function Fi(e){return W(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Bi(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,c(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Gi(e,n,r){var t={},i;c(r,function(o){for(var a=e.parent(o),u,f;a;){if(u=e.parent(a),u?(f=t[u],t[u]=a):(f=i,i=a),f&&f!==a){n.setEdge(f,a);return}a=u}})}function Di(e,n,r){var t=Yi(e),i=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return c(e.nodes(),function(o){var a=e.node(o),u=e.parent(o);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),c(e[r](o),function(f){var d=f.v===o?f.w:f.v,s=i.edge(d,o),l=m(s)?0:s.weight;i.setEdge(d,o,{weight:e.edge(f).weight+l})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),i}function Yi(e){for(var n;e.hasNode(n=pe("_root")););return n}function Vi(e,n){for(var r=0,t=1;t0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=d.weight;f+=d.weight*l})),f}function Wi(e){var n={},r=M(e.nodes(),function(u){return!e.children(u).length}),t=O(g(r,function(u){return e.node(u).rank})),i=g(L(t+1),function(){return[]});function o(u){if(!hn(n,u)){n[u]=!0;var f=e.node(u);i[f.rank].push(u),c(e.successors(u),o)}}var a=R(r,function(u){return e.node(u).rank});return c(a,o),i}function qi(e,n){return g(n,function(r){var t=e.inEdges(r);if(t.length){var i=W(t,function(o,a){var u=e.edge(a),f=e.node(a.v);return{sum:o.sum+u.weight*f.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Xi(e,n){var r={};c(e,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};m(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),c(n.edges(),function(i){var o=r[i.v],a=r[i.w];!m(o)&&!m(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=M(r,function(i){return!i.indegree});return Hi(t)}function Hi(e){var n=[];function r(o){return function(a){a.merged||(m(a.barycenter)||m(o.barycenter)||a.barycenter>=o.barycenter)&&Ki(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&e.push(a)}}for(;e.length;){var i=e.pop();n.push(i),c(i.in.reverse(),r(i)),c(i.out,t(i))}return g(M(n,function(o){return!o.merged}),function(o){return Y(o,["vs","i","barycenter","weight"])})}function Ki(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function zi(e,n){var r=vi(e,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,i=R(r.rhs,function(s){return-s.i}),o=[],a=0,u=0,f=0;t.sort(Ji(!!n)),f=De(o,i,f),c(t,function(s){f+=s.vs.length,o.push(s.vs),a+=s.barycenter*s.weight,u+=s.weight,f=De(o,i,f)});var d={vs:C(o)};return u&&(d.barycenter=a/u,d.weight=u),d}function De(e,n,r){for(var t;n.length&&(t=D(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ji(e){return function(n,r){return n.barycenterr.barycenter?1:e?r.i-n.i:n.i-r.i}}function Nn(e,n,r,t){var i=e.children(n),o=e.node(n),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};a&&(i=M(i,function(v){return v!==a&&v!==u}));var d=qi(e,i);c(d,function(v){if(e.children(v.v).length){var w=Nn(e,v.v,r,t);f[v.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&Qi(v,w)}});var s=Xi(d,r);Zi(s,f);var l=zi(s,t);if(a&&(l.vs=C([a,l.vs,u]),e.predecessors(a).length)){var h=e.node(e.predecessors(a)[0]),p=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+p.order)/(l.weight+2),l.weight+=2}return l}function Zi(e,n){c(e,function(r){r.vs=C(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Qi(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function ea(e){var n=bn(e),r=Ye(e,L(1,n+1),"inEdges"),t=Ye(e,L(n-1,-1,-1),"outEdges"),i=Wi(e);Ve(e,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,f=0;f<4;++u,++f){na(u%2?r:t,u%4>=2),i=z(e);var d=Vi(e,i);da||u>n[f].lim));for(d=f,f=t;(f=e.parent(f))!==d;)o.push(f);return{path:i.concat(o.reverse()),lca:d}}function ia(e){var n={},r=0;function t(i){var o=r;c(e.children(i),t),n[i]={low:o,lim:r++}}return c(e.children(),t),n}function aa(e,n){var r={};function t(i,o){var a=0,u=0,f=i.length,d=D(o);return c(o,function(s,l){var h=ua(e,s),p=h?e.node(h).order:f;(h||s===d)&&(c(o.slice(u,l+1),function(v){c(e.predecessors(v),function(w){var _=e.node(w),me=_.order;(med)&&Cn(r,h,s)})})}function i(o,a){var u=-1,f,d=0;return c(a,function(s,l){if(e.node(s).dummy==="border"){var h=e.predecessors(s);h.length&&(f=e.node(h[0]).order,t(a,d,l,u,f),d=l,u=f)}t(a,d,a.length,f,o.length)}),a}return W(n,i),r}function ua(e,n){if(e.node(n).dummy)return le(e.predecessors(n),function(r){return e.node(r).dummy})}function Cn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[n];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function fa(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function da(e,n,r,t){var i={},o={},a={};return c(n,function(u){c(u,function(f,d){i[f]=f,o[f]=f,a[f]=d})}),c(n,function(u){var f=-1;c(u,function(d){var s=t(d);if(s.length){s=R(s,function(w){return a[w]});for(var l=(s.length-1)/2,h=Math.floor(l),p=Math.ceil(l);h<=p;++h){var v=s[h];o[d]===d&&f{var t=r(" buildLayoutGraph",()=>_a(e));r(" runLayout",()=>ya(t,r)),r(" updateInputGraph",()=>xa(e,t))})}function ya(e,n){n(" makeSpaceForEdgeLabels",()=>ka(e)),n(" removeSelfEdges",()=>Ga(e)),n(" acyclic",()=>fi(e)),n(" nestingGraph.run",()=>Si(e)),n(" rank",()=>Ai(pn(e))),n(" injectEdgeLabelProxies",()=>ja(e)),n(" removeEmptyRanks",()=>hi(e)),n(" nestingGraph.cleanup",()=>Bi(e)),n(" normalizeRanks",()=>li(e)),n(" assignRankMinMax",()=>Aa(e)),n(" removeEdgeLabelProxies",()=>Ma(e)),n(" normalize.run",()=>xi(e)),n(" parentDummyChains",()=>ra(e)),n(" addBorderSegments",()=>bi(e)),n(" order",()=>ea(e)),n(" insertSelfEdges",()=>Da(e)),n(" adjustCoordinateSystem",()=>wi(e)),n(" position",()=>ga(e)),n(" positionSelfEdges",()=>Ya(e)),n(" removeBorderNodes",()=>Ba(e)),n(" normalize.undo",()=>Ei(e)),n(" fixupEdgeLabelCoords",()=>$a(e)),n(" undoCoordinateSystem",()=>gi(e)),n(" translateGraph",()=>Ra(e)),n(" assignNodeIntersects",()=>Sa(e)),n(" reversePoints",()=>Fa(e)),n(" acyclic.undo",()=>si(e))}function xa(e,n){c(e.nodes(),function(r){var t=e.node(r),i=n.node(r);t&&(t.x=i.x,t.y=i.y,n.children(r).length&&(t.width=i.width,t.height=i.height))}),c(e.edges(),function(r){var t=e.edge(r),i=n.edge(r);t.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(t.x=i.x,t.y=i.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Oa=["nodesep","edgesep","ranksep","marginx","marginy"],Ea={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ta=["acyclicer","ranker","rankdir","align"],Pa=["width","height"],La={width:0,height:0},Na=["minlen","weight","width","height","labeloffset"],Ca={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ia=["labelpos"];function _a(e){var n=new x({multigraph:!0,compound:!0}),r=ne(e.graph());return n.setGraph(ie({},Ea,ee(r,Oa),Y(r,Ta))),c(e.nodes(),function(t){var i=ne(e.node(t));n.setNode(t,_t(ee(i,Pa),La)),n.setParent(t,e.parent(t))}),c(e.edges(),function(t){var i=ne(e.edge(t));n.setEdge(t,ie({},Ca,ee(i,Na),Y(i,Ia)))}),n}function ka(e){var n=e.graph();n.ranksep/=2,c(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function ja(e){c(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),i=e.node(n.w),o={rank:(i.rank-t.rank)/2+t.rank,e:n};I(e,"edge-proxy",o,"_ep")}})}function Aa(e){var n=0;c(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=O(n,t.maxRank))}),e.graph().maxRank=n}function Ma(e){c(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Ra(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=e.graph(),a=o.marginx||0,u=o.marginy||0;function f(d){var s=d.x,l=d.y,h=d.width,p=d.height;n=Math.min(n,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-p/2),i=Math.max(i,l+p/2)}c(e.nodes(),function(d){f(e.node(d))}),c(e.edges(),function(d){var s=e.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&f(s)}),n-=a,t-=u,c(e.nodes(),function(d){var s=e.node(d);s.x-=n,s.y-=t}),c(e.edges(),function(d){var s=e.edge(d);c(s.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=n),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-n+a,o.height=i-t+u}function Sa(e){c(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),i=e.node(n.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(Re(t,o)),r.points.push(Re(i,a))})}function $a(e){c(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Fa(e){c(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Ba(e){c(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),i=e.node(r.borderBottom),o=e.node(D(r.borderLeft)),a=e.node(D(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Ga(e){c(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Da(e){var n=z(e);c(n,function(r){var t=0;c(r,function(i,o){var a=e.node(i);a.order=o+t,c(a.selfEdges,function(u){I(e,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function Ya(e){c(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function ee(e,n){return K(Y(e,n),Number)}function ne(e){var n={};return c(e,function(r,t){n[t.toLowerCase()]=r}),n}export{Ua as l}; +import{bm as B,bn as y,bo as ye,bp as V,bq as U,br as Ue,bs as oe,bt as We,bu as In,bv as qe,bw as _n,bx as kn,by as jn,bz as ue,bA as An,bB as Mn,bC as xe,bD as Oe,bE as fe,bF as de,bG as G,bH as Xe,bI as He,bJ as Rn,bK as T,bL as Sn,bM as $n,bN as Fn,bO as Ee,bP as Bn,bQ as Ke,bR as N,bS as Gn,bT as Dn,bU as Yn,bV as S,bW as ze,bX as Je,bY as Vn,bZ as se,b_ as Ze,b$ as Un,c0 as Qe,c1 as Wn,c2 as qn,P as x,c3 as c,c4 as Xn,c5 as m,c6 as M,c7 as P,c8 as W}from"./mermaid.core-YRnlneqM.js";var Hn=/\s/;function Kn(e){for(var n=e.length;n--&&Hn.test(e.charAt(n)););return n}var zn=/^\s+/;function Jn(e){return e&&e.slice(0,Kn(e)+1).replace(zn,"")}var Te=NaN,Zn=/^[-+]0x[0-9a-f]+$/i,Qn=/^0b[01]+$/i,er=/^0o[0-7]+$/i,nr=parseInt;function rr(e){if(typeof e=="number")return e;if(B(e))return Te;if(y(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=y(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Jn(e);var r=Qn.test(e);return r||er.test(e)?nr(e.slice(2),r?2:8):Zn.test(e)?Te:+e}var Pe=1/0,tr=17976931348623157e292;function $(e){if(!e)return e===0?e:0;if(e=rr(e),e===Pe||e===-Pe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ir(e){var n=$(e),r=n%1;return n===n?r?n-r:n:0}var Le=Object.create,ar=(function(){function e(){}return function(n){if(!y(n))return{};if(Le)return Le(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function or(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&k(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),n=Object(n);++t2?n[2]:void 0;for(i&&k(n[0],n[1],i)&&(t=1);++r-1?i[o?n[a]:a]:void 0}}var Mt=Math.max;function Rt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var i=r==null?0:ir(r);return i<0&&(i=Mt(t+i,0)),Dn(e,N(n),i)}var le=At(Rt);function ln(e,n){var r=-1,t=U(e)?Array(e.length):[];return Yn(e,function(i,o,a){t[++r]=n(i,o,a)}),t}function g(e,n){var r=T(e)?S:ln;return r(e,N(n))}function St(e,n){return e==null?e:Ke(e,ze(n),H)}function $t(e,n){return e&&Je(e,ze(n))}function Ft(e,n){return e>n}var Bt=Object.prototype,Gt=Bt.hasOwnProperty;function Dt(e,n){return e!=null&&Gt.call(e,n)}function hn(e,n){return e!=null&&Vn(e,n,Dt)}function vn(e,n){return en||o&&a&&f&&!u&&!d||t&&a&&f||!r&&f||!i)return 1;if(!t&&!o&&!d&&e=u)return f;var d=r[t];return f*(d=="desc"?-1:1)}}return e.index-n.index}function Xt(e,n,r){n.length?n=S(n,function(o){return T(o)?function(a){return Qe(a,o.length===1?o[0]:o)}:o}):n=[se];var t=-1;n=S(n,de(N));var i=ln(e,function(o,a,u){var f=S(n,function(d){return d(o)});return{criteria:f,index:++t,value:o}});return Ut(i,function(o,a){return qt(o,a,r)})}function Ht(e,n){return Vt(e,n,function(r,t){return Wn(e,t)})}var Y=pr(function(e,n){return e==null?{}:Ht(e,n)}),Kt=Math.ceil,zt=Math.max;function Jt(e,n,r,t){for(var i=-1,o=zt(Kt((n-e)/(r||1)),0),a=Array(o);o--;)a[++i]=e,e+=r;return a}function Zt(e){return function(n,r,t){return t&&typeof t!="number"&&k(n,r,t)&&(r=t=void 0),n=$(n),r===void 0?(r=n,n=0):r=$(r),t=t===void 0?n1&&k(e,n[0],n[1])?n=[]:r>2&&k(n[0],n[1],n[2])&&(n=[n[0]]),Xt(e,qe(n),[])}),Qt=0;function pe(e){var n=++Qt;return qn(e)+n}function ei(e,n,r){for(var t=-1,i=e.length,o=n.length,a={};++t0;--u)if(a=n[u].dequeue(),a){t=t.concat(J(e,n,r,a,!0));break}}}return t}function J(e,n,r,t,i){var o=i?[]:void 0;return c(e.inEdges(t.v),function(a){var u=e.edge(a),f=e.node(a.v);i&&o.push({v:a.v,w:a.w}),f.out-=u,ae(n,r,f)}),c(e.outEdges(t.v),function(a){var u=e.edge(a),f=a.w,d=e.node(f);d.in-=u,ae(n,r,d)}),e.removeNode(t.v),o}function ui(e,n){var r=new x,t=0,i=0;c(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(e.edges(),function(u){var f=r.edge(u.v,u.w)||0,d=n(u),s=f+d;r.setEdge(u.v,u.w,s),i=Math.max(i,r.node(u.v).out+=d),t=Math.max(t,r.node(u.w).in+=d)});var o=L(i+t+3).map(function(){return new ri}),a=t+1;return c(r.nodes(),function(u){ae(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function ae(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function fi(e){var n=e.graph().acyclicer==="greedy"?ai(e,r(e)):di(e);c(n,function(t){var i=e.edge(t);e.removeEdge(t),i.forwardName=t.name,i.reversed=!0,e.setEdge(t.w,t.v,i,pe("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function di(e){var n=[],r={},t={};function i(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(e.outEdges(o),function(a){Object.prototype.hasOwnProperty.call(r,a.w)?n.push(a):i(a.w)}),delete r[o])}return c(e.nodes(),i),n}function si(e){c(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function I(e,n,r,t){var i;do i=pe(t);while(e.hasNode(i));return r.dummy=n,e.setNode(i,r),i}function ci(e){var n=new x().setGraph(e.graph());return c(e.nodes(),function(r){n.setNode(r,e.node(r))}),c(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),n}function pn(e){var n=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return c(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),c(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Re(e,n){var r=e.x,t=e.y,i=n.x-r,o=n.y-t,a=e.width/2,u=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var f,d;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),f=u*i/o,d=u):(i<0&&(a=-a),f=a,d=a*o/i),{x:r+f,y:t+d}}function z(e){var n=g(L(bn(e)+1),function(){return[]});return c(e.nodes(),function(r){var t=e.node(r),i=t.rank;m(i)||(n[i][t.order]=r)}),n}function li(e){var n=j(g(e.nodes(),function(r){return e.node(r).rank}));c(e.nodes(),function(r){var t=e.node(r);hn(t,"rank")&&(t.rank-=n)})}function hi(e){var n=j(g(e.nodes(),function(o){return e.node(o).rank})),r=[];c(e.nodes(),function(o){var a=e.node(o).rank-n;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=e.graph().nodeRankFactor;c(r,function(o,a){m(o)&&a%i!==0?--t:t&&c(o,function(u){e.node(u).rank+=t})})}function Se(e,n,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),I(e,"border",i,n)}function bn(e){return O(g(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function vi(e,n){var r={lhs:[],rhs:[]};return c(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function pi(e,n){return n()}function bi(e){function n(r){var t=e.children(r),i=e.node(r);if(t.length&&c(t,n),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;oa.lim&&(u=a,f=!0);var d=M(n.edges(),function(s){return f===Be(e,e.node(s.v),u)&&f!==Be(e,e.node(s.w),u)});return ve(d,function(s){return A(n,s)})}function Pn(e,n,r,t){var i=r.v,o=r.w;e.removeEdge(i,o),e.setEdge(t.v,t.w,{}),ge(e),we(e,n),ki(e,n)}function ki(e,n){var r=le(e.nodes(),function(i){return!n.node(i).parent}),t=Ii(e,r);t=t.slice(1),c(t,function(i){var o=e.node(i).parent,a=n.edge(i,o),u=!1;a||(a=n.edge(o,i),u=!0),n.node(i).rank=n.node(o).rank+(u?a.minlen:-a.minlen)})}function ji(e,n,r){return e.hasEdge(n,r)}function Be(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Ai(e){switch(e.graph().ranker){case"network-simplex":Ge(e);break;case"tight-tree":Ri(e);break;case"longest-path":Mi(e);break;default:Ge(e)}}var Mi=be;function Ri(e){be(e),gn(e)}function Ge(e){E(e)}function Si(e){var n=I(e,"root",{},"_root"),r=$i(e),t=O(P(r))-1,i=2*t+1;e.graph().nestingRoot=n,c(e.edges(),function(a){e.edge(a).minlen*=i});var o=Fi(e)+1;c(e.children(),function(a){Ln(e,n,i,o,t,r,a)}),e.graph().nodeRankFactor=i}function Ln(e,n,r,t,i,o,a){var u=e.children(a);if(!u.length){a!==n&&e.setEdge(n,a,{weight:0,minlen:r});return}var f=Se(e,"_bt"),d=Se(e,"_bb"),s=e.node(a);e.setParent(f,a),s.borderTop=f,e.setParent(d,a),s.borderBottom=d,c(u,function(l){Ln(e,n,r,t,i,o,l);var h=e.node(l),p=h.borderTop?h.borderTop:l,v=h.borderBottom?h.borderBottom:l,w=h.borderTop?t:2*t,_=p!==v?1:i-o[a]+1;e.setEdge(f,p,{weight:w,minlen:_,nestingEdge:!0}),e.setEdge(v,d,{weight:w,minlen:_,nestingEdge:!0})}),e.parent(a)||e.setEdge(n,f,{weight:0,minlen:i+o[a]})}function $i(e){var n={};function r(t,i){var o=e.children(t);o&&o.length&&c(o,function(a){r(a,i+1)}),n[t]=i}return c(e.children(),function(t){r(t,1)}),n}function Fi(e){return W(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Bi(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,c(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Gi(e,n,r){var t={},i;c(r,function(o){for(var a=e.parent(o),u,f;a;){if(u=e.parent(a),u?(f=t[u],t[u]=a):(f=i,i=a),f&&f!==a){n.setEdge(f,a);return}a=u}})}function Di(e,n,r){var t=Yi(e),i=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return c(e.nodes(),function(o){var a=e.node(o),u=e.parent(o);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),c(e[r](o),function(f){var d=f.v===o?f.w:f.v,s=i.edge(d,o),l=m(s)?0:s.weight;i.setEdge(d,o,{weight:e.edge(f).weight+l})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),i}function Yi(e){for(var n;e.hasNode(n=pe("_root")););return n}function Vi(e,n){for(var r=0,t=1;t0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=d.weight;f+=d.weight*l})),f}function Wi(e){var n={},r=M(e.nodes(),function(u){return!e.children(u).length}),t=O(g(r,function(u){return e.node(u).rank})),i=g(L(t+1),function(){return[]});function o(u){if(!hn(n,u)){n[u]=!0;var f=e.node(u);i[f.rank].push(u),c(e.successors(u),o)}}var a=R(r,function(u){return e.node(u).rank});return c(a,o),i}function qi(e,n){return g(n,function(r){var t=e.inEdges(r);if(t.length){var i=W(t,function(o,a){var u=e.edge(a),f=e.node(a.v);return{sum:o.sum+u.weight*f.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Xi(e,n){var r={};c(e,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};m(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),c(n.edges(),function(i){var o=r[i.v],a=r[i.w];!m(o)&&!m(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=M(r,function(i){return!i.indegree});return Hi(t)}function Hi(e){var n=[];function r(o){return function(a){a.merged||(m(a.barycenter)||m(o.barycenter)||a.barycenter>=o.barycenter)&&Ki(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&e.push(a)}}for(;e.length;){var i=e.pop();n.push(i),c(i.in.reverse(),r(i)),c(i.out,t(i))}return g(M(n,function(o){return!o.merged}),function(o){return Y(o,["vs","i","barycenter","weight"])})}function Ki(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function zi(e,n){var r=vi(e,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,i=R(r.rhs,function(s){return-s.i}),o=[],a=0,u=0,f=0;t.sort(Ji(!!n)),f=De(o,i,f),c(t,function(s){f+=s.vs.length,o.push(s.vs),a+=s.barycenter*s.weight,u+=s.weight,f=De(o,i,f)});var d={vs:C(o)};return u&&(d.barycenter=a/u,d.weight=u),d}function De(e,n,r){for(var t;n.length&&(t=D(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ji(e){return function(n,r){return n.barycenterr.barycenter?1:e?r.i-n.i:n.i-r.i}}function Nn(e,n,r,t){var i=e.children(n),o=e.node(n),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};a&&(i=M(i,function(v){return v!==a&&v!==u}));var d=qi(e,i);c(d,function(v){if(e.children(v.v).length){var w=Nn(e,v.v,r,t);f[v.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&Qi(v,w)}});var s=Xi(d,r);Zi(s,f);var l=zi(s,t);if(a&&(l.vs=C([a,l.vs,u]),e.predecessors(a).length)){var h=e.node(e.predecessors(a)[0]),p=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+p.order)/(l.weight+2),l.weight+=2}return l}function Zi(e,n){c(e,function(r){r.vs=C(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Qi(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function ea(e){var n=bn(e),r=Ye(e,L(1,n+1),"inEdges"),t=Ye(e,L(n-1,-1,-1),"outEdges"),i=Wi(e);Ve(e,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,f=0;f<4;++u,++f){na(u%2?r:t,u%4>=2),i=z(e);var d=Vi(e,i);da||u>n[f].lim));for(d=f,f=t;(f=e.parent(f))!==d;)o.push(f);return{path:i.concat(o.reverse()),lca:d}}function ia(e){var n={},r=0;function t(i){var o=r;c(e.children(i),t),n[i]={low:o,lim:r++}}return c(e.children(),t),n}function aa(e,n){var r={};function t(i,o){var a=0,u=0,f=i.length,d=D(o);return c(o,function(s,l){var h=ua(e,s),p=h?e.node(h).order:f;(h||s===d)&&(c(o.slice(u,l+1),function(v){c(e.predecessors(v),function(w){var _=e.node(w),me=_.order;(med)&&Cn(r,h,s)})})}function i(o,a){var u=-1,f,d=0;return c(a,function(s,l){if(e.node(s).dummy==="border"){var h=e.predecessors(s);h.length&&(f=e.node(h[0]).order,t(a,d,l,u,f),d=l,u=f)}t(a,d,a.length,f,o.length)}),a}return W(n,i),r}function ua(e,n){if(e.node(n).dummy)return le(e.predecessors(n),function(r){return e.node(r).dummy})}function Cn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[n];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function fa(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function da(e,n,r,t){var i={},o={},a={};return c(n,function(u){c(u,function(f,d){i[f]=f,o[f]=f,a[f]=d})}),c(n,function(u){var f=-1;c(u,function(d){var s=t(d);if(s.length){s=R(s,function(w){return a[w]});for(var l=(s.length-1)/2,h=Math.floor(l),p=Math.ceil(l);h<=p;++h){var v=s[h];o[d]===d&&f{var t=r(" buildLayoutGraph",()=>_a(e));r(" runLayout",()=>ya(t,r)),r(" updateInputGraph",()=>xa(e,t))})}function ya(e,n){n(" makeSpaceForEdgeLabels",()=>ka(e)),n(" removeSelfEdges",()=>Ga(e)),n(" acyclic",()=>fi(e)),n(" nestingGraph.run",()=>Si(e)),n(" rank",()=>Ai(pn(e))),n(" injectEdgeLabelProxies",()=>ja(e)),n(" removeEmptyRanks",()=>hi(e)),n(" nestingGraph.cleanup",()=>Bi(e)),n(" normalizeRanks",()=>li(e)),n(" assignRankMinMax",()=>Aa(e)),n(" removeEdgeLabelProxies",()=>Ma(e)),n(" normalize.run",()=>xi(e)),n(" parentDummyChains",()=>ra(e)),n(" addBorderSegments",()=>bi(e)),n(" order",()=>ea(e)),n(" insertSelfEdges",()=>Da(e)),n(" adjustCoordinateSystem",()=>wi(e)),n(" position",()=>ga(e)),n(" positionSelfEdges",()=>Ya(e)),n(" removeBorderNodes",()=>Ba(e)),n(" normalize.undo",()=>Ei(e)),n(" fixupEdgeLabelCoords",()=>$a(e)),n(" undoCoordinateSystem",()=>gi(e)),n(" translateGraph",()=>Ra(e)),n(" assignNodeIntersects",()=>Sa(e)),n(" reversePoints",()=>Fa(e)),n(" acyclic.undo",()=>si(e))}function xa(e,n){c(e.nodes(),function(r){var t=e.node(r),i=n.node(r);t&&(t.x=i.x,t.y=i.y,n.children(r).length&&(t.width=i.width,t.height=i.height))}),c(e.edges(),function(r){var t=e.edge(r),i=n.edge(r);t.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(t.x=i.x,t.y=i.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Oa=["nodesep","edgesep","ranksep","marginx","marginy"],Ea={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ta=["acyclicer","ranker","rankdir","align"],Pa=["width","height"],La={width:0,height:0},Na=["minlen","weight","width","height","labeloffset"],Ca={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ia=["labelpos"];function _a(e){var n=new x({multigraph:!0,compound:!0}),r=ne(e.graph());return n.setGraph(ie({},Ea,ee(r,Oa),Y(r,Ta))),c(e.nodes(),function(t){var i=ne(e.node(t));n.setNode(t,_t(ee(i,Pa),La)),n.setParent(t,e.parent(t))}),c(e.edges(),function(t){var i=ne(e.edge(t));n.setEdge(t,ie({},Ca,ee(i,Na),Y(i,Ia)))}),n}function ka(e){var n=e.graph();n.ranksep/=2,c(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function ja(e){c(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),i=e.node(n.w),o={rank:(i.rank-t.rank)/2+t.rank,e:n};I(e,"edge-proxy",o,"_ep")}})}function Aa(e){var n=0;c(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=O(n,t.maxRank))}),e.graph().maxRank=n}function Ma(e){c(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Ra(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=e.graph(),a=o.marginx||0,u=o.marginy||0;function f(d){var s=d.x,l=d.y,h=d.width,p=d.height;n=Math.min(n,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-p/2),i=Math.max(i,l+p/2)}c(e.nodes(),function(d){f(e.node(d))}),c(e.edges(),function(d){var s=e.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&f(s)}),n-=a,t-=u,c(e.nodes(),function(d){var s=e.node(d);s.x-=n,s.y-=t}),c(e.edges(),function(d){var s=e.edge(d);c(s.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=n),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-n+a,o.height=i-t+u}function Sa(e){c(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),i=e.node(n.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(Re(t,o)),r.points.push(Re(i,a))})}function $a(e){c(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Fa(e){c(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Ba(e){c(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),i=e.node(r.borderBottom),o=e.node(D(r.borderLeft)),a=e.node(D(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Ga(e){c(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Da(e){var n=z(e);c(n,function(r){var t=0;c(r,function(i,o){var a=e.node(i);a.order=o+t,c(a.selfEdges,function(u){I(e,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function Ya(e){c(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function ee(e,n){return K(Y(e,n),Number)}function ne(e){var n={};return c(e,function(r,t){n[t.toLowerCase()]=r}),n}export{Ua as l}; diff --git a/amplifier_web/static/assets/linear-BcEdwvr4.js b/amplifier_web/static/assets/linear-61bSIS_K.js similarity index 98% rename from amplifier_web/static/assets/linear-BcEdwvr4.js rename to amplifier_web/static/assets/linear-61bSIS_K.js index 6fdf46e82..c3fb9e710 100644 --- a/amplifier_web/static/assets/linear-BcEdwvr4.js +++ b/amplifier_web/static/assets/linear-61bSIS_K.js @@ -1 +1 @@ -import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-BQ5lTCZr.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; +import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-YRnlneqM.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; diff --git a/amplifier_web/static/assets/mermaid.core-BQ5lTCZr.js b/amplifier_web/static/assets/mermaid.core-YRnlneqM.js similarity index 99% rename from amplifier_web/static/assets/mermaid.core-BQ5lTCZr.js rename to amplifier_web/static/assets/mermaid.core-YRnlneqM.js index d114714f8..5cb892c6a 100644 --- a/amplifier_web/static/assets/mermaid.core-BQ5lTCZr.js +++ b/amplifier_web/static/assets/mermaid.core-YRnlneqM.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-INFHLROL-CKc8uScH.js","assets/app-zsnl1T1T.js","assets/client-BPXDbY79.js","assets/app-Dnczv4y8.css","assets/dagre-GXQ25YYZ-DqSq41IB.js","assets/layout-xx7K6ykp.js","assets/swimlanes-42K2YHIH-1QzInuS-.js","assets/cose-bilkent-JH36ORCC-BYWhn9Rv.js","assets/cytoscape.esm-Ix0LnXOy.js","assets/c4Diagram-7LVT6UL2-DdetwEv8.js","assets/chunk-F27PBJKO-35QGDevQ.js","assets/flowDiagram-HODETNUW-Bfis7KwQ.js","assets/chunk-5VM5RSS4-XkKVGNmc.js","assets/chunk-XXDRQBXY-DdE0HtLo.js","assets/chunk-POPQ4Y6H-C_hQ_kWj.js","assets/channel-CSv1n6Zd.js","assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js","assets/erDiagram-RLTQ6QDP-DV4h776D.js","assets/gitGraphDiagram-WWUBYQGX-BkBjc4gg.js","assets/chunk-2Q5K7J3B-DR5XPUmF.js","assets/chunk-JWPE2WC7-wq4F1yC9.js","assets/cynefin-OW5HDTMX-C5aohCXI.js","assets/ganttDiagram-EL5Y4UJY-BU9eWm2s.js","assets/linear-BcEdwvr4.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-27XIBGKW-D1rVSJoO.js","assets/pieDiagram-E7YTZNPT-DYkXhOYb.js","assets/arc-CxD3pp7w.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js","assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js","assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js","assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js","assets/classDiagram-ZZMXUADV-D0wKCQxK.js","assets/chunk-TICWLB2K--YXzYqRv.js","assets/classDiagram-v2-VYDZK3BY-D0wKCQxK.js","assets/stateDiagram-D77RDMKH-sy7Rfo0f.js","assets/chunk-IMKFNOWR-D_IoXv7y.js","assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js","assets/journeyDiagram-3NMN7TZE-CkgASPQL.js","assets/timeline-definition-24CTP7MA-Ck5GR00U.js","assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js","assets/kanban-definition-UXKFOSKX-C_T9GYcq.js","assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js","assets/diagram-Z3DM3KII-C7wRZKVi.js","assets/diagram-UQ7AKVKN-CsDpBRwj.js","assets/blockDiagram-I7D4REHJ-JIRyk-UT.js","assets/diagram-S7CK7UJ4-Bhn2u9og.js","assets/architectureDiagram-5GKGNRK7-BMtIY0MM.js","assets/diagram-VSXAHHWV-BPFQwR9c.js","assets/ishikawaDiagram-5VMMS53U-B42RhGud.js","assets/vennDiagram-4TSXK5OY-kVi8iDPL.js","assets/diagram-VX7I27RA-DYKyI2lv.js","assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js","assets/cynefinDiagram-5FMLGOSQ-T6cXmRvG.js","assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js","assets/chunk-SVP7TREG-DegBQCYH.js","assets/ebnfDiagram-PWID7BFC-CsupTakH.js","assets/abnfDiagram-VCTEODGH-Bfs8g8Bc.js","assets/pegDiagram-XKGWAZYB-C77gkBP1.js"])))=>i.map(i=>d[i]); -var pm=Object.defineProperty;var ym=(e,t,r)=>t in e?pm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Nt=(e,t,r)=>ym(e,typeof t!="symbol"?t+"":t,r);import{p as li,_ as Mt}from"./app-zsnl1T1T.js";import{g as Tn}from"./client-BPXDbY79.js";var Lu=Object.defineProperty,g=(e,t)=>Lu(e,"name",{value:t,configurable:!0}),mm=(e,t)=>{for(var r in t)Lu(e,r,{get:t[r],enumerable:!0})},$s={exports:{}},xm=$s.exports,Jl;function Cm(){return Jl||(Jl=1,(function(e,t){(function(r,i){e.exports=i()})(xm,(function(){var r=1e3,i=6e4,s=36e5,a="millisecond",o="second",n="minute",l="hour",c="day",h="week",u="month",d="quarter",f="year",y="date",m="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var E=["th","st","nd","rd"],B=A%100;return"["+A+(E[(B-20)%10]||E[B]||E[0])+"]"}},w=function(A,E,B){var D=String(A);return!D||D.length>=E?A:""+Array(E+1-D.length).join(B)+A},T={s:w,z:function(A){var E=-A.utcOffset(),B=Math.abs(E),D=Math.floor(B/60),$=B%60;return(E<=0?"+":"-")+w(D,2,"0")+":"+w($,2,"0")},m:function A(E,B){if(E.date()1)return A(V[0])}else{var at=E.name;v[at]=E,$=at}return!D&&$&&(_=$),$||!D&&_},W=function(A,E){if(L(A))return A.clone();var B=typeof E=="object"?E:{};return B.date=A,B.args=arguments,new rt(B)},q=T;q.l=U,q.i=L,q.w=function(A,E){return W(A,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var rt=(function(){function A(B){this.$L=U(B.locale,null,!0),this.parse(B),this.$x=this.$x||B.x||{},this[F]=!0}var E=A.prototype;return E.parse=function(B){this.$d=(function(D){var $=D.date,N=D.utc;if($===null)return new Date(NaN);if(q.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var V=$.match(C);if(V){var at=V[2]-1||0,ht=(V[7]||"0").substring(0,3);return N?new Date(Date.UTC(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)):new Date(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)}}return new Date($)})(B),this.init()},E.init=function(){var B=this.$d;this.$y=B.getFullYear(),this.$M=B.getMonth(),this.$D=B.getDate(),this.$W=B.getDay(),this.$H=B.getHours(),this.$m=B.getMinutes(),this.$s=B.getSeconds(),this.$ms=B.getMilliseconds()},E.$utils=function(){return q},E.isValid=function(){return this.$d.toString()!==m},E.isSame=function(B,D){var $=W(B);return this.startOf(D)<=$&&$<=this.endOf(D)},E.isAfter=function(B,D){return W(B){},"trace"),debug:g((...e)=>{},"debug"),info:g((...e)=>{},"info"),warn:g((...e)=>{},"warn"),error:g((...e)=>{},"error"),fatal:g((...e)=>{},"fatal")},_n=g(function(e="fatal"){let t=We.fatal;typeof e=="string"?e.toLowerCase()in We&&(t=We[e]):typeof e=="number"&&(t=e),I.trace=()=>{},I.debug=()=>{},I.info=()=>{},I.warn=()=>{},I.error=()=>{},I.fatal=()=>{},t<=We.fatal&&(I.fatal=console.error?console.error.bind(console,fe("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",fe("FATAL"))),t<=We.error&&(I.error=console.error?console.error.bind(console,fe("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",fe("ERROR"))),t<=We.warn&&(I.warn=console.warn?console.warn.bind(console,fe("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",fe("WARN"))),t<=We.info&&(I.info=console.info?console.info.bind(console,fe("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",fe("INFO"))),t<=We.debug&&(I.debug=console.debug?console.debug.bind(console,fe("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("DEBUG"))),t<=We.trace&&(I.trace=console.debug?console.debug.bind(console,fe("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("TRACE")))},"setLogLevel"),fe=g(e=>`%c${km().format("ss.SSS")} : ${e} : `,"format");const Os={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,a=2*r-s;switch(i){case"r":return Os.hue2rgb(a,s,e+1/3)*255;case"g":return Os.hue2rgb(a,s,e)*255;case"b":return Os.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),a=Math.min(e,t,r),o=(s+a)/2;if(i==="l")return o*100;if(s===a)return 0;const n=s-a,l=o>.5?n/(2-s-a):n/(s+a);if(i==="s")return l*100;switch(s){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},Sm={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},Lt={channel:Os,lang:wm,unit:Sm},tr={};for(let e=0;e<=255;e++)tr[e]=Lt.unit.dec2hex(e);const te={ALL:0,RGB:1,HSL:2};let Tm=class{constructor(){this.type=te.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=te.ALL}is(t){return this.type===t}};class _m{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Tm}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=te.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:s}=t;r===void 0&&(t.h=Lt.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=Lt.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=Lt.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:s}=t;r===void 0&&(t.r=Lt.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=Lt.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=Lt.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(te.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(te.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(te.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(te.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(te.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(te.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Ca=new _m({r:0,g:0,b:0,a:0},"transparent"),Hr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Hr.re);if(!t)return;const r=t[1],i=parseInt(r,16),s=r.length,a=s%4===0,o=s>4,n=o?1:17,l=o?8:4,c=a?0:-1,h=o?255:15;return Ca.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:a?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}${tr[Math.round(s*255)]}`:`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}`}},gr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(gr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return Lt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Lt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Lt.channel.clamp.h(parseFloat(r)*360)}}return Lt.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(gr.re);if(!r)return;const[,i,s,a,o,n]=r;return Ca.set({h:gr._hue2deg(i),s:Lt.channel.clamp.s(parseFloat(s)),l:Lt.channel.clamp.l(parseFloat(a)),a:o?Lt.channel.clamp.a(n?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:s}=e;return s<1?`hsla(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%, ${s})`:`hsl(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%)`}},ji={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ji.colors[e];if(t)return Hr.parse(t)},stringify:e=>{const t=Hr.stringify(e);for(const r in ji.colors)if(ji.colors[r]===t)return r}},Di={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Di.re);if(!r)return;const[,i,s,a,o,n,l,c,h]=r;return Ca.set({r:Lt.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:Lt.channel.clamp.g(o?parseFloat(a)*2.55:parseFloat(a)),b:Lt.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?Lt.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`rgba(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)}, ${Lt.lang.round(s)})`:`rgb(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)})`}},Oe={format:{keyword:ji,hex:Hr,rgb:Di,rgba:Di,hsl:gr,hsla:gr},parse:e=>{if(typeof e!="string")return e;const t=Hr.parse(e)||Di.parse(e)||gr.parse(e)||ji.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(te.HSL)||e.data.r===void 0?gr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Di.stringify(e):Hr.stringify(e)},Fu=(e,t)=>{const r=Oe.parse(e);for(const i in t)r[i]=Lt.channel.clamp[i](t[i]);return Oe.stringify(r)},sr=(e,t,r=0,i=1)=>{if(typeof e!="number")return Fu(e,{a:t});const s=Ca.set({r:Lt.channel.clamp.r(e),g:Lt.channel.clamp.g(t),b:Lt.channel.clamp.b(r),a:Lt.channel.clamp.a(i)});return Oe.stringify(s)},Bm=e=>{const{r:t,g:r,b:i}=Oe.parse(e),s=.2126*Lt.channel.toLinear(t)+.7152*Lt.channel.toLinear(r)+.0722*Lt.channel.toLinear(i);return Lt.lang.round(s)},vm=e=>Bm(e)>=.5,Te=e=>!vm(e),Mu=(e,t,r)=>{const i=Oe.parse(e),s=i[t],a=Lt.channel.clamp[t](s+r);return s!==a&&(i[t]=a),Oe.stringify(i)},z=(e,t)=>Mu(e,"l",t),H=(e,t)=>Mu(e,"l",-t),b=(e,t)=>{const r=Oe.parse(e),i={};for(const s in t)t[s]&&(i[s]=r[s]+t[s]);return Fu(e,i)},Lm=(e,t,r=50)=>{const{r:i,g:s,b:a,a:o}=Oe.parse(e),{r:n,g:l,b:c,a:h}=Oe.parse(t),u=r/100,d=u*2-1,f=o-h,m=((d*f===-1?d:(d+f)/(1+d*f))+1)/2,C=1-m,x=i*m+n*C,k=s*m+l*C,w=a*m+c*C,T=o*u+h*(1-u);return sr(x,k,w,T)},M=(e,t=100)=>{const r=Oe.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,Lm(r,e,t)};var Do=g((e,t,{depth:r=2}={})=>{const i={depth:r};if(Array.isArray(t)&&!Array.isArray(e))return t.forEach(s=>Do(e,s,i)),e;if(Array.isArray(t)&&Array.isArray(e))return t.forEach(s=>{e.includes(s)||e.push(s)}),e;if(e==null||r<=0)return e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t;if(t!=null&&typeof e=="object"&&typeof t=="object"){const s=e;Object.entries(t).forEach(([a,o])=>{if(typeof o=="object"){if(o===null)return;Object.hasOwn(e,a)||Object.defineProperty(e,a,{value:void 0,writable:!0,enumerable:!0,configurable:!0}),s[a]===void 0&&(s[a]=Array.isArray(o)?[]:{}),typeof s[a]=="object"&&(s[a]=Do(s[a],o,{depth:r-1}))}else typeof s[a]!="object"&&(Object.hasOwn(e,a)?s[a]=o:Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}))})}return e},"assignWithDepth"),Zt=Do,Pe="#ffffff",Ie="#f2f2f2",Tt=g((e,t)=>t?b(e,{s:-40,l:10}):b(e,{s:-40,l:-10}),"mkBorder"),Gr,Fm=(Gr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt,R;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||H(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10)):(this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||z(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let vt=0;vt{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Gr,"Theme"),Gr),Mm=g(e=>{const t=new Fm;return t.calculate(e),t},"getThemeVariables"),Xr,Am=(Xr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=H("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=H(this.sectionBkgColor,10),this.taskBorderColor=sr(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=sr(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||z(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=z(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=z(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=M(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=b(this.primaryColor,{h:64}),this.fillType3=b(this.secondaryColor,{h:64}),this.fillType4=b(this.primaryColor,{h:-64}),this.fillType5=b(this.secondaryColor,{h:-64}),this.fillType6=b(this.primaryColor,{h:128}),this.fillType7=b(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330});for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Xr,"Theme"),Xr),Em=g(e=>{const t=new Am;return t.calculate(e),t},"getThemeVariables"),Vr,$m=(Vr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=b(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=sr(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]==="calculated"&&(this[i]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Vr,"Theme"),Vr),Om=g(e=>{const t=new $m;return t.calculate(e),t},"getThemeVariables"),Zr,Dm=(Zr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=z("#cde498",10),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.primaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.actorBorder=H(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Zr,"Theme"),Zr),Pm=g(e=>{const t=new Dm;return t.calculate(e),t},"getThemeVariables"),Kr,Im=(Kr=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=z(this.contrast,55),this.background="#ffffff",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.contrast,55),this.border2=this.contrast,this.actorBorder=z(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Kr,"Theme"),Kr),Rm=g(e=>{const t=new Im;return t.calculate(e),t},"getThemeVariables"),Qr,qm=(Qr=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||t,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||i,this.cScale3=this.cScale3||b(t,{h:30}),this.cScale4=this.cScale4||b(t,{h:60}),this.cScale5=this.cScale5||b(t,{h:90}),this.cScale6=this.cScale6||b(t,{h:120}),this.cScale7=this.cScale7||b(t,{h:150}),this.cScale8=this.cScale8||b(t,{h:210,l:150}),this.cScale9=this.cScale9||b(t,{h:270}),this.cScale10=this.cScale10||b(t,{h:300}),this.cScale11=this.cScale11||b(t,{h:330}),this.darkMode)for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Qr,"Theme"),Qr),Nm=g(e=>{const t=new qm;return t.calculate(e),t},"getThemeVariables"),Jr,Wm=(Jr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Jr,"Theme"),Jr),zm=g(e=>{const t=new Wm;return t.calculate(e),t},"getThemeVariables"),ti,Hm=(ti=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ti,"Theme"),ti),Ym=g(e=>{const t=new Hm;return t.calculate(e),t},"getThemeVariables"),ei,jm=(ei=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ei,"Theme"),ei),Um=g(e=>{const t=new jm;return t.calculate(e),t},"getThemeVariables"),ri,Gm=(ri=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ri,"Theme"),ri),Xm=g(e=>{const t=new Gm;return t.calculate(e),t},"getThemeVariables"),ii,Vm=(ii=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ii,"Theme"),ii),Zm=g(e=>{const t=new Vm;return t.calculate(e),t},"getThemeVariables"),Ue={base:{getThemeVariables:Mm},dark:{getThemeVariables:Em},default:{getThemeVariables:Om},forest:{getThemeVariables:Pm},neutral:{getThemeVariables:Rm},neo:{getThemeVariables:Nm},"neo-dark":{getThemeVariables:zm},redux:{getThemeVariables:Ym},"redux-dark":{getThemeVariables:Um},"redux-color":{getThemeVariables:Xm},"redux-dark-color":{getThemeVariables:Zm}},Kt={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,showLegend:!0,legendFontSize:14,legendPadding:10,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Au={...Kt,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",nodePlacementAlignment:"NONE",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES",keepEntryNodeOnTop:!1},themeCSS:void 0,themeVariables:Ue.default.getThemeVariables(),sequence:{...Kt.sequence,messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:g(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:g(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{defaultRenderer:"dagre-wrapper",hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Kt.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Kt.c4,useWidth:void 0,personFont:g(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Kt.flowchart,inheritDir:!1},external_personFont:g(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:g(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:g(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:g(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:g(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:g(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:g(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:g(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:g(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:g(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:g(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:g(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:g(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:g(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:g(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:g(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:g(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:g(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:g(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:g(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Kt.pie,useWidth:984},xyChart:{...Kt.xyChart,useWidth:void 0},requirement:{...Kt.requirement,useWidth:void 0},packet:{...Kt.packet},eventmodeling:{...Kt.eventmodeling},treeView:{...Kt.treeView,useWidth:void 0},radar:{...Kt.radar},railroad:{...Kt.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...Kt.ishikawa},sankey:{...Kt.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Kt.venn},cynefin:{...Kt.cynefin}},Eu=g((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...Eu(e[i],"")]:[...r,t+i],[]),"keyify"),Km=new Set(Eu(Au,"")),$u=Au,Qm={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},Jm=g((e,t)=>{for(const r of Object.keys(e)){const i=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof i!="string"||!t.test(i))&&(I.debug("sanitize deleting dictionary entry:",r,i),delete e[r])}},"sanitizeDictionaryConfig"),Us=g(e=>{if(I.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Us(t));return}for(const t of Object.keys(e)){if(I.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Km.has(t)||e[t]==null){I.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){const i=Qm[t];i?Jm(e[t],i):(I.debug("sanitizing object",t),Us(e[t]));continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(I.debug("sanitizing css option",t),e[t]=Ou(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}I.debug("After sanitization",e)}},"sanitizeDirective"),Ou=g(e=>{let t=0,r=0;for(const i of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),ne=Zt({},hi),Gs,Cr=[],Ui=Zt({},hi),hs=g((e,t)=>{let r=Zt({},e),i={};for(const s of t)Iu(s),i=Zt(i,s);if(r=Zt(r,i),i.theme&&i.theme in Ue){const s=Zt({},Gs),a=Zt(s.themeVariables||{},i.themeVariables);r.theme&&r.theme in Ue&&(r.themeVariables=Ue[r.theme].getThemeVariables(a))}return Ui=r,a0(Ui),Ui},"updateCurrentConfig"),t0=g(e=>(ne=Zt({},hi),ne=Zt(ne,e),e.theme&&Ue[e.theme]&&(ne.themeVariables=Ue[e.theme].getThemeVariables(e.themeVariables)),hs(ne,Cr),ne),"setSiteConfig"),e0=g(e=>{Gs=Zt({},e)},"saveConfigFromInitialize"),r0=g(e=>(ne=Zt(ne,e),hs(ne,Cr),ne),"updateSiteConfig"),Du=g(()=>Zt({},ne),"getSiteConfig"),Pu=g(e=>(hs(Ui,[e]),Yt()),"setConfig"),Yt=g(()=>Zt({},Ui),"getConfig"),Iu=g(e=>{e&&(["secure",...ne.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(I.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&Iu(e[t])}))},"sanitize"),i0=g(e=>{var t;Us(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Cr.push(e),hs(ne,Cr)},"addDirective"),Xs=g((e=ne)=>{Cr=[],hs(e,Cr)},"reset"),s0={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},th={},Ru=g(e=>{th[e]||(I.warn(s0[e]),th[e]=!0)},"issueWarning"),a0=g(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&Ru("LAZY_LOAD_DEPRECATED")},"checkConfig"),tM=g(()=>{let e={};Gs&&(e=Zt(e,Gs));for(const t of Cr)e=Zt(e,t);return e},"getUserDefinedConfig"),ie=g(e=>{var t,r;return((t=e.flowchart)==null?void 0:t.htmlLabels)!=null&&Ru("FLOWCHART_HTML_LABELS_DEPRECATED"),Re(e.htmlLabels??((r=e.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),qu=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,Gi=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,o0=/\s*%%.*\n/gm,si,Nu=(si=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},g(si,"UnknownDiagramError"),si),br={},Bn=g(function(e,t){e=e.replace(qu,"").replace(Gi,"").replace(o0,` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-INFHLROL-Bt4UpecU.js","assets/app-DmCHnbVO.js","assets/client-BPXDbY79.js","assets/app-Dnczv4y8.css","assets/dagre-GXQ25YYZ-BZfaRacC.js","assets/layout-B_w7f5cg.js","assets/swimlanes-42K2YHIH-BcKWWDjF.js","assets/cose-bilkent-JH36ORCC-g-PZ3PJZ.js","assets/cytoscape.esm-Ix0LnXOy.js","assets/c4Diagram-7LVT6UL2-CyJ-OjiV.js","assets/chunk-F27PBJKO-2GmsQB4U.js","assets/flowDiagram-HODETNUW-BRjqrD7u.js","assets/chunk-5VM5RSS4-DuWyxJ-G.js","assets/chunk-XXDRQBXY-CEoTwp0p.js","assets/chunk-POPQ4Y6H-OaNnn-K8.js","assets/channel-BcBgmgAp.js","assets/swimlanesDiagram-VR7AAH4N-BWEneQLP.js","assets/erDiagram-RLTQ6QDP-sS227ewn.js","assets/gitGraphDiagram-WWUBYQGX-CKFZpt0Z.js","assets/chunk-2Q5K7J3B-Ca-MXWFO.js","assets/chunk-JWPE2WC7-DQLdNA-f.js","assets/cynefin-OW5HDTMX-r2gVnQsI.js","assets/ganttDiagram-EL5Y4UJY-Dr_9OMcR.js","assets/linear-61bSIS_K.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-27XIBGKW-CR9oYlVY.js","assets/pieDiagram-E7YTZNPT-COMLqW9-.js","assets/arc-D2jKxjLS.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AXDQQJYC-B0v9e3iH.js","assets/xychartDiagram-S5SC5T6Z-BMGpkbBF.js","assets/requirementDiagram-BXWQKSXE-Cb83i4fD.js","assets/sequenceDiagram-WJ2MYXX4-D69Gj_rf.js","assets/classDiagram-ZZMXUADV-DGoLhpgF.js","assets/chunk-TICWLB2K-CXDwtwC7.js","assets/classDiagram-v2-VYDZK3BY-DGoLhpgF.js","assets/stateDiagram-D77RDMKH-BaS0tICg.js","assets/chunk-IMKFNOWR-qeP8E-nc.js","assets/stateDiagram-v2-MP3YSRHH-CtqGz6p6.js","assets/journeyDiagram-3NMN7TZE-B118or3e.js","assets/timeline-definition-24CTP7MA-tqGUvpOH.js","assets/mindmap-definition-YA3MSWOX-DYGePCnN.js","assets/kanban-definition-UXKFOSKX-B4aZ932z.js","assets/sankeyDiagram-P5KCCOFB-Dv0jV2ka.js","assets/diagram-Z3DM3KII-WNIFVi0Q.js","assets/diagram-UQ7AKVKN-De0fNkzZ.js","assets/blockDiagram-I7D4REHJ-DIqSOQsY.js","assets/diagram-S7CK7UJ4-x7ODN_Fr.js","assets/architectureDiagram-5GKGNRK7-yUitYCC3.js","assets/diagram-VSXAHHWV-D-4K2Uv-.js","assets/ishikawaDiagram-5VMMS53U-BQdVBYth.js","assets/vennDiagram-4TSXK5OY-pcfAD8hQ.js","assets/diagram-VX7I27RA-B3oZVKXq.js","assets/wardleyDiagram-VM6X3IG4-Ck_DXu78.js","assets/cynefinDiagram-5FMLGOSQ-DM3cCVfa.js","assets/railroadDiagram-O6MQD6OU-nUeJW8RG.js","assets/chunk-SVP7TREG-Wjd95MYc.js","assets/ebnfDiagram-PWID7BFC-DyIJUwiI.js","assets/abnfDiagram-VCTEODGH-DkzoDDgP.js","assets/pegDiagram-XKGWAZYB-CosznoAs.js"])))=>i.map(i=>d[i]); +var pm=Object.defineProperty;var ym=(e,t,r)=>t in e?pm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Nt=(e,t,r)=>ym(e,typeof t!="symbol"?t+"":t,r);import{p as li,_ as Mt}from"./app-DmCHnbVO.js";import{g as Tn}from"./client-BPXDbY79.js";var Lu=Object.defineProperty,g=(e,t)=>Lu(e,"name",{value:t,configurable:!0}),mm=(e,t)=>{for(var r in t)Lu(e,r,{get:t[r],enumerable:!0})},$s={exports:{}},xm=$s.exports,Jl;function Cm(){return Jl||(Jl=1,(function(e,t){(function(r,i){e.exports=i()})(xm,(function(){var r=1e3,i=6e4,s=36e5,a="millisecond",o="second",n="minute",l="hour",c="day",h="week",u="month",d="quarter",f="year",y="date",m="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var E=["th","st","nd","rd"],B=A%100;return"["+A+(E[(B-20)%10]||E[B]||E[0])+"]"}},w=function(A,E,B){var D=String(A);return!D||D.length>=E?A:""+Array(E+1-D.length).join(B)+A},T={s:w,z:function(A){var E=-A.utcOffset(),B=Math.abs(E),D=Math.floor(B/60),$=B%60;return(E<=0?"+":"-")+w(D,2,"0")+":"+w($,2,"0")},m:function A(E,B){if(E.date()1)return A(V[0])}else{var at=E.name;v[at]=E,$=at}return!D&&$&&(_=$),$||!D&&_},W=function(A,E){if(L(A))return A.clone();var B=typeof E=="object"?E:{};return B.date=A,B.args=arguments,new rt(B)},q=T;q.l=U,q.i=L,q.w=function(A,E){return W(A,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var rt=(function(){function A(B){this.$L=U(B.locale,null,!0),this.parse(B),this.$x=this.$x||B.x||{},this[F]=!0}var E=A.prototype;return E.parse=function(B){this.$d=(function(D){var $=D.date,N=D.utc;if($===null)return new Date(NaN);if(q.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var V=$.match(C);if(V){var at=V[2]-1||0,ht=(V[7]||"0").substring(0,3);return N?new Date(Date.UTC(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)):new Date(V[1],at,V[3]||1,V[4]||0,V[5]||0,V[6]||0,ht)}}return new Date($)})(B),this.init()},E.init=function(){var B=this.$d;this.$y=B.getFullYear(),this.$M=B.getMonth(),this.$D=B.getDate(),this.$W=B.getDay(),this.$H=B.getHours(),this.$m=B.getMinutes(),this.$s=B.getSeconds(),this.$ms=B.getMilliseconds()},E.$utils=function(){return q},E.isValid=function(){return this.$d.toString()!==m},E.isSame=function(B,D){var $=W(B);return this.startOf(D)<=$&&$<=this.endOf(D)},E.isAfter=function(B,D){return W(B){},"trace"),debug:g((...e)=>{},"debug"),info:g((...e)=>{},"info"),warn:g((...e)=>{},"warn"),error:g((...e)=>{},"error"),fatal:g((...e)=>{},"fatal")},_n=g(function(e="fatal"){let t=We.fatal;typeof e=="string"?e.toLowerCase()in We&&(t=We[e]):typeof e=="number"&&(t=e),I.trace=()=>{},I.debug=()=>{},I.info=()=>{},I.warn=()=>{},I.error=()=>{},I.fatal=()=>{},t<=We.fatal&&(I.fatal=console.error?console.error.bind(console,fe("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",fe("FATAL"))),t<=We.error&&(I.error=console.error?console.error.bind(console,fe("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",fe("ERROR"))),t<=We.warn&&(I.warn=console.warn?console.warn.bind(console,fe("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",fe("WARN"))),t<=We.info&&(I.info=console.info?console.info.bind(console,fe("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",fe("INFO"))),t<=We.debug&&(I.debug=console.debug?console.debug.bind(console,fe("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("DEBUG"))),t<=We.trace&&(I.trace=console.debug?console.debug.bind(console,fe("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",fe("TRACE")))},"setLogLevel"),fe=g(e=>`%c${km().format("ss.SSS")} : ${e} : `,"format");const Os={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,a=2*r-s;switch(i){case"r":return Os.hue2rgb(a,s,e+1/3)*255;case"g":return Os.hue2rgb(a,s,e)*255;case"b":return Os.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),a=Math.min(e,t,r),o=(s+a)/2;if(i==="l")return o*100;if(s===a)return 0;const n=s-a,l=o>.5?n/(2-s-a):n/(s+a);if(i==="s")return l*100;switch(s){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},Sm={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},Lt={channel:Os,lang:wm,unit:Sm},tr={};for(let e=0;e<=255;e++)tr[e]=Lt.unit.dec2hex(e);const te={ALL:0,RGB:1,HSL:2};let Tm=class{constructor(){this.type=te.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=te.ALL}is(t){return this.type===t}};class _m{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Tm}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=te.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:s}=t;r===void 0&&(t.h=Lt.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=Lt.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=Lt.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:s}=t;r===void 0&&(t.r=Lt.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=Lt.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=Lt.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(te.HSL)&&r!==void 0?r:(this._ensureHSL(),Lt.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(te.RGB)&&r!==void 0?r:(this._ensureRGB(),Lt.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(te.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(te.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(te.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(te.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(te.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(te.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Ca=new _m({r:0,g:0,b:0,a:0},"transparent"),Hr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Hr.re);if(!t)return;const r=t[1],i=parseInt(r,16),s=r.length,a=s%4===0,o=s>4,n=o?1:17,l=o?8:4,c=a?0:-1,h=o?255:15;return Ca.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:a?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}${tr[Math.round(s*255)]}`:`#${tr[Math.round(t)]}${tr[Math.round(r)]}${tr[Math.round(i)]}`}},gr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(gr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return Lt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Lt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Lt.channel.clamp.h(parseFloat(r)*360)}}return Lt.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(gr.re);if(!r)return;const[,i,s,a,o,n]=r;return Ca.set({h:gr._hue2deg(i),s:Lt.channel.clamp.s(parseFloat(s)),l:Lt.channel.clamp.l(parseFloat(a)),a:o?Lt.channel.clamp.a(n?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:s}=e;return s<1?`hsla(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%, ${s})`:`hsl(${Lt.lang.round(t)}, ${Lt.lang.round(r)}%, ${Lt.lang.round(i)}%)`}},ji={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ji.colors[e];if(t)return Hr.parse(t)},stringify:e=>{const t=Hr.stringify(e);for(const r in ji.colors)if(ji.colors[r]===t)return r}},Di={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Di.re);if(!r)return;const[,i,s,a,o,n,l,c,h]=r;return Ca.set({r:Lt.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:Lt.channel.clamp.g(o?parseFloat(a)*2.55:parseFloat(a)),b:Lt.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?Lt.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`rgba(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)}, ${Lt.lang.round(s)})`:`rgb(${Lt.lang.round(t)}, ${Lt.lang.round(r)}, ${Lt.lang.round(i)})`}},Oe={format:{keyword:ji,hex:Hr,rgb:Di,rgba:Di,hsl:gr,hsla:gr},parse:e=>{if(typeof e!="string")return e;const t=Hr.parse(e)||Di.parse(e)||gr.parse(e)||ji.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(te.HSL)||e.data.r===void 0?gr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Di.stringify(e):Hr.stringify(e)},Fu=(e,t)=>{const r=Oe.parse(e);for(const i in t)r[i]=Lt.channel.clamp[i](t[i]);return Oe.stringify(r)},sr=(e,t,r=0,i=1)=>{if(typeof e!="number")return Fu(e,{a:t});const s=Ca.set({r:Lt.channel.clamp.r(e),g:Lt.channel.clamp.g(t),b:Lt.channel.clamp.b(r),a:Lt.channel.clamp.a(i)});return Oe.stringify(s)},Bm=e=>{const{r:t,g:r,b:i}=Oe.parse(e),s=.2126*Lt.channel.toLinear(t)+.7152*Lt.channel.toLinear(r)+.0722*Lt.channel.toLinear(i);return Lt.lang.round(s)},vm=e=>Bm(e)>=.5,Te=e=>!vm(e),Mu=(e,t,r)=>{const i=Oe.parse(e),s=i[t],a=Lt.channel.clamp[t](s+r);return s!==a&&(i[t]=a),Oe.stringify(i)},z=(e,t)=>Mu(e,"l",t),H=(e,t)=>Mu(e,"l",-t),b=(e,t)=>{const r=Oe.parse(e),i={};for(const s in t)t[s]&&(i[s]=r[s]+t[s]);return Fu(e,i)},Lm=(e,t,r=50)=>{const{r:i,g:s,b:a,a:o}=Oe.parse(e),{r:n,g:l,b:c,a:h}=Oe.parse(t),u=r/100,d=u*2-1,f=o-h,m=((d*f===-1?d:(d+f)/(1+d*f))+1)/2,C=1-m,x=i*m+n*C,k=s*m+l*C,w=a*m+c*C,T=o*u+h*(1-u);return sr(x,k,w,T)},M=(e,t=100)=>{const r=Oe.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,Lm(r,e,t)};var Do=g((e,t,{depth:r=2}={})=>{const i={depth:r};if(Array.isArray(t)&&!Array.isArray(e))return t.forEach(s=>Do(e,s,i)),e;if(Array.isArray(t)&&Array.isArray(e))return t.forEach(s=>{e.includes(s)||e.push(s)}),e;if(e==null||r<=0)return e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t;if(t!=null&&typeof e=="object"&&typeof t=="object"){const s=e;Object.entries(t).forEach(([a,o])=>{if(typeof o=="object"){if(o===null)return;Object.hasOwn(e,a)||Object.defineProperty(e,a,{value:void 0,writable:!0,enumerable:!0,configurable:!0}),s[a]===void 0&&(s[a]=Array.isArray(o)?[]:{}),typeof s[a]=="object"&&(s[a]=Do(s[a],o,{depth:r-1}))}else typeof s[a]!="object"&&(Object.hasOwn(e,a)?s[a]=o:Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}))})}return e},"assignWithDepth"),Zt=Do,Pe="#ffffff",Ie="#f2f2f2",Tt=g((e,t)=>t?b(e,{s:-40,l:10}):b(e,{s:-40,l:-10}),"mkBorder"),Gr,Fm=(Gr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt,R;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||H(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10)):(this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||z(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let vt=0;vt{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Gr,"Theme"),Gr),Mm=g(e=>{const t=new Fm;return t.calculate(e),t},"getThemeVariables"),Xr,Am=(Xr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=H("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=H(this.sectionBkgColor,10),this.taskBorderColor=sr(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=sr(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||z(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=z(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=z(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=M(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=b(this.primaryColor,{h:64}),this.fillType3=b(this.secondaryColor,{h:64}),this.fillType4=b(this.primaryColor,{h:-64}),this.fillType5=b(this.secondaryColor,{h:-64}),this.fillType6=b(this.primaryColor,{h:128}),this.fillType7=b(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330});for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Xr,"Theme"),Xr),Em=g(e=>{const t=new Am;return t.calculate(e),t},"getThemeVariables"),Vr,$m=(Vr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=b(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=sr(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]==="calculated"&&(this[i]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Vr,"Theme"),Vr),Om=g(e=>{const t=new $m;return t.calculate(e),t},"getThemeVariables"),Zr,Dm=(Zr=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=z("#cde498",10),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.primaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.actorBorder=H(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||H(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||H(this.tertiaryColor,40);for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Zr,"Theme"),Zr),Pm=g(e=>{const t=new Dm;return t.calculate(e),t},"getThemeVariables"),Kr,Im=(Kr=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=z(this.contrast,55),this.background="#ffffff",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.lineColor=M(this.background),this.textColor=M(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||z(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var t,r,i,s,a,o,n,l,c,h,u,d,f,y,m,C,x,k,w,T,_,v,F,L,U,W,q,rt,Y,A,E,B,D,$,N,V,at,ht,gt,yt,pt,_t,wt,$t,bt,it,ut,Bt,At,qt;this.secondBkg=z(this.contrast,55),this.border2=this.contrast,this.actorBorder=z(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let R=0;R{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Kr,"Theme"),Kr),Rm=g(e=>{const t=new Im;return t.calculate(e),t},"getThemeVariables"),Qr,qm=(Qr=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||t,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||i,this.cScale3=this.cScale3||b(t,{h:30}),this.cScale4=this.cScale4||b(t,{h:60}),this.cScale5=this.cScale5||b(t,{h:90}),this.cScale6=this.cScale6||b(t,{h:120}),this.cScale7=this.cScale7||b(t,{h:150}),this.cScale8=this.cScale8||b(t,{h:210,l:150}),this.cScale9=this.cScale9||b(t,{h:270}),this.cScale10=this.cScale10||b(t,{h:300}),this.cScale11=this.cScale11||b(t,{h:330}),this.darkMode)for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Qr,"Theme"),Qr),Nm=g(e=>{const t=new qm;return t.calculate(e),t},"getThemeVariables"),Jr,Wm=(Jr=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(Jr,"Theme"),Jr),zm=g(e=>{const t=new Wm;return t.calculate(e),t},"getThemeVariables"),ti,Hm=(ti=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ti,"Theme"),ti),Ym=g(e=>{const t=new Hm;return t.calculate(e),t},"getThemeVariables"),ei,jm=(ei=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ei,"Theme"),ei),Um=g(e=>{const t=new jm;return t.calculate(e),t},"getThemeVariables"),ri,Gm=(ri=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Tt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var a,o,n,l,c,h,u,d,f,y,m,C;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||z(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let x=0;x{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ri,"Theme"),ri),Xm=g(e=>{const t=new Gm;return t.calculate(e),t},"getThemeVariables"),ii,Vm=(ii=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=z(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=M(this.background),this.secondaryBorderColor=Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Tt(this.tertiaryColor,this.darkMode),this.primaryTextColor=M(this.primaryColor),this.secondaryTextColor=M(this.secondaryColor),this.tertiaryTextColor=M(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=z(M("#323D47"),10),this.border1="#ccc",this.border2=sr(255,255,255,.25),this.arrowheadColor=M(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,o,n,l,c,h,u,d,f;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Tt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Tt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Tt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Tt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||M(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||M(this.tertiaryColor),this.lineColor=this.lineColor||M(this.background),this.arrowheadColor=this.arrowheadColor||M(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?H(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||H(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||M(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||z(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let y=0;y{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},g(ii,"Theme"),ii),Zm=g(e=>{const t=new Vm;return t.calculate(e),t},"getThemeVariables"),Ue={base:{getThemeVariables:Mm},dark:{getThemeVariables:Em},default:{getThemeVariables:Om},forest:{getThemeVariables:Pm},neutral:{getThemeVariables:Rm},neo:{getThemeVariables:Nm},"neo-dark":{getThemeVariables:zm},redux:{getThemeVariables:Ym},"redux-dark":{getThemeVariables:Um},"redux-color":{getThemeVariables:Xm},"redux-dark-color":{getThemeVariables:Zm}},Kt={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,showLegend:!0,legendFontSize:14,legendPadding:10,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Au={...Kt,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",nodePlacementAlignment:"NONE",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES",keepEntryNodeOnTop:!1},themeCSS:void 0,themeVariables:Ue.default.getThemeVariables(),sequence:{...Kt.sequence,messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:g(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:g(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{defaultRenderer:"dagre-wrapper",hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Kt.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Kt.c4,useWidth:void 0,personFont:g(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Kt.flowchart,inheritDir:!1},external_personFont:g(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:g(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:g(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:g(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:g(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:g(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:g(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:g(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:g(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:g(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:g(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:g(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:g(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:g(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:g(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:g(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:g(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:g(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:g(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:g(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:g(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Kt.pie,useWidth:984},xyChart:{...Kt.xyChart,useWidth:void 0},requirement:{...Kt.requirement,useWidth:void 0},packet:{...Kt.packet},eventmodeling:{...Kt.eventmodeling},treeView:{...Kt.treeView,useWidth:void 0},radar:{...Kt.radar},railroad:{...Kt.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...Kt.ishikawa},sankey:{...Kt.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Kt.venn},cynefin:{...Kt.cynefin}},Eu=g((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...Eu(e[i],"")]:[...r,t+i],[]),"keyify"),Km=new Set(Eu(Au,"")),$u=Au,Qm={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},Jm=g((e,t)=>{for(const r of Object.keys(e)){const i=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof i!="string"||!t.test(i))&&(I.debug("sanitize deleting dictionary entry:",r,i),delete e[r])}},"sanitizeDictionaryConfig"),Us=g(e=>{if(I.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Us(t));return}for(const t of Object.keys(e)){if(I.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Km.has(t)||e[t]==null){I.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){const i=Qm[t];i?Jm(e[t],i):(I.debug("sanitizing object",t),Us(e[t]));continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(I.debug("sanitizing css option",t),e[t]=Ou(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}I.debug("After sanitization",e)}},"sanitizeDirective"),Ou=g(e=>{let t=0,r=0;for(const i of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),ne=Zt({},hi),Gs,Cr=[],Ui=Zt({},hi),hs=g((e,t)=>{let r=Zt({},e),i={};for(const s of t)Iu(s),i=Zt(i,s);if(r=Zt(r,i),i.theme&&i.theme in Ue){const s=Zt({},Gs),a=Zt(s.themeVariables||{},i.themeVariables);r.theme&&r.theme in Ue&&(r.themeVariables=Ue[r.theme].getThemeVariables(a))}return Ui=r,a0(Ui),Ui},"updateCurrentConfig"),t0=g(e=>(ne=Zt({},hi),ne=Zt(ne,e),e.theme&&Ue[e.theme]&&(ne.themeVariables=Ue[e.theme].getThemeVariables(e.themeVariables)),hs(ne,Cr),ne),"setSiteConfig"),e0=g(e=>{Gs=Zt({},e)},"saveConfigFromInitialize"),r0=g(e=>(ne=Zt(ne,e),hs(ne,Cr),ne),"updateSiteConfig"),Du=g(()=>Zt({},ne),"getSiteConfig"),Pu=g(e=>(hs(Ui,[e]),Yt()),"setConfig"),Yt=g(()=>Zt({},Ui),"getConfig"),Iu=g(e=>{e&&(["secure",...ne.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(I.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&Iu(e[t])}))},"sanitize"),i0=g(e=>{var t;Us(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Cr.push(e),hs(ne,Cr)},"addDirective"),Xs=g((e=ne)=>{Cr=[],hs(e,Cr)},"reset"),s0={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},th={},Ru=g(e=>{th[e]||(I.warn(s0[e]),th[e]=!0)},"issueWarning"),a0=g(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&Ru("LAZY_LOAD_DEPRECATED")},"checkConfig"),tM=g(()=>{let e={};Gs&&(e=Zt(e,Gs));for(const t of Cr)e=Zt(e,t);return e},"getUserDefinedConfig"),ie=g(e=>{var t,r;return((t=e.flowchart)==null?void 0:t.htmlLabels)!=null&&Ru("FLOWCHART_HTML_LABELS_DEPRECATED"),Re(e.htmlLabels??((r=e.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),qu=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,Gi=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,o0=/\s*%%.*\n/gm,si,Nu=(si=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},g(si,"UnknownDiagramError"),si),br={},Bn=g(function(e,t){e=e.replace(qu,"").replace(Gi,"").replace(o0,` `);for(const[r,{detector:i}]of Object.entries(br))if(i(e,t))return r;throw new Nu(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),Po=g((...e)=>{for(const{id:t,detector:r,loader:i}of e)Wu(t,r,i)},"registerLazyLoadedDiagrams"),Wu=g((e,t,r)=>{br[e]&&I.warn(`Detector with key ${e} already exists. Overwriting.`),br[e]={detector:t,loader:r},I.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),n0=g(e=>br[e].loader,"getDiagramLoader"),cs=//gi,l0=g(e=>e?Yu(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),h0=(()=>{let e=!1;return()=>{e||(zu(),e=!0)}})();function zu(){const e="data-temp-href-target";li.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),li.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}g(zu,"setupDompurifyHooks");var Hu=g(e=>(h0(),li.sanitize(e)),"removeScript"),eh=g((e,t)=>{if(ie(t)){const r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=Hu(e):r!=="loose"&&(e=Yu(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=f0(e))}return e},"sanitizeMore"),ge=g((e,t)=>e&&(t.dompurifyConfig?e=li.sanitize(eh(e,t),t.dompurifyConfig).toString():e=li.sanitize(eh(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),c0=g((e,t)=>typeof e=="string"?ge(e,t):e.flat().map(r=>ge(r,t)),"sanitizeTextOrArray"),u0=g(e=>cs.test(e),"hasBreaks"),d0=g(e=>e.split(cs),"splitBreaks"),f0=g(e=>e.replace(/#br#/g,"
"),"placeholderToBreak"),Yu=g(e=>e.replace(cs,"#br#"),"breakToPlaceholder"),g0=g(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),p0=g(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),y0=g(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),rh=g(function(e){const t=e.split(/(,)/),r=[];for(let i=0;i0&&i+1Math.max(0,e.split(t).length-1),"countOccurrence"),m0=g((e,t)=>{const r=Io(e,"~"),i=Io(t,"~");return r===1&&i===1},"shouldCombineSets"),x0=g(e=>{const t=Io(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const i=[...e];let s=i.indexOf("~"),a=i.lastIndexOf("~");for(;s!==-1&&a!==-1&&s!==a;)i[s]="<",i[a]=">",s=i.indexOf("~"),a=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),ih=g(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Ro=/\$\$(.*?)\$\$/g,Qi=g(e=>{var t;return(((t=e.match(Ro))==null?void 0:t.length)??0)>0},"hasKatex"),eM=g(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await ju(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0";const i=document.querySelector("body");i==null||i.insertAdjacentElement("beforeend",r);const s={width:r.clientWidth,height:r.clientHeight};return r.remove(),s},"calculateMathMLDimensions"),C0=g(async(e,t)=>{if(!Qi(e))return e;if(!(ih()||t.legacyMathML||t.forceLegacyMathML))return e.replace(Ro,"MathML is unsupported in this environment.");{const{default:r}=await Mt(async()=>{const{default:s}=await import("./katex-C5jXJg4s.js");return{default:s}},[]),i=t.forceLegacyMathML||!ih()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(cs).map(s=>Qi(s)?`
${s}
`:`
${s}
`).join("").replace(Ro,(s,a)=>r.renderToString(a,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(//g,""))}},"renderKatexUnsanitized"),ju=g(async(e,t)=>ge(await C0(e,t),t),"renderKatexSanitized"),us={getRows:l0,sanitizeText:ge,sanitizeTextOrArray:c0,hasBreaks:u0,splitBreaks:d0,lineBreakRegex:cs,removeScript:Hu,getUrl:g0,evaluate:Re,getMax:p0,getMin:y0},b0=g(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),k0=g(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),Uu=g(function(e,t,r,i){const s=k0(t,r,i);b0(e,s)},"configureSvgSize"),w0=g(function(e,t,r,i){const s=t.node().getBBox(),a=s.width,o=s.height;I.info(`SVG bounds: ${a}x${o}`,s);let n=0,l=0;I.info(`Graph bounds: ${n}x${l}`,e),n=a+r*2,l=o+r*2,I.info(`Calculated bounds: ${n}x${l}`),Uu(t,l,n,i);const c=`${s.x-r} ${s.y-r} ${s.width+2*r} ${s.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),Ds={};function qo(e){return[...e.cssRules].map(t=>t.cssText).join(` `)}g(qo,"cssStyleSheetToString");var S0=g((e,t,r,i)=>{let s="";return e in Ds&&Ds[e]?s=Ds[e]({...r,svgId:i}):I.warn(`No theme found for ${e}`),`& { font-family: ${r.fontFamily}; @@ -265,7 +265,7 @@ ${a.join(` L0,20`)},"requirement_arrow"),cS=g((e,t,r)=>{const i=Yt(),{themeVariables:s}=i,{strokeWidth:a}=s;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 L20,10 M20,10 - L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),uS=g((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),dS=g((e,t,r)=>{const i=Yt(),{themeVariables:s}=i,{strokeWidth:a}=s,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),fS={extension:jw,composition:Uw,aggregation:Gw,dependency:Xw,lollipop:Vw,point:Zw,circle:Kw,cross:Qw,barb:Jw,barbNeo:tS,only_one:eS,zero_or_one:rS,one_or_more:iS,zero_or_more:sS,only_one_neo:aS,zero_or_one_neo:oS,one_or_more_neo:nS,zero_or_more_neo:lS,requirement_arrow:hS,requirement_contains:uS,requirement_arrow_neo:cS,requirement_contains_neo:dS},bp=Yw,kp=typeof global=="object"&&global&&global.Object===Object&&global,gS=typeof self=="object"&&self&&self.Object===Object&&self,Ze=kp||gS||Function("return this")(),De=Ze.Symbol,wp=Object.prototype,pS=wp.hasOwnProperty,yS=wp.toString,Oi=De?De.toStringTag:void 0;function mS(e){var t=pS.call(e,Oi),r=e[Oi];try{e[Oi]=void 0;var i=!0}catch{}var s=yS.call(e);return i&&(t?e[Oi]=r:delete e[Oi]),s}var xS=Object.prototype,CS=xS.toString;function bS(e){return CS.call(e)}var kS="[object Null]",wS="[object Undefined]",wc=De?De.toStringTag:void 0;function mi(e){return e==null?e===void 0?wS:kS:wc&&wc in Object(e)?mS(e):bS(e)}function Tr(e){return e!=null&&typeof e=="object"}var SS="[object Symbol]";function Cl(e){return typeof e=="symbol"||Tr(e)&&mi(e)==SS}function Sp(e,t){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r0){if(++t>=zS)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Hi(e){return function(){return e}}var Bc=(function(){try{var e=Mr(Object,"defineProperty");return e({},"",{}),e}catch{}})(),US=Bc?function(e,t){return Bc(e,"toString",{configurable:!0,enumerable:!1,value:Hi(t),writable:!0})}:$a,GS=jS(US);function XS(e,t){for(var r=-1,i=e==null?0:e.length;++r-1}var tT=9007199254740991,eT=/^(?:0|[1-9]\d*)$/;function _p(e,t){var r=typeof e;return t=t??tT,!!t&&(r=="number"||r!="symbol"&&eT.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=sT}function Oa(e){return e!=null&&kl(e.length)&&!pa(e)}var aT=Object.prototype;function vp(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||aT;return e===r}function oT(e,t){for(var r=-1,i=Array(e);++r-1}function d_(e,t){var r=this.__data__,i=Pa(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function Ke(e){var t=-1,r=e==null?0:e.length;for(this.clear();++tn))return!1;var c=a.get(e),h=a.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,f=r&Q_?new as:void 0;for(a.set(e,t),a.set(t,e);++u=KB){var c=ZB(e);if(c)return _l(c);o=!1,s=Pp,l=new as}else l=n;t:for(;++i1?s.setNode(a,r):s.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=ur,this._children[t]={},this._children[ur][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],cr(this.children(t),i=>{this.setParent(i)}),delete this._children[t]),cr(Ae(this._in[t]),r),delete this._in[t],delete this._preds[t],cr(Ae(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Wr(r))r=ur;else{r+="";for(var i=r;!Wr(i);i=this.parent(i))if(i===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==ur)return r}}children(t){if(Wr(t)&&(t=ur),this._isCompound){var r=this._children[t];if(r)return Ae(r)}else{if(t===ur)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return Ae(r)}successors(t){var r=this._sucs[t];if(r)return Ae(r)}neighbors(t){var r=this.predecessors(t);if(r)return JB(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var i=this;cr(this._nodes,function(o,n){t(n)&&r.setNode(n,o)}),cr(this._edgeObjs,function(o){r.hasNode(o.v)&&r.hasNode(o.w)&&r.setEdge(o,i.edge(o))});var s={};function a(o){var n=i.parent(o);return n===void 0||r.hasNode(n)?(s[o]=n,n):n in s?s[n]:a(n)}return this._isCompound&&cr(r.nodes(),function(o){r.setParent(o,a(o))}),r}setDefaultEdgeLabel(t){return pa(t)||(t=Hi(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return lo(this._edgeObjs)}setPath(t,r){var i=this,s=arguments;return XB(t,function(a,o){return s.length>1?i.setEdge(a,o,r):i.setEdge(a,o),o}),this}setEdge(){var t,r,i,s,a=!1,o=arguments[0];typeof o=="object"&&o!==null&&"v"in o?(t=o.v,r=o.w,i=o.name,arguments.length===2&&(s=arguments[1],a=!0)):(t=o,r=arguments[1],i=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),t=""+t,r=""+r,Wr(i)||(i=""+i);var n=Yi(this._isDirected,t,r,i);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,n))return a&&(this._edgeLabels[n]=s),this;if(!Wr(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[n]=a?s:this._defaultEdgeLabelFn(t,r,i);var l=ev(this._isDirected,t,r,i);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[n]=l,Xc(this._preds[r],t),Xc(this._sucs[t],r),this._in[r][n]=l,this._out[t][n]=l,this._edgeCount++,this}edge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return this._edgeLabels[s]}hasEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return Object.prototype.hasOwnProperty.call(this._edgeLabels,s)}removeEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i),a=this._edgeObjs[s];return a&&(t=a.v,r=a.w,delete this._edgeLabels[s],delete this._edgeObjs[s],Vc(this._preds[r],t),Vc(this._sucs[t],r),delete this._in[r][s],delete this._out[t][s],this._edgeCount--),this}inEdges(t,r){var i=this._in[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.v===r}):s}}outEdges(t,r){var i=this._out[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.w===r}):s}}nodeEdges(t,r){var i=this.inEdges(t,r);if(i)return i.concat(this.outEdges(t,r))}}qa.prototype._nodeCount=0;qa.prototype._edgeCount=0;function Xc(e,t){e[t]?e[t]++:e[t]=1}function Vc(e,t){--e[t]||delete e[t]}function Yi(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}return s+Gc+a+Gc+(Wr(i)?tv:i)}function ev(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}var n={v:s,w:a};return i&&(n.name=i),n}function ho(e,t){return Yi(e,t.v,t.w,t.name)}function Wp(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),s=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),o=r.insert("g").attr("class","nodes");return{clusters:i,edgePaths:s,edgeLabels:a,nodes:o,rootGroups:r}}g(Wp,"createLayoutElementGroups");async function zp(e,t){if(t.label){const{shapeSvg:r,bbox:i}=await mt(e,t);t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}g(zp,"measureGroupLabel");async function Hp(e,t,r){var a;const i=await ml(e,t,r),s=((a=i.node())==null?void 0:a.getBBox())??{width:0,height:0};return t.width=s.width,t.height=s.height,i}g(Hp,"insertMeasuredNode");async function Yp(e,t){const r=new qa({multigraph:!0,compound:!0}),i=[...t.edges],s=Et(),a=Wp(e),{edgeLabels:o,nodes:n}=a,l=new Map,c=e.node()!=null;await Promise.all(t.nodes.map(async h=>{if(h.isGroup)c&&await zp(n,h),r.setNode(h.id,{...h});else{if(c){const u=await Hp(n,h,{config:s,dir:h.dir});l.set(h.id,u)}r.setNode(h.id,{...h})}}));for(const h of i)c&&pp(h)&&await xl(o,h),r.setEdge(h.start,h.end,{...h},h.id),t.edges.some(d=>d.id===h.id)||t.edges.push(h);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:h}=await Mt(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-INFHLROL-CKc8uScH.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3]));h(e,t)}return{graph:r,groups:a,nodeElements:l}}g(Yp,"createGraphWithElements");var Dt=new Map,yr=new Map,jp=new Map,rv=g(()=>{yr.clear(),jp.clear(),Dt.clear()},"clear"),os=g((e,t)=>{const r=yr.get(t)||[];return I.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),iv=g((e,t)=>{const r=yr.get(t)||[];return I.info("Descendants of ",t," is ",r),I.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||os(e.v,t)||os(e.w,t)||r.includes(e.w):(I.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),Up=g((e,t,r,i)=>{I.debug("Copying children of ",e,"root",i,"data",t.node(e),i);const s=t.children(e)||[];e!==i&&s.push(e),I.debug("Copying (nodes) clusterId",e,"nodes",s),s.forEach(a=>{if(t.children(a).length>0)Up(a,t,r,i);else{const o=t.node(a);I.info("cp ",a," to ",i," with parent ",e),r.setNode(a,o),i!==t.parent(a)&&(I.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(I.debug("Setting parent",a,e),r.setParent(a,e)):(I.info("In copy ",e,"root",i,"data",t.node(e),i),I.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==i,"node!==clusterId",a!==e));const n=t.edges(a);I.debug("Copying Edges",n),n.forEach(l=>{I.info("Edge",l);const c=t.edge(l.v,l.w,l.name);I.info("Edge data",c,i);try{iv(l,i)?(I.info("Copying as ",l.v,l.w,c,l.name),r.setEdge(l.v,l.w,c,l.name),I.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):I.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",i," clusterId:",e)}catch(h){I.error(h)}})}I.debug("Removing node",a),t.removeNode(a)})},"copy"),Gp=g((e,t)=>{const r=t.children(e);let i=[...r];for(const s of r)jp.set(s,e),i=[...i,...Gp(s,t)];return i},"extractDescendants"),sv=g((e,t,r)=>{const i=e.edges().filter(l=>l.v===t||l.w===t),s=e.edges().filter(l=>l.v===r||l.w===r),a=i.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),o=s.map(l=>({v:l.v,w:l.w}));return a.filter(l=>o.some(c=>l.v===c.v&&l.w===c.w))},"findCommonEdges"),ma=g((e,t,r)=>{const i=t.children(e);if(I.trace("Searching children of id ",e,i),i.length<1)return e;let s;for(const a of i){const o=ma(a,t,r),n=sv(t,r,o);if(o)if(n.length>0)s=o;else return o}return s},"findNonClusterChild"),Zc=g(e=>!Dt.has(e)||!Dt.get(e).externalConnections?e:Dt.has(e)?Dt.get(e).id:e,"getAnchorId"),wM=g((e,t)=>{var r;if(!e||t>10){I.debug("Opting out, no graph ");return}else I.debug("Opting in, graph ");e.nodes().forEach(function(i){e.children(i).length>0&&(I.debug("Cluster identified",i," Replacement id in edges: ",ma(i,e,i)),yr.set(i,Gp(i,e)),Dt.set(i,{id:ma(i,e,i),clusterData:e.node(i)}))}),e.nodes().forEach(function(i){const s=e.children(i),a=e.edges();s.length>0?(I.debug("Cluster identified",i,yr),a.forEach(o=>{const n=os(o.v,i),l=os(o.w,i);n^l&&(I.debug("Edge: ",o," leaves cluster ",i),I.debug("Descendants of XXX ",i,": ",yr.get(i)),Dt.get(i).externalConnections=!0)})):I.debug("Not a cluster ",i,yr)});for(let i of Dt.keys()){const s=Dt.get(i).id,a=e.parent(s);a!==i&&Dt.has(a)&&!Dt.get(a).externalConnections&&(Dt.get(i).id=a);const o=e.edges().some(n=>n.v===i);if(s&&((r=Dt.get(i))!=null&&r.externalConnections)&&o&&Zp(e,s,i)){const n=av(e,i,e.parent(s));n&&(Dt.get(i).id=n)}}e.edges().forEach(function(i){const s=e.edge(i);I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(i)),I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(e.edge(i)));let a=i.v,o=i.w;if(I.debug("Fix XXX",Dt,"ids:",i.v,i.w,"Translating: ",Dt.get(i.v)," --- ",Dt.get(i.w)),Dt.get(i.v)||Dt.get(i.w)){if(I.debug("Fixing and trying - removing XXX",i.v,i.w,i.name),a=Zc(i.v),o=Zc(i.w),e.removeEdge(i.v,i.w,i.name),a!==i.v){const n=e.parent(a);Dt.get(n).externalConnections=!0,s.fromCluster=i.v}if(o!==i.w){const n=e.parent(o);Dt.get(n).externalConnections=!0,s.toCluster=i.w}I.debug("Fix Replacing with XXX",a,o,i.name),e.setEdge(a,o,s,i.name)}}),Xp(e,0),I.trace(Dt)},"adjustClustersAndEdges"),Xp=g((e,t)=>{var s,a;if(t>10){I.error("Bailing out");return}let r=e.nodes(),i=!1;for(const o of r){const n=e.children(o);i=i||n.length>0}if(!i){I.debug("Done, no node has children",e.nodes());return}I.debug("Nodes = ",r,t);for(const o of r)if(I.debug("Extracting node",o,Dt,Dt.has(o)&&!Dt.get(o).externalConnections,!e.parent(o),e.node(o),e.children("D")," Depth ",t),!Dt.has(o))I.debug("Not a cluster",o,t);else if(!Dt.get(o).externalConnections&&e.children(o)&&e.children(o).length>0){I.debug("Cluster without external connections, without a parent and with children",o,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(s=Dt.get(o))==null?void 0:s.clusterData)!=null&&a.dir&&(l=Dt.get(o).clusterData.dir,I.debug("Fixing dir",Dt.get(o).clusterData.dir,l));const c=new qa({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});Up(o,e,c,o),e.setNode(o,{clusterNode:!0,id:o,clusterData:Dt.get(o).clusterData,label:Dt.get(o).label,graph:c})}else I.debug("Cluster ** ",o," **not meeting the criteria !externalConnections:",!Dt.get(o).externalConnections," no parent: ",!e.parent(o)," children ",e.children(o)&&e.children(o).length>0,e.children("D"),t),I.debug(Dt);r=e.nodes(),I.debug("New list of nodes",r);for(const o of r){const n=e.node(o);I.debug(" Now next level",o,n),n!=null&&n.clusterNode&&Xp(n.graph,t+1)}},"extractor"),Vp=g((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(i=>{const s=e.children(i),a=Vp(e,s);r=[...r,...a]}),r},"sorter"),SM=g(e=>Vp(e,e.children()),"sortNodesByHierarchy"),Zp=g((e,t,r)=>{let i=e.parent(t);for(;i&&i!==r;){const s=Dt.get(i);if(s&&!s.externalConnections)return!0;i=e.parent(i)}return!1},"isNodeInExtractableCluster"),av=g((e,t,r)=>{const i=e.children(t)??[];for(const s of i){if(s===r||os(s,r))continue;const a=ma(s,e,t);if(a&&!Zp(e,a,t))return a}return null},"findSafeAnchorNode");function Kp({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:i,afterPaint:s,paintOptions:a}){const o=t??Fl;return g(async function(l,c,h,u){const d=c.select("g");((h==null?void 0:h.insertMarkers)??bp)(d,l.markers,l.type,l.diagramId),Ll();const f={element:d,helpers:h,options:u};f.preparedLayout=await(e==null?void 0:e(l,f));const y=await o(l,f),m=await r(l,f),C={...f,measure:y};i?await i(l,C,m):await Ml(l,C,a),await(s==null?void 0:s(l,C,m))},"render")}g(Kp,"createCommonLayoutRenderer");function Ll(){Sw(),Iw(),Aw(),rv()}g(Ll,"clearLayoutRenderState");async function Fl(e,{element:t}){return await Yp(t,e)}g(Fl,"defaultMeasureLayout");async function Ml(e,t,r={}){var o,n;const{measure:i}=t,{groups:s}=i;for(const l of((o=r.getNodes)==null?void 0:o.call(r,e,t))??e.nodes)(n=r.skipNode)!=null&&n.call(r,l,t)||await Qp(s,l,t,r);const a=ty(e.nodes);for(const l of e.edges)ey(l,r)||await ry(s,l,a,e,r,t)}g(Ml,"paintLayoutData");async function Qp(e,t,r,i){t.clusterNode?mc(t):Jp(t,r,i)?await gp(e.clusters,t):mc(t)}g(Qp,"paintLayoutNode");function Jp(e,t,r){var i;return e.isGroup===!0&&(((i=r.isCluster)==null?void 0:i.call(r,e,t))??!0)}g(Jp,"shouldPaintAsCluster");function ty(e){const t=new Map;for(const r of e)r!=null&&r.id&&t.set(r.id,r);return t}g(ty,"buildNodeLookup");function ey(e,t){var r;return e.isLayoutOnly||!!((r=t.skipEdge)!=null&&r.call(t,e))}g(ey,"shouldSkipPaintEdge");async function ry(e,t,r,i,s,a){const o=mp(e.edgePaths,{...t},s.clusterDb??new Map,i.type,mn(t.start,t,r,a,s),mn(t.end,t,r,a,s),i.diagramId,iy(t,s));pp(t)&&(di.has(t.id)||await xl(e.edgeLabels,t),sy(t,o))}g(ry,"paintLayoutEdge");function mn(e,t,r,i,s){var a;return((a=s.getEdgeNode)==null?void 0:a.call(s,e,t,i))??(e?r.get(e)??{}:{})}g(mn,"getRenderedNode");function iy(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}g(iy,"shouldSkipIntersect");function sy(e,t){const r=(t==null?void 0:t.updatedPath)??(t==null?void 0:t.originalPath),i=Yt(),{subGraphTitleTotalMargin:s}=Aa({flowchart:i.flowchart??{}});if(e.label){const a=di.get(e.id);let o=e.x,n=e.y;if(r){const l=re.calcLabelPosition(r);I.debug("Moving label "+e.label+" from (",o,",",n,") to (",l.x,",",l.y,") abc88"),t!=null&&t.updatedPath&&(o=l.x,n=l.y)}a.attr("transform",`translate(${o}, ${n+s/2})`)}if(e!=null&&e.startLabelLeft){const a=Ut.get(e.id).startLeft;let o=e==null?void 0:e.x,n=e==null?void 0:e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.startLabelRight){const a=Ut.get(e.id).startRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelLeft){const a=Ut.get(e.id).endLeft;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelRight){const a=Ut.get(e.id).endRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}}g(sy,"positionRenderedEdgeLabel");function ay(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}g(ay,"getDefaultExportFromCjs");var Jt={},Ms={},Je={},Kc;function xi(){if(Kc)return Je;Kc=1;function e(o){return typeof o>"u"||o===null}g(e,"isNothing");function t(o){return typeof o=="object"&&o!==null}g(t,"isObject");function r(o){return Array.isArray(o)?o:e(o)?[]:[o]}g(r,"toArray");function i(o,n){if(n){const l=Object.keys(n);for(let c=0,h=l.length;c{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),dS=g((e,t,r)=>{const i=Yt(),{themeVariables:s}=i,{strokeWidth:a}=s,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),fS={extension:jw,composition:Uw,aggregation:Gw,dependency:Xw,lollipop:Vw,point:Zw,circle:Kw,cross:Qw,barb:Jw,barbNeo:tS,only_one:eS,zero_or_one:rS,one_or_more:iS,zero_or_more:sS,only_one_neo:aS,zero_or_one_neo:oS,one_or_more_neo:nS,zero_or_more_neo:lS,requirement_arrow:hS,requirement_contains:uS,requirement_arrow_neo:cS,requirement_contains_neo:dS},bp=Yw,kp=typeof global=="object"&&global&&global.Object===Object&&global,gS=typeof self=="object"&&self&&self.Object===Object&&self,Ze=kp||gS||Function("return this")(),De=Ze.Symbol,wp=Object.prototype,pS=wp.hasOwnProperty,yS=wp.toString,Oi=De?De.toStringTag:void 0;function mS(e){var t=pS.call(e,Oi),r=e[Oi];try{e[Oi]=void 0;var i=!0}catch{}var s=yS.call(e);return i&&(t?e[Oi]=r:delete e[Oi]),s}var xS=Object.prototype,CS=xS.toString;function bS(e){return CS.call(e)}var kS="[object Null]",wS="[object Undefined]",wc=De?De.toStringTag:void 0;function mi(e){return e==null?e===void 0?wS:kS:wc&&wc in Object(e)?mS(e):bS(e)}function Tr(e){return e!=null&&typeof e=="object"}var SS="[object Symbol]";function Cl(e){return typeof e=="symbol"||Tr(e)&&mi(e)==SS}function Sp(e,t){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r0){if(++t>=zS)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Hi(e){return function(){return e}}var Bc=(function(){try{var e=Mr(Object,"defineProperty");return e({},"",{}),e}catch{}})(),US=Bc?function(e,t){return Bc(e,"toString",{configurable:!0,enumerable:!1,value:Hi(t),writable:!0})}:$a,GS=jS(US);function XS(e,t){for(var r=-1,i=e==null?0:e.length;++r-1}var tT=9007199254740991,eT=/^(?:0|[1-9]\d*)$/;function _p(e,t){var r=typeof e;return t=t??tT,!!t&&(r=="number"||r!="symbol"&&eT.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=sT}function Oa(e){return e!=null&&kl(e.length)&&!pa(e)}var aT=Object.prototype;function vp(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||aT;return e===r}function oT(e,t){for(var r=-1,i=Array(e);++r-1}function d_(e,t){var r=this.__data__,i=Pa(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function Ke(e){var t=-1,r=e==null?0:e.length;for(this.clear();++tn))return!1;var c=a.get(e),h=a.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,f=r&Q_?new as:void 0;for(a.set(e,t),a.set(t,e);++u=KB){var c=ZB(e);if(c)return _l(c);o=!1,s=Pp,l=new as}else l=n;t:for(;++i1?s.setNode(a,r):s.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=ur,this._children[t]={},this._children[ur][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],cr(this.children(t),i=>{this.setParent(i)}),delete this._children[t]),cr(Ae(this._in[t]),r),delete this._in[t],delete this._preds[t],cr(Ae(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Wr(r))r=ur;else{r+="";for(var i=r;!Wr(i);i=this.parent(i))if(i===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==ur)return r}}children(t){if(Wr(t)&&(t=ur),this._isCompound){var r=this._children[t];if(r)return Ae(r)}else{if(t===ur)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return Ae(r)}successors(t){var r=this._sucs[t];if(r)return Ae(r)}neighbors(t){var r=this.predecessors(t);if(r)return JB(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var i=this;cr(this._nodes,function(o,n){t(n)&&r.setNode(n,o)}),cr(this._edgeObjs,function(o){r.hasNode(o.v)&&r.hasNode(o.w)&&r.setEdge(o,i.edge(o))});var s={};function a(o){var n=i.parent(o);return n===void 0||r.hasNode(n)?(s[o]=n,n):n in s?s[n]:a(n)}return this._isCompound&&cr(r.nodes(),function(o){r.setParent(o,a(o))}),r}setDefaultEdgeLabel(t){return pa(t)||(t=Hi(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return lo(this._edgeObjs)}setPath(t,r){var i=this,s=arguments;return XB(t,function(a,o){return s.length>1?i.setEdge(a,o,r):i.setEdge(a,o),o}),this}setEdge(){var t,r,i,s,a=!1,o=arguments[0];typeof o=="object"&&o!==null&&"v"in o?(t=o.v,r=o.w,i=o.name,arguments.length===2&&(s=arguments[1],a=!0)):(t=o,r=arguments[1],i=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),t=""+t,r=""+r,Wr(i)||(i=""+i);var n=Yi(this._isDirected,t,r,i);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,n))return a&&(this._edgeLabels[n]=s),this;if(!Wr(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[n]=a?s:this._defaultEdgeLabelFn(t,r,i);var l=ev(this._isDirected,t,r,i);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[n]=l,Xc(this._preds[r],t),Xc(this._sucs[t],r),this._in[r][n]=l,this._out[t][n]=l,this._edgeCount++,this}edge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return this._edgeLabels[s]}hasEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i);return Object.prototype.hasOwnProperty.call(this._edgeLabels,s)}removeEdge(t,r,i){var s=arguments.length===1?ho(this._isDirected,arguments[0]):Yi(this._isDirected,t,r,i),a=this._edgeObjs[s];return a&&(t=a.v,r=a.w,delete this._edgeLabels[s],delete this._edgeObjs[s],Vc(this._preds[r],t),Vc(this._sucs[t],r),delete this._in[r][s],delete this._out[t][s],this._edgeCount--),this}inEdges(t,r){var i=this._in[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.v===r}):s}}outEdges(t,r){var i=this._out[t];if(i){var s=lo(i);return r?Fs(s,function(a){return a.w===r}):s}}nodeEdges(t,r){var i=this.inEdges(t,r);if(i)return i.concat(this.outEdges(t,r))}}qa.prototype._nodeCount=0;qa.prototype._edgeCount=0;function Xc(e,t){e[t]?e[t]++:e[t]=1}function Vc(e,t){--e[t]||delete e[t]}function Yi(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}return s+Gc+a+Gc+(Wr(i)?tv:i)}function ev(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var o=s;s=a,a=o}var n={v:s,w:a};return i&&(n.name=i),n}function ho(e,t){return Yi(e,t.v,t.w,t.name)}function Wp(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),s=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),o=r.insert("g").attr("class","nodes");return{clusters:i,edgePaths:s,edgeLabels:a,nodes:o,rootGroups:r}}g(Wp,"createLayoutElementGroups");async function zp(e,t){if(t.label){const{shapeSvg:r,bbox:i}=await mt(e,t);t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}g(zp,"measureGroupLabel");async function Hp(e,t,r){var a;const i=await ml(e,t,r),s=((a=i.node())==null?void 0:a.getBBox())??{width:0,height:0};return t.width=s.width,t.height=s.height,i}g(Hp,"insertMeasuredNode");async function Yp(e,t){const r=new qa({multigraph:!0,compound:!0}),i=[...t.edges],s=Et(),a=Wp(e),{edgeLabels:o,nodes:n}=a,l=new Map,c=e.node()!=null;await Promise.all(t.nodes.map(async h=>{if(h.isGroup)c&&await zp(n,h),r.setNode(h.id,{...h});else{if(c){const u=await Hp(n,h,{config:s,dir:h.dir});l.set(h.id,u)}r.setNode(h.id,{...h})}}));for(const h of i)c&&pp(h)&&await xl(o,h),r.setEdge(h.start,h.end,{...h},h.id),t.edges.some(d=>d.id===h.id)||t.edges.push(h);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:h}=await Mt(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-INFHLROL-Bt4UpecU.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3]));h(e,t)}return{graph:r,groups:a,nodeElements:l}}g(Yp,"createGraphWithElements");var Dt=new Map,yr=new Map,jp=new Map,rv=g(()=>{yr.clear(),jp.clear(),Dt.clear()},"clear"),os=g((e,t)=>{const r=yr.get(t)||[];return I.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),iv=g((e,t)=>{const r=yr.get(t)||[];return I.info("Descendants of ",t," is ",r),I.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||os(e.v,t)||os(e.w,t)||r.includes(e.w):(I.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),Up=g((e,t,r,i)=>{I.debug("Copying children of ",e,"root",i,"data",t.node(e),i);const s=t.children(e)||[];e!==i&&s.push(e),I.debug("Copying (nodes) clusterId",e,"nodes",s),s.forEach(a=>{if(t.children(a).length>0)Up(a,t,r,i);else{const o=t.node(a);I.info("cp ",a," to ",i," with parent ",e),r.setNode(a,o),i!==t.parent(a)&&(I.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(I.debug("Setting parent",a,e),r.setParent(a,e)):(I.info("In copy ",e,"root",i,"data",t.node(e),i),I.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==i,"node!==clusterId",a!==e));const n=t.edges(a);I.debug("Copying Edges",n),n.forEach(l=>{I.info("Edge",l);const c=t.edge(l.v,l.w,l.name);I.info("Edge data",c,i);try{iv(l,i)?(I.info("Copying as ",l.v,l.w,c,l.name),r.setEdge(l.v,l.w,c,l.name),I.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):I.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",i," clusterId:",e)}catch(h){I.error(h)}})}I.debug("Removing node",a),t.removeNode(a)})},"copy"),Gp=g((e,t)=>{const r=t.children(e);let i=[...r];for(const s of r)jp.set(s,e),i=[...i,...Gp(s,t)];return i},"extractDescendants"),sv=g((e,t,r)=>{const i=e.edges().filter(l=>l.v===t||l.w===t),s=e.edges().filter(l=>l.v===r||l.w===r),a=i.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),o=s.map(l=>({v:l.v,w:l.w}));return a.filter(l=>o.some(c=>l.v===c.v&&l.w===c.w))},"findCommonEdges"),ma=g((e,t,r)=>{const i=t.children(e);if(I.trace("Searching children of id ",e,i),i.length<1)return e;let s;for(const a of i){const o=ma(a,t,r),n=sv(t,r,o);if(o)if(n.length>0)s=o;else return o}return s},"findNonClusterChild"),Zc=g(e=>!Dt.has(e)||!Dt.get(e).externalConnections?e:Dt.has(e)?Dt.get(e).id:e,"getAnchorId"),wM=g((e,t)=>{var r;if(!e||t>10){I.debug("Opting out, no graph ");return}else I.debug("Opting in, graph ");e.nodes().forEach(function(i){e.children(i).length>0&&(I.debug("Cluster identified",i," Replacement id in edges: ",ma(i,e,i)),yr.set(i,Gp(i,e)),Dt.set(i,{id:ma(i,e,i),clusterData:e.node(i)}))}),e.nodes().forEach(function(i){const s=e.children(i),a=e.edges();s.length>0?(I.debug("Cluster identified",i,yr),a.forEach(o=>{const n=os(o.v,i),l=os(o.w,i);n^l&&(I.debug("Edge: ",o," leaves cluster ",i),I.debug("Descendants of XXX ",i,": ",yr.get(i)),Dt.get(i).externalConnections=!0)})):I.debug("Not a cluster ",i,yr)});for(let i of Dt.keys()){const s=Dt.get(i).id,a=e.parent(s);a!==i&&Dt.has(a)&&!Dt.get(a).externalConnections&&(Dt.get(i).id=a);const o=e.edges().some(n=>n.v===i);if(s&&((r=Dt.get(i))!=null&&r.externalConnections)&&o&&Zp(e,s,i)){const n=av(e,i,e.parent(s));n&&(Dt.get(i).id=n)}}e.edges().forEach(function(i){const s=e.edge(i);I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(i)),I.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(e.edge(i)));let a=i.v,o=i.w;if(I.debug("Fix XXX",Dt,"ids:",i.v,i.w,"Translating: ",Dt.get(i.v)," --- ",Dt.get(i.w)),Dt.get(i.v)||Dt.get(i.w)){if(I.debug("Fixing and trying - removing XXX",i.v,i.w,i.name),a=Zc(i.v),o=Zc(i.w),e.removeEdge(i.v,i.w,i.name),a!==i.v){const n=e.parent(a);Dt.get(n).externalConnections=!0,s.fromCluster=i.v}if(o!==i.w){const n=e.parent(o);Dt.get(n).externalConnections=!0,s.toCluster=i.w}I.debug("Fix Replacing with XXX",a,o,i.name),e.setEdge(a,o,s,i.name)}}),Xp(e,0),I.trace(Dt)},"adjustClustersAndEdges"),Xp=g((e,t)=>{var s,a;if(t>10){I.error("Bailing out");return}let r=e.nodes(),i=!1;for(const o of r){const n=e.children(o);i=i||n.length>0}if(!i){I.debug("Done, no node has children",e.nodes());return}I.debug("Nodes = ",r,t);for(const o of r)if(I.debug("Extracting node",o,Dt,Dt.has(o)&&!Dt.get(o).externalConnections,!e.parent(o),e.node(o),e.children("D")," Depth ",t),!Dt.has(o))I.debug("Not a cluster",o,t);else if(!Dt.get(o).externalConnections&&e.children(o)&&e.children(o).length>0){I.debug("Cluster without external connections, without a parent and with children",o,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(s=Dt.get(o))==null?void 0:s.clusterData)!=null&&a.dir&&(l=Dt.get(o).clusterData.dir,I.debug("Fixing dir",Dt.get(o).clusterData.dir,l));const c=new qa({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});Up(o,e,c,o),e.setNode(o,{clusterNode:!0,id:o,clusterData:Dt.get(o).clusterData,label:Dt.get(o).label,graph:c})}else I.debug("Cluster ** ",o," **not meeting the criteria !externalConnections:",!Dt.get(o).externalConnections," no parent: ",!e.parent(o)," children ",e.children(o)&&e.children(o).length>0,e.children("D"),t),I.debug(Dt);r=e.nodes(),I.debug("New list of nodes",r);for(const o of r){const n=e.node(o);I.debug(" Now next level",o,n),n!=null&&n.clusterNode&&Xp(n.graph,t+1)}},"extractor"),Vp=g((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(i=>{const s=e.children(i),a=Vp(e,s);r=[...r,...a]}),r},"sorter"),SM=g(e=>Vp(e,e.children()),"sortNodesByHierarchy"),Zp=g((e,t,r)=>{let i=e.parent(t);for(;i&&i!==r;){const s=Dt.get(i);if(s&&!s.externalConnections)return!0;i=e.parent(i)}return!1},"isNodeInExtractableCluster"),av=g((e,t,r)=>{const i=e.children(t)??[];for(const s of i){if(s===r||os(s,r))continue;const a=ma(s,e,t);if(a&&!Zp(e,a,t))return a}return null},"findSafeAnchorNode");function Kp({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:i,afterPaint:s,paintOptions:a}){const o=t??Fl;return g(async function(l,c,h,u){const d=c.select("g");((h==null?void 0:h.insertMarkers)??bp)(d,l.markers,l.type,l.diagramId),Ll();const f={element:d,helpers:h,options:u};f.preparedLayout=await(e==null?void 0:e(l,f));const y=await o(l,f),m=await r(l,f),C={...f,measure:y};i?await i(l,C,m):await Ml(l,C,a),await(s==null?void 0:s(l,C,m))},"render")}g(Kp,"createCommonLayoutRenderer");function Ll(){Sw(),Iw(),Aw(),rv()}g(Ll,"clearLayoutRenderState");async function Fl(e,{element:t}){return await Yp(t,e)}g(Fl,"defaultMeasureLayout");async function Ml(e,t,r={}){var o,n;const{measure:i}=t,{groups:s}=i;for(const l of((o=r.getNodes)==null?void 0:o.call(r,e,t))??e.nodes)(n=r.skipNode)!=null&&n.call(r,l,t)||await Qp(s,l,t,r);const a=ty(e.nodes);for(const l of e.edges)ey(l,r)||await ry(s,l,a,e,r,t)}g(Ml,"paintLayoutData");async function Qp(e,t,r,i){t.clusterNode?mc(t):Jp(t,r,i)?await gp(e.clusters,t):mc(t)}g(Qp,"paintLayoutNode");function Jp(e,t,r){var i;return e.isGroup===!0&&(((i=r.isCluster)==null?void 0:i.call(r,e,t))??!0)}g(Jp,"shouldPaintAsCluster");function ty(e){const t=new Map;for(const r of e)r!=null&&r.id&&t.set(r.id,r);return t}g(ty,"buildNodeLookup");function ey(e,t){var r;return e.isLayoutOnly||!!((r=t.skipEdge)!=null&&r.call(t,e))}g(ey,"shouldSkipPaintEdge");async function ry(e,t,r,i,s,a){const o=mp(e.edgePaths,{...t},s.clusterDb??new Map,i.type,mn(t.start,t,r,a,s),mn(t.end,t,r,a,s),i.diagramId,iy(t,s));pp(t)&&(di.has(t.id)||await xl(e.edgeLabels,t),sy(t,o))}g(ry,"paintLayoutEdge");function mn(e,t,r,i,s){var a;return((a=s.getEdgeNode)==null?void 0:a.call(s,e,t,i))??(e?r.get(e)??{}:{})}g(mn,"getRenderedNode");function iy(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}g(iy,"shouldSkipIntersect");function sy(e,t){const r=(t==null?void 0:t.updatedPath)??(t==null?void 0:t.originalPath),i=Yt(),{subGraphTitleTotalMargin:s}=Aa({flowchart:i.flowchart??{}});if(e.label){const a=di.get(e.id);let o=e.x,n=e.y;if(r){const l=re.calcLabelPosition(r);I.debug("Moving label "+e.label+" from (",o,",",n,") to (",l.x,",",l.y,") abc88"),t!=null&&t.updatedPath&&(o=l.x,n=l.y)}a.attr("transform",`translate(${o}, ${n+s/2})`)}if(e!=null&&e.startLabelLeft){const a=Ut.get(e.id).startLeft;let o=e==null?void 0:e.x,n=e==null?void 0:e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.startLabelRight){const a=Ut.get(e.id).startRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelLeft){const a=Ut.get(e.id).endLeft;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelRight){const a=Ut.get(e.id).endRight;let o=e.x,n=e.y;if(r){const l=re.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);o=l.x,n=l.y}a.attr("transform",`translate(${o}, ${n})`)}}g(sy,"positionRenderedEdgeLabel");function ay(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}g(ay,"getDefaultExportFromCjs");var Jt={},Ms={},Je={},Kc;function xi(){if(Kc)return Je;Kc=1;function e(o){return typeof o>"u"||o===null}g(e,"isNothing");function t(o){return typeof o=="object"&&o!==null}g(t,"isObject");function r(o){return Array.isArray(o)?o:e(o)?[]:[o]}g(r,"toArray");function i(o,n){if(n){const l=Object.keys(n);for(let c=0,h=l.length;cu&&(c=" ... ",a=n-u+c.length),o-n>u&&(h=" ...",o=n+u-h.length),{str:c+s.slice(a,o).replace(/\t/g,"→")+h,pos:n-a+c.length}}g(t,"getLine");function r(s,a){return e.repeat(" ",a-s.length)+s}g(r,"padStart");function i(s,a){if(a=Object.create(a||null),!s.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);const o=/\r?\n|\r|\0/g,n=[0],l=[];let c,h=-1;for(;c=o.exec(s.buffer);)l.push(c.index),n.push(c.index+c[0].length),s.position<=c.index&&h<0&&(h=n.length-2);h<0&&(h=n.length-1);let u="";const d=Math.min(s.line+a.linesAfter,l.length).toString().length,f=a.maxLength-(a.indent+d+3);for(let m=1;m<=a.linesBefore&&!(h-m<0);m++){const C=t(s.buffer,n[h-m],l[h-m],s.position-(n[h]-n[h-m]),f);u=e.repeat(" ",a.indent)+r((s.line-m+1).toString(),d)+" | "+C.str+` `+u}const y=t(s.buffer,n[h],l[h],s.position,f);u+=e.repeat(" ",a.indent)+r((s.line+1).toString(),d)+" | "+y.str+` @@ -296,8 +296,8 @@ ${a.join(` `+S.slice(Z,tt),Z=tt+1),Q=ft;return lt+=` `,S.length-Z>P&&Q>Z?lt+=S.slice(Z,Q)+` `+S.slice(Q+1):lt+=S.slice(Z),lt.slice(1)}g(xe,"foldLine");function Si(S){let P="",J=0;for(let X=0;X=65536?X+=2:X++){J=ut(S,X);const Z=A[J];!Z&&_t(J)?(P+=S[X],J>=65536&&(P+=S[X+1])):P+=Z||$(J)}return P}g(Si,"escapeString");function $r(S,P,J){let X="";const Z=S.tag;for(let tt=0,Q=J.length;tt"u"&&G(S,P,null,!1,!1))&&(X!==""&&(X+=","+(S.condenseFlow?"":" ")),X+=S.dump)}S.tag=Z,S.dump="["+X+"]"}g($r,"writeFlowSequence");function Or(S,P,J,X){let Z="";const tt=S.tag;for(let Q=0,ft=J.length;Q"u"&&G(S,P+1,null,!0,!0,!1,!0))&&((!X||Z!=="")&&(Z+=gt(S,P)),S.dump&&n===S.dump.charCodeAt(0)?Z+="-":Z+="- ",Z+=S.dump)}S.tag=tt,S.dump=Z||"[]"}g(Or,"writeBlockSequence");function Ti(S,P,J){let X="";const Z=S.tag,tt=Object.keys(J);for(let Q=0,ft=tt.length;Q1024&&(lt+="? "),lt+=S.dump+(S.condenseFlow?'"':"")+":"+(S.condenseFlow?"":" "),G(S,P,kt,!1,!1)&&(lt+=S.dump,X+=lt))}S.tag=Z,S.dump="{"+X+"}"}g(Ti,"writeFlowMapping");function p(S,P,J,X){let Z="";const tt=S.tag,Q=Object.keys(J);if(S.sortKeys===!0)Q.sort();else if(typeof S.sortKeys=="function")Q.sort(S.sortKeys);else if(S.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let ft=0,lt=Q.length;ft1024;Wt&&(S.dump&&n===S.dump.charCodeAt(0)?Ct+="?":Ct+="? "),Ct+=S.dump,Wt&&(Ct+=gt(S,P)),G(S,P+1,Ot,!0,Wt)&&(S.dump&&n===S.dump.charCodeAt(0)?Ct+=":":Ct+=": ",Ct+=S.dump,Z+=Ct)}S.tag=tt,S.dump=Z||"{}"}g(p,"writeBlockMapping");function O(S,P,J){const X=J?S.explicitTypes:S.implicitTypes;for(let Z=0,tt=X.length;Z tag resolver accepts not "'+ft+'" style');S.dump=lt}return!0}}return!1}g(O,"detectType");function G(S,P,J,X,Z,tt,Q){S.tag=null,S.dump=J,O(S,J,!1)||O(S,J,!0);const ft=i.call(S.dump),lt=X;X&&(X=S.flowLevel<0||S.flowLevel>P);const Ct=ft==="[object Object]"||ft==="[object Array]";let kt,Ot;if(Ct&&(kt=S.duplicates.indexOf(J),Ot=kt!==-1),(S.tag!==null&&S.tag!=="?"||Ot||S.indent!==2&&P>0)&&(Z=!1),Ot&&S.usedDuplicates[kt])S.dump="*ref_"+kt;else{if(Ct&&Ot&&!S.usedDuplicates[kt]&&(S.usedDuplicates[kt]=!0),ft==="[object Object]")X&&Object.keys(S.dump).length!==0?(p(S,P,S.dump,Z),Ot&&(S.dump="&ref_"+kt+S.dump)):(Ti(S,P,S.dump),Ot&&(S.dump="&ref_"+kt+" "+S.dump));else if(ft==="[object Array]")X&&S.dump.length!==0?(S.noArrayIndent&&!Q&&P>0?Or(S,P-1,S.dump,Z):Or(S,P,S.dump,Z),Ot&&(S.dump="&ref_"+kt+S.dump)):($r(S,P,S.dump),Ot&&(S.dump="&ref_"+kt+" "+S.dump));else if(ft==="[object String]")S.tag!=="?"&&ki(S,S.dump,P,tt,lt);else{if(ft==="[object Undefined]")return!1;if(S.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+ft)}if(S.tag!==null&&S.tag!=="?"){let Wt=encodeURI(S.tag[0]==="!"?S.tag.slice(1):S.tag).replace(/!/g,"%21");S.tag[0]==="!"?Wt="!"+Wt:Wt.slice(0,18)==="tag:yaml.org,2002:"?Wt="!!"+Wt.slice(18):Wt="!<"+Wt+">",S.dump=Wt+" "+S.dump}}return!0}g(G,"writeNode");function K(S,P){const J=[],X=[];j(S,J,X);const Z=X.length;for(let tt=0;tt{for(const t of e)ns[t.name]=t},"registerLayoutLoaders"),uv=g(()=>{cy([{name:"dagre",loader:g(async()=>await Mt(()=>import("./dagre-GXQ25YYZ-DqSq41IB.js"),__vite__mapDeps([4,5,1,2,3])),"loader")},{name:"swimlane",loader:g(async()=>await Mt(()=>import("./swimlanes-42K2YHIH-1QzInuS-.js"),__vite__mapDeps([6,1,2,3])),"loader")},{name:"cose-bilkent",loader:g(async()=>await Mt(()=>import("./cose-bilkent-JH36ORCC-BYWhn9Rv.js"),__vite__mapDeps([7,8,2,1,3])),"loader")}])},"registerDefaultLayoutLoaders");uv();var PM=g(async(e,t)=>{if(!(e.layoutAlgorithm in ns))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const h of e.nodes){const u=h.domId||h.id;h.domId=`${e.diagramId}-${u}`}const r=ns[e.layoutAlgorithm],i=await r.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:o,gradientStart:n,gradientStop:l}=a,c=t.attr("id");if(t.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),o){const h=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",n).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return i.render(e,t,cv,{algorithm:r.algorithm})},"render"),IM=g((e="",{fallback:t="dagre"}={})=>{if(e in ns)return e;if(t in ns)return I.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Xl="comm",uy="rule",dy="decl",dv="@media",fv="@import",gv="@supports",pv="@namespace",xn="@keyframes",fy="@layer",yv="@scope",mv=Math.abs,Ki=String.fromCharCode;function gy(e){return e.trim()}function Cn(e,t,r){return e.replace(t,r)}function Ur(e,t){return e.charCodeAt(t)|0}function fi(e,t,r){return e.slice(t,r)}function Me(e){return e.length}function py(e){return e.length}function As(e,t){return t.push(e),e}var Wa=1,gi=1,yy=0,pe=0,Gt=0,bi="";function Vl(e,t,r,i,s,a,o,n){return{value:e,root:t,parent:r,type:i,props:s,children:a,line:Wa,column:gi,length:o,return:"",siblings:n}}function xv(){return Gt}function Cv(){return Gt=pe>0?Ur(bi,--pe):0,gi--,Gt===10&&(gi=1,Wa--),Gt}function Se(){return Gt=pe2||ls(Gt)>3?"":" "}function Sv(e,t){for(;--t&&Se()&&!(Gt<48||Gt>102||Gt>57&&Gt<65||Gt>70&&Gt<97););return za(e,Ys()+(t<6&&ir()==32&&Se()==32))}function bn(e){for(;Se();)switch(Gt){case e:return pe;case 34:case 39:e!==34&&e!==39&&bn(Gt);break;case 40:e===41&&bn(e);break;case 92:Se();break}return pe}function Tv(e,t){for(;Se()&&e+Gt!==57;)if(e+Gt===84&&ir()===47)break;return"/*"+za(t,pe-1)+"*"+Ki(e===47?e:Se())}function _v(e){for(;!ls(ir());)Se();return za(e,pe)}function Bv(e){return kv(js("",null,null,null,[""],e=bv(e),0,[0],e))}function js(e,t,r,i,s,a,o,n,l){for(var c=0,h=0,u=o,d=0,f=0,y=0,m=1,C=1,x=1,k=0,w=0,T="",_=s,v=a,F=i,L=T;C;)switch(y=w,w=Se()){case 40:y!=108&&Ur(L,u-1)==58?(k++,L+="("):L+=$o(w);break;case 41:k--,L+=")";break;case 34:case 39:case 91:L+=$o(w);break;case 9:case 10:case 13:case 32:if(k>0){L+=Ki(w);break}L+=wv(y);break;case 92:L+=Sv(Ys()-1,7);continue;case 47:switch(ir()){case 42:case 47:As(vv(Tv(Se(),Ys()),t,r,l),l),(ls(y||1)==5||ls(ir()||1)==5)&&Me(L)&&fi(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*m:n[c++]=Me(L)*x;case 125*m:case 59:case 0:if(k>0&&w){L+=Ki(w);break}switch(w){case 0:case 125:C=0;case 59+h:x==-1&&(L=Cn(L,/\f/g,"")),f>0&&(Me(L)-u||m===0)&&As(f>32?Su(L+";",i,r,u-1,l):Su(Cn(L," ","")+";",i,r,u-2,l),l);break;case 59:L+=";";default:if(As(F=wu(L,t,r,c,h,s,n,T,_=[],v=[],u,a),a),w===123)if(h===0)js(L,t,F,F,_,a,u,n,v);else{switch(d){case 99:if(Ur(L,3)===110)break;case 108:if(Ur(L,2)===97)break;default:h=0;case 100:case 109:case 115:}h?js(e,F,F,i&&As(wu(e,F,F,0,0,s,n,T,s,_=[],u,v),v),s,v,u,n,i?_:v):js(L,F,F,F,[""],v,0,n,v)}}c=h=f=0,m=x=1,T=L="",u=o;break;case 58:u=1+Me(L),f=y;default:if(m<1){if(w==123)--m;else if(w==125&&m++==0&&Cv()==125)continue}switch(L+=Ki(w),w*m){case 38:x=h>0?1:(L+="\f",-1);break;case 44:if(k>0)break;n[c++]=(Me(L)-1)*x,x=1;break;case 64:ir()===45&&(L+=$o(Se())),d=ir(),h=u=Me(T=L+=_v(Ys())),w++;break;case 45:y===45&&Me(L)==2&&(m=0)}}return a}function wu(e,t,r,i,s,a,o,n,l,c,h,u){for(var d=s-1,f=s===0?a:[""],y=py(f),m=0,C=0,x=0;m0?f[k]+" "+w:Cn(w,/&\f/g,f[k])))&&(l[x++]=T);return Vl(e,t,r,s===0?uy:n,l,c,h,u)}function vv(e,t,r,i){return Vl(e,t,r,Xl,Ki(xv()),fi(e,2,-2),0,i)}function Su(e,t,r,i,s){return Vl(e,t,r,dy,fi(e,0,i),fi(e,i+1,-1),i,s)}function kn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Av=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-DdetwEv8.js");return{diagram:t}},__vite__mapDeps([9,10,1,2,3]));return{id:my,diagram:e}},"loader"),Ev={id:my,detector:Mv,loader:Av},$v=Ev,xy="flowchart",Ov=g((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),Dv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-Bfis7KwQ.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:xy,diagram:e}},"loader"),Pv={id:xy,detector:Ov,loader:Dv},Iv=Pv,Cy="flowchart-v2",Rv=g((e,t)=>{var r,i,s;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((s=t==null?void 0:t.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),qv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-Bfis7KwQ.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Cy,diagram:e}},"loader"),Nv={id:Cy,detector:Rv,loader:qv},Wv=Nv,by="swimlane",zv=g(e=>/^\s*swimlane-beta\b/.test(e),"detector"),Hv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-CLgWPzHj.js");return{diagram:t}},__vite__mapDeps([16,11,12,13,14,10,1,2,3,15]));return{id:by,diagram:e}},"loader"),Yv={id:by,detector:zv,loader:Hv},jv=Yv,ky="er",Uv=g(e=>/^\s*erDiagram/.test(e),"detector"),Gv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-DV4h776D.js");return{diagram:t}},__vite__mapDeps([17,13,14,15,1,2,3]));return{id:ky,diagram:e}},"loader"),Xv={id:ky,detector:Uv,loader:Gv},Vv=Xv,wy="gitGraph",Zv=g(e=>/^\s*gitGraph/.test(e),"detector"),Kv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-BkBjc4gg.js");return{diagram:t}},__vite__mapDeps([18,19,20,21,1,2,3]));return{id:wy,diagram:e}},"loader"),Qv={id:wy,detector:Zv,loader:Kv},Jv=Qv,Sy="gantt",tL=g(e=>/^\s*gantt/.test(e),"detector"),eL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-BU9eWm2s.js");return{diagram:t}},__vite__mapDeps([22,2,23,24,25,1,3]));return{id:Sy,diagram:e}},"loader"),rL={id:Sy,detector:tL,loader:eL},iL=rL,Ty="info",sL=g(e=>/^\s*info/.test(e),"detector"),aL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-D1rVSJoO.js");return{diagram:t}},__vite__mapDeps([26,21,1,2,3]));return{id:Ty,diagram:e}},"loader"),oL={id:Ty,detector:sL,loader:aL},_y="pie",nL=g(e=>/^\s*pie/.test(e),"detector"),lL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-DYkXhOYb.js");return{diagram:t}},__vite__mapDeps([27,20,21,1,2,3,28,29,24]));return{id:_y,diagram:e}},"loader"),hL={id:_y,detector:nL,loader:lL},By="quadrantChart",cL=g(e=>/^\s*quadrantChart/.test(e),"detector"),uL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-DHRSmvLk.js");return{diagram:t}},__vite__mapDeps([30,23,24,25,1,2,3]));return{id:By,diagram:e}},"loader"),dL={id:By,detector:cL,loader:uL},fL=dL,vy="xychart",gL=g(e=>/^\s*xychart(-beta)?/.test(e),"detector"),pL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-DF_x_q58.js");return{diagram:t}},__vite__mapDeps([31,24,29,23,25,1,2,3]));return{id:vy,diagram:e}},"loader"),yL={id:vy,detector:gL,loader:pL},mL=yL,Ly="requirement",xL=g(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),CL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-DEA-5bvx.js");return{diagram:t}},__vite__mapDeps([32,13,14,1,2,3]));return{id:Ly,diagram:e}},"loader"),bL={id:Ly,detector:xL,loader:CL},kL=bL,Fy="sequence",wL=g(e=>/^\s*sequenceDiagram/.test(e),"detector"),SL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js");return{diagram:t}},__vite__mapDeps([33,19,10,1,2,3]));return{id:Fy,diagram:e}},"loader"),TL={id:Fy,detector:wL,loader:SL},_L=TL,My="class",BL=g((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),vL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-D0wKCQxK.js");return{diagram:t}},__vite__mapDeps([34,35,12,13,14,10,1,2,3]));return{id:My,diagram:e}},"loader"),LL={id:My,detector:BL,loader:vL},FL=LL,Ay="classDiagram",ML=g((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),AL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-D0wKCQxK.js");return{diagram:t}},__vite__mapDeps([36,35,12,13,14,10,1,2,3]));return{id:Ay,diagram:e}},"loader"),EL={id:Ay,detector:ML,loader:AL},$L=EL,Ey="state",OL=g((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),DL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-sy7Rfo0f.js");return{diagram:t}},__vite__mapDeps([37,38,13,14,10,1,2,3,5]));return{id:Ey,diagram:e}},"loader"),PL={id:Ey,detector:OL,loader:DL},IL=PL,$y="stateDiagram",RL=g((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),qL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-BRTKjL6-.js");return{diagram:t}},__vite__mapDeps([39,38,13,14,10,1,2,3]));return{id:$y,diagram:e}},"loader"),NL={id:$y,detector:RL,loader:qL},WL=NL,Oy="journey",zL=g(e=>/^\s*journey/.test(e),"detector"),HL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-CkgASPQL.js");return{diagram:t}},__vite__mapDeps([40,12,10,28,1,2,3]));return{id:Oy,diagram:e}},"loader"),YL={id:Oy,detector:zL,loader:HL},jL=YL,UL=g((e,t,r)=>{I.debug(`rendering svg for syntax error -`);const i=f1(t),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Uu(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Dy={draw:UL},GL=Dy,XL={db:{},renderer:Dy,parser:{parse:g(()=>{},"parse")}},VL=XL,Py="flowchart-elk",ZL=g((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),KL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-Bfis7KwQ.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Py,diagram:e}},"loader"),QL={id:Py,detector:ZL,loader:KL},JL=QL,Iy="timeline",tF=g(e=>/^\s*timeline/.test(e),"detector"),eF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-Ck5GR00U.js");return{diagram:t}},__vite__mapDeps([41,28,1,2,3]));return{id:Iy,diagram:e}},"loader"),rF={id:Iy,detector:tF,loader:eF},iF=rF,Ry="mindmap",sF=g(e=>/^\s*mindmap/.test(e),"detector"),aF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-CnwxkU_o.js");return{diagram:t}},__vite__mapDeps([42,13,14,1,2,3]));return{id:Ry,diagram:e}},"loader"),oF={id:Ry,detector:sF,loader:aF},nF=oF,qy="kanban",lF=g(e=>/^\s*kanban/.test(e),"detector"),hF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-C_T9GYcq.js");return{diagram:t}},__vite__mapDeps([43,12,1,2,3]));return{id:qy,diagram:e}},"loader"),cF={id:qy,detector:lF,loader:hF},uF=cF,Ny="sankey",dF=g(e=>/^\s*sankey(-beta)?/.test(e),"detector"),fF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js");return{diagram:t}},__vite__mapDeps([44,29,24,1,2,3]));return{id:Ny,diagram:e}},"loader"),gF={id:Ny,detector:dF,loader:fF},pF=gF,Wy="packet",yF=g(e=>/^\s*packet(-beta)?/.test(e),"detector"),mF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-C7wRZKVi.js");return{diagram:t}},__vite__mapDeps([45,20,21,1,2,3]));return{id:Wy,diagram:e}},"loader"),xF={id:Wy,detector:yF,loader:mF},zy="radar",CF=g(e=>/^\s*radar-beta/.test(e),"detector"),bF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-CsDpBRwj.js");return{diagram:t}},__vite__mapDeps([46,20,21,1,2,3]));return{id:zy,diagram:e}},"loader"),kF={id:zy,detector:CF,loader:bF},Hy="block",wF=g(e=>/^\s*block(-beta)?/.test(e),"detector"),SF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-JIRyk-UT.js");return{diagram:t}},__vite__mapDeps([47,12,15,1,2,3]));return{id:Hy,diagram:e}},"loader"),TF={id:Hy,detector:wF,loader:SF},_F=TF,Yy="treeView",BF=g(e=>/^\s*treeView-beta/.test(e),"detector"),vF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-Bhn2u9og.js");return{diagram:t}},__vite__mapDeps([48,19,20,21,1,2,3]));return{id:Yy,diagram:e}},"loader"),LF={id:Yy,detector:BF,loader:vF},FF=LF,jy="architecture",MF=g(e=>/^\s*architecture/.test(e),"detector"),AF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-BMtIY0MM.js");return{diagram:t}},__vite__mapDeps([49,20,21,1,2,3,8]));return{id:jy,diagram:e}},"loader"),EF={id:jy,detector:MF,loader:AF},$F=EF,Uy="eventmodeling",OF=g(e=>/^\s*eventmodeling/.test(e),"detector"),DF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-BPFQwR9c.js");return{diagram:t}},__vite__mapDeps([50,20,21,1,2,3]));return{id:Uy,diagram:e}},"loader"),PF={id:Uy,detector:OF,loader:DF},IF=PF,Gy="ishikawa",RF=g(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),qF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-B42RhGud.js");return{diagram:t}},__vite__mapDeps([51,1,2,3]));return{id:Gy,diagram:e}},"loader"),NF={id:Gy,detector:RF,loader:qF},Xy="venn",WF=g(e=>/^\s*venn-beta/.test(e),"detector"),zF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-kVi8iDPL.js");return{diagram:t}},__vite__mapDeps([52,1,2,3]));return{id:Xy,diagram:e}},"loader"),HF={id:Xy,detector:WF,loader:zF},YF=HF,Vy="treemap",jF=g(e=>/^\s*treemap/.test(e),"detector"),UF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-DYKyI2lv.js");return{diagram:t}},__vite__mapDeps([53,20,14,21,1,2,3,25,29,24]));return{id:Vy,diagram:e}},"loader"),GF={id:Vy,detector:jF,loader:UF},Zy="wardley",XF=g(e=>/^\s*wardley-beta/i.test(e),"detector"),VF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-xeAzTPpE.js");return{diagram:t}},__vite__mapDeps([54,20,21,1,2,3]));return{id:Zy,diagram:e}},"loader"),ZF={id:Zy,detector:XF,loader:VF},KF=ZF,Ky="cynefin",QF=g(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),JF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-T6cXmRvG.js");return{diagram:t}},__vite__mapDeps([55,20,21,1,2,3]));return{id:Ky,diagram:e}},"loader"),t5={id:Ky,detector:QF,loader:JF},Qy="railroad",e5=g(e=>/^\s*railroad-beta/i.test(e),"detector"),r5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-ByMdCyuE.js");return{diagram:t}},__vite__mapDeps([56,57,20,21,1,2,3]));return{id:Qy,diagram:e}},"loader"),i5={id:Qy,detector:e5,loader:r5},Jy="railroadEbnf",s5=g(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),a5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-CsupTakH.js");return{diagram:t}},__vite__mapDeps([58,57,20,21,1,2,3]));return{id:Jy,diagram:e}},"loader"),o5={id:Jy,detector:s5,loader:a5},tm="railroadAbnf",n5=g(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),l5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-Bfs8g8Bc.js");return{diagram:t}},__vite__mapDeps([59,57,20,21,1,2,3]));return{id:tm,diagram:e}},"loader"),h5={id:tm,detector:n5,loader:l5},em="railroadPeg",c5=g(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),u5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-C77gkBP1.js");return{diagram:t}},__vite__mapDeps([60,57,20,21,1,2,3]));return{id:em,diagram:e}},"loader"),d5={id:em,detector:c5,loader:u5},Tu=!1,Ha=g(()=>{Tu||(Tu=!0,Zs("error",VL,e=>e.toLowerCase().trim()==="error"),Zs("---",{db:{clear:g(()=>{},"clear")},styles:{},renderer:{draw:g(()=>{},"draw")},parser:{parse:g(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:g(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Po(JL,nF,$F),Po($v,uF,$L,FL,Vv,iL,oL,hL,kL,_L,jv,Wv,Iv,iF,Jv,WL,IL,jL,fL,pF,xF,mL,_F,IF,FF,kF,NF,GF,i5,o5,h5,d5,YF,KF,t5))},"addDiagrams"),f5=g(async()=>{I.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(br).map(async([r,{detector:i,loader:s}])=>{if(s)try{No(r)}catch{try{const{diagram:a,id:o}=await s();Zs(o,a,i)}catch(a){throw I.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete br[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){I.error(`Failed to load ${t.length} external diagrams`);for(const r of t)I.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),g5="graphics-document document";function rm(e,t){e.attr("role",g5),t!==""&&e.attr("aria-roledescription",t)}g(rm,"setA11yDiagramInfo");function im(e,t,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}g(im,"addSVGa11yTitleDescription");var xr,wn=(xr=class{constructor(t,r,i,s,a){this.type=t,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(t,r={}){var c,h;const i=Yt(),s=Bn(t,i);t=Dk(t)+` +`:""}return g(et,"dump2"),Eo.dump=et,Eo}g(ly,"requireDumper");var ku;function hy(){if(ku)return Jt;ku=1;const e=ny(),t=ly();function r(i,s){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return g(r,"renamed"),Jt.Type=se(),Jt.Schema=Al(),Jt.FAILSAFE_SCHEMA=Dl(),Jt.JSON_SCHEMA=Nl(),Jt.CORE_SCHEMA=Wl(),Jt.DEFAULT_SCHEMA=Na(),Jt.load=e.load,Jt.loadAll=e.loadAll,Jt.dump=t.dump,Jt.YAMLException=Ci(),Jt.types={binary:Yl(),float:ql(),map:Ol(),null:Pl(),pairs:Ul(),set:Gl(),timestamp:zl(),bool:Il(),int:Rl(),merge:Hl(),omap:jl(),seq:$l(),str:El()},Jt.safeLoad=r("safeLoad","load"),Jt.safeLoadAll=r("safeLoadAll","loadAll"),Jt.safeDump=r("safeDump","dump"),Jt}g(hy,"requireJsYaml");var ov=hy(),nv=ay(ov),{Type:TM,Schema:_M,FAILSAFE_SCHEMA:BM,JSON_SCHEMA:lv,CORE_SCHEMA:vM,DEFAULT_SCHEMA:LM,load:hv,loadAll:FM,dump:MM,YAMLException:AM,types:EM,safeLoad:$M,safeLoadAll:OM,safeDump:DM}=nv,cv={common:us,getConfig:Yt,insertCluster:gp,insertEdge:mp,insertEdgeLabel:xl,insertMarkers:bp,insertNode:ml,interpolateToCurve:Xn,labelHelper:mt,log:I,positionEdgeLabel:Rw},ns={},cy=g(e=>{for(const t of e)ns[t.name]=t},"registerLayoutLoaders"),uv=g(()=>{cy([{name:"dagre",loader:g(async()=>await Mt(()=>import("./dagre-GXQ25YYZ-BZfaRacC.js"),__vite__mapDeps([4,5,1,2,3])),"loader")},{name:"swimlane",loader:g(async()=>await Mt(()=>import("./swimlanes-42K2YHIH-BcKWWDjF.js"),__vite__mapDeps([6,1,2,3])),"loader")},{name:"cose-bilkent",loader:g(async()=>await Mt(()=>import("./cose-bilkent-JH36ORCC-g-PZ3PJZ.js"),__vite__mapDeps([7,8,2,1,3])),"loader")}])},"registerDefaultLayoutLoaders");uv();var PM=g(async(e,t)=>{if(!(e.layoutAlgorithm in ns))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const h of e.nodes){const u=h.domId||h.id;h.domId=`${e.diagramId}-${u}`}const r=ns[e.layoutAlgorithm],i=await r.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:o,gradientStart:n,gradientStop:l}=a,c=t.attr("id");if(t.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),o){const h=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",n).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return i.render(e,t,cv,{algorithm:r.algorithm})},"render"),IM=g((e="",{fallback:t="dagre"}={})=>{if(e in ns)return e;if(t in ns)return I.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Xl="comm",uy="rule",dy="decl",dv="@media",fv="@import",gv="@supports",pv="@namespace",xn="@keyframes",fy="@layer",yv="@scope",mv=Math.abs,Ki=String.fromCharCode;function gy(e){return e.trim()}function Cn(e,t,r){return e.replace(t,r)}function Ur(e,t){return e.charCodeAt(t)|0}function fi(e,t,r){return e.slice(t,r)}function Me(e){return e.length}function py(e){return e.length}function As(e,t){return t.push(e),e}var Wa=1,gi=1,yy=0,pe=0,Gt=0,bi="";function Vl(e,t,r,i,s,a,o,n){return{value:e,root:t,parent:r,type:i,props:s,children:a,line:Wa,column:gi,length:o,return:"",siblings:n}}function xv(){return Gt}function Cv(){return Gt=pe>0?Ur(bi,--pe):0,gi--,Gt===10&&(gi=1,Wa--),Gt}function Se(){return Gt=pe2||ls(Gt)>3?"":" "}function Sv(e,t){for(;--t&&Se()&&!(Gt<48||Gt>102||Gt>57&&Gt<65||Gt>70&&Gt<97););return za(e,Ys()+(t<6&&ir()==32&&Se()==32))}function bn(e){for(;Se();)switch(Gt){case e:return pe;case 34:case 39:e!==34&&e!==39&&bn(Gt);break;case 40:e===41&&bn(e);break;case 92:Se();break}return pe}function Tv(e,t){for(;Se()&&e+Gt!==57;)if(e+Gt===84&&ir()===47)break;return"/*"+za(t,pe-1)+"*"+Ki(e===47?e:Se())}function _v(e){for(;!ls(ir());)Se();return za(e,pe)}function Bv(e){return kv(js("",null,null,null,[""],e=bv(e),0,[0],e))}function js(e,t,r,i,s,a,o,n,l){for(var c=0,h=0,u=o,d=0,f=0,y=0,m=1,C=1,x=1,k=0,w=0,T="",_=s,v=a,F=i,L=T;C;)switch(y=w,w=Se()){case 40:y!=108&&Ur(L,u-1)==58?(k++,L+="("):L+=$o(w);break;case 41:k--,L+=")";break;case 34:case 39:case 91:L+=$o(w);break;case 9:case 10:case 13:case 32:if(k>0){L+=Ki(w);break}L+=wv(y);break;case 92:L+=Sv(Ys()-1,7);continue;case 47:switch(ir()){case 42:case 47:As(vv(Tv(Se(),Ys()),t,r,l),l),(ls(y||1)==5||ls(ir()||1)==5)&&Me(L)&&fi(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*m:n[c++]=Me(L)*x;case 125*m:case 59:case 0:if(k>0&&w){L+=Ki(w);break}switch(w){case 0:case 125:C=0;case 59+h:x==-1&&(L=Cn(L,/\f/g,"")),f>0&&(Me(L)-u||m===0)&&As(f>32?Su(L+";",i,r,u-1,l):Su(Cn(L," ","")+";",i,r,u-2,l),l);break;case 59:L+=";";default:if(As(F=wu(L,t,r,c,h,s,n,T,_=[],v=[],u,a),a),w===123)if(h===0)js(L,t,F,F,_,a,u,n,v);else{switch(d){case 99:if(Ur(L,3)===110)break;case 108:if(Ur(L,2)===97)break;default:h=0;case 100:case 109:case 115:}h?js(e,F,F,i&&As(wu(e,F,F,0,0,s,n,T,s,_=[],u,v),v),s,v,u,n,i?_:v):js(L,F,F,F,[""],v,0,n,v)}}c=h=f=0,m=x=1,T=L="",u=o;break;case 58:u=1+Me(L),f=y;default:if(m<1){if(w==123)--m;else if(w==125&&m++==0&&Cv()==125)continue}switch(L+=Ki(w),w*m){case 38:x=h>0?1:(L+="\f",-1);break;case 44:if(k>0)break;n[c++]=(Me(L)-1)*x,x=1;break;case 64:ir()===45&&(L+=$o(Se())),d=ir(),h=u=Me(T=L+=_v(Ys())),w++;break;case 45:y===45&&Me(L)==2&&(m=0)}}return a}function wu(e,t,r,i,s,a,o,n,l,c,h,u){for(var d=s-1,f=s===0?a:[""],y=py(f),m=0,C=0,x=0;m0?f[k]+" "+w:Cn(w,/&\f/g,f[k])))&&(l[x++]=T);return Vl(e,t,r,s===0?uy:n,l,c,h,u)}function vv(e,t,r,i){return Vl(e,t,r,Xl,Ki(xv()),fi(e,2,-2),0,i)}function Su(e,t,r,i,s){return Vl(e,t,r,dy,fi(e,0,i),fi(e,i+1,-1),i,s)}function kn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Av=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-CyJ-OjiV.js");return{diagram:t}},__vite__mapDeps([9,10,1,2,3]));return{id:my,diagram:e}},"loader"),Ev={id:my,detector:Mv,loader:Av},$v=Ev,xy="flowchart",Ov=g((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),Dv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-BRjqrD7u.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:xy,diagram:e}},"loader"),Pv={id:xy,detector:Ov,loader:Dv},Iv=Pv,Cy="flowchart-v2",Rv=g((e,t)=>{var r,i,s;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((s=t==null?void 0:t.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),qv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-BRjqrD7u.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Cy,diagram:e}},"loader"),Nv={id:Cy,detector:Rv,loader:qv},Wv=Nv,by="swimlane",zv=g(e=>/^\s*swimlane-beta\b/.test(e),"detector"),Hv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-BWEneQLP.js");return{diagram:t}},__vite__mapDeps([16,11,12,13,14,10,1,2,3,15]));return{id:by,diagram:e}},"loader"),Yv={id:by,detector:zv,loader:Hv},jv=Yv,ky="er",Uv=g(e=>/^\s*erDiagram/.test(e),"detector"),Gv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-sS227ewn.js");return{diagram:t}},__vite__mapDeps([17,13,14,15,1,2,3]));return{id:ky,diagram:e}},"loader"),Xv={id:ky,detector:Uv,loader:Gv},Vv=Xv,wy="gitGraph",Zv=g(e=>/^\s*gitGraph/.test(e),"detector"),Kv=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-CKFZpt0Z.js");return{diagram:t}},__vite__mapDeps([18,19,20,21,1,2,3]));return{id:wy,diagram:e}},"loader"),Qv={id:wy,detector:Zv,loader:Kv},Jv=Qv,Sy="gantt",tL=g(e=>/^\s*gantt/.test(e),"detector"),eL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-Dr_9OMcR.js");return{diagram:t}},__vite__mapDeps([22,2,23,24,25,1,3]));return{id:Sy,diagram:e}},"loader"),rL={id:Sy,detector:tL,loader:eL},iL=rL,Ty="info",sL=g(e=>/^\s*info/.test(e),"detector"),aL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-CR9oYlVY.js");return{diagram:t}},__vite__mapDeps([26,21,1,2,3]));return{id:Ty,diagram:e}},"loader"),oL={id:Ty,detector:sL,loader:aL},_y="pie",nL=g(e=>/^\s*pie/.test(e),"detector"),lL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-COMLqW9-.js");return{diagram:t}},__vite__mapDeps([27,20,21,1,2,3,28,29,24]));return{id:_y,diagram:e}},"loader"),hL={id:_y,detector:nL,loader:lL},By="quadrantChart",cL=g(e=>/^\s*quadrantChart/.test(e),"detector"),uL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-B0v9e3iH.js");return{diagram:t}},__vite__mapDeps([30,23,24,25,1,2,3]));return{id:By,diagram:e}},"loader"),dL={id:By,detector:cL,loader:uL},fL=dL,vy="xychart",gL=g(e=>/^\s*xychart(-beta)?/.test(e),"detector"),pL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-BMGpkbBF.js");return{diagram:t}},__vite__mapDeps([31,24,29,23,25,1,2,3]));return{id:vy,diagram:e}},"loader"),yL={id:vy,detector:gL,loader:pL},mL=yL,Ly="requirement",xL=g(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),CL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-Cb83i4fD.js");return{diagram:t}},__vite__mapDeps([32,13,14,1,2,3]));return{id:Ly,diagram:e}},"loader"),bL={id:Ly,detector:xL,loader:CL},kL=bL,Fy="sequence",wL=g(e=>/^\s*sequenceDiagram/.test(e),"detector"),SL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-D69Gj_rf.js");return{diagram:t}},__vite__mapDeps([33,19,10,1,2,3]));return{id:Fy,diagram:e}},"loader"),TL={id:Fy,detector:wL,loader:SL},_L=TL,My="class",BL=g((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),vL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-DGoLhpgF.js");return{diagram:t}},__vite__mapDeps([34,35,12,13,14,10,1,2,3]));return{id:My,diagram:e}},"loader"),LL={id:My,detector:BL,loader:vL},FL=LL,Ay="classDiagram",ML=g((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),AL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-DGoLhpgF.js");return{diagram:t}},__vite__mapDeps([36,35,12,13,14,10,1,2,3]));return{id:Ay,diagram:e}},"loader"),EL={id:Ay,detector:ML,loader:AL},$L=EL,Ey="state",OL=g((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),DL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-BaS0tICg.js");return{diagram:t}},__vite__mapDeps([37,38,13,14,10,1,2,3,5]));return{id:Ey,diagram:e}},"loader"),PL={id:Ey,detector:OL,loader:DL},IL=PL,$y="stateDiagram",RL=g((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),qL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-CtqGz6p6.js");return{diagram:t}},__vite__mapDeps([39,38,13,14,10,1,2,3]));return{id:$y,diagram:e}},"loader"),NL={id:$y,detector:RL,loader:qL},WL=NL,Oy="journey",zL=g(e=>/^\s*journey/.test(e),"detector"),HL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-B118or3e.js");return{diagram:t}},__vite__mapDeps([40,12,10,28,1,2,3]));return{id:Oy,diagram:e}},"loader"),YL={id:Oy,detector:zL,loader:HL},jL=YL,UL=g((e,t,r)=>{I.debug(`rendering svg for syntax error +`);const i=f1(t),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Uu(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Dy={draw:UL},GL=Dy,XL={db:{},renderer:Dy,parser:{parse:g(()=>{},"parse")}},VL=XL,Py="flowchart-elk",ZL=g((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),KL=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-BRjqrD7u.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([11,12,13,14,10,1,2,3,15]));return{id:Py,diagram:e}},"loader"),QL={id:Py,detector:ZL,loader:KL},JL=QL,Iy="timeline",tF=g(e=>/^\s*timeline/.test(e),"detector"),eF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-tqGUvpOH.js");return{diagram:t}},__vite__mapDeps([41,28,1,2,3]));return{id:Iy,diagram:e}},"loader"),rF={id:Iy,detector:tF,loader:eF},iF=rF,Ry="mindmap",sF=g(e=>/^\s*mindmap/.test(e),"detector"),aF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-DYGePCnN.js");return{diagram:t}},__vite__mapDeps([42,13,14,1,2,3]));return{id:Ry,diagram:e}},"loader"),oF={id:Ry,detector:sF,loader:aF},nF=oF,qy="kanban",lF=g(e=>/^\s*kanban/.test(e),"detector"),hF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-B4aZ932z.js");return{diagram:t}},__vite__mapDeps([43,12,1,2,3]));return{id:qy,diagram:e}},"loader"),cF={id:qy,detector:lF,loader:hF},uF=cF,Ny="sankey",dF=g(e=>/^\s*sankey(-beta)?/.test(e),"detector"),fF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-Dv0jV2ka.js");return{diagram:t}},__vite__mapDeps([44,29,24,1,2,3]));return{id:Ny,diagram:e}},"loader"),gF={id:Ny,detector:dF,loader:fF},pF=gF,Wy="packet",yF=g(e=>/^\s*packet(-beta)?/.test(e),"detector"),mF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-WNIFVi0Q.js");return{diagram:t}},__vite__mapDeps([45,20,21,1,2,3]));return{id:Wy,diagram:e}},"loader"),xF={id:Wy,detector:yF,loader:mF},zy="radar",CF=g(e=>/^\s*radar-beta/.test(e),"detector"),bF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-De0fNkzZ.js");return{diagram:t}},__vite__mapDeps([46,20,21,1,2,3]));return{id:zy,diagram:e}},"loader"),kF={id:zy,detector:CF,loader:bF},Hy="block",wF=g(e=>/^\s*block(-beta)?/.test(e),"detector"),SF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-DIqSOQsY.js");return{diagram:t}},__vite__mapDeps([47,12,15,1,2,3]));return{id:Hy,diagram:e}},"loader"),TF={id:Hy,detector:wF,loader:SF},_F=TF,Yy="treeView",BF=g(e=>/^\s*treeView-beta/.test(e),"detector"),vF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-x7ODN_Fr.js");return{diagram:t}},__vite__mapDeps([48,19,20,21,1,2,3]));return{id:Yy,diagram:e}},"loader"),LF={id:Yy,detector:BF,loader:vF},FF=LF,jy="architecture",MF=g(e=>/^\s*architecture/.test(e),"detector"),AF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-yUitYCC3.js");return{diagram:t}},__vite__mapDeps([49,20,21,1,2,3,8]));return{id:jy,diagram:e}},"loader"),EF={id:jy,detector:MF,loader:AF},$F=EF,Uy="eventmodeling",OF=g(e=>/^\s*eventmodeling/.test(e),"detector"),DF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-D-4K2Uv-.js");return{diagram:t}},__vite__mapDeps([50,20,21,1,2,3]));return{id:Uy,diagram:e}},"loader"),PF={id:Uy,detector:OF,loader:DF},IF=PF,Gy="ishikawa",RF=g(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),qF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-BQdVBYth.js");return{diagram:t}},__vite__mapDeps([51,1,2,3]));return{id:Gy,diagram:e}},"loader"),NF={id:Gy,detector:RF,loader:qF},Xy="venn",WF=g(e=>/^\s*venn-beta/.test(e),"detector"),zF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-pcfAD8hQ.js");return{diagram:t}},__vite__mapDeps([52,1,2,3]));return{id:Xy,diagram:e}},"loader"),HF={id:Xy,detector:WF,loader:zF},YF=HF,Vy="treemap",jF=g(e=>/^\s*treemap/.test(e),"detector"),UF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-B3oZVKXq.js");return{diagram:t}},__vite__mapDeps([53,20,14,21,1,2,3,25,29,24]));return{id:Vy,diagram:e}},"loader"),GF={id:Vy,detector:jF,loader:UF},Zy="wardley",XF=g(e=>/^\s*wardley-beta/i.test(e),"detector"),VF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-Ck_DXu78.js");return{diagram:t}},__vite__mapDeps([54,20,21,1,2,3]));return{id:Zy,diagram:e}},"loader"),ZF={id:Zy,detector:XF,loader:VF},KF=ZF,Ky="cynefin",QF=g(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),JF=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-DM3cCVfa.js");return{diagram:t}},__vite__mapDeps([55,20,21,1,2,3]));return{id:Ky,diagram:e}},"loader"),t5={id:Ky,detector:QF,loader:JF},Qy="railroad",e5=g(e=>/^\s*railroad-beta/i.test(e),"detector"),r5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-nUeJW8RG.js");return{diagram:t}},__vite__mapDeps([56,57,20,21,1,2,3]));return{id:Qy,diagram:e}},"loader"),i5={id:Qy,detector:e5,loader:r5},Jy="railroadEbnf",s5=g(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),a5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-DyIJUwiI.js");return{diagram:t}},__vite__mapDeps([58,57,20,21,1,2,3]));return{id:Jy,diagram:e}},"loader"),o5={id:Jy,detector:s5,loader:a5},tm="railroadAbnf",n5=g(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),l5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-DkzoDDgP.js");return{diagram:t}},__vite__mapDeps([59,57,20,21,1,2,3]));return{id:tm,diagram:e}},"loader"),h5={id:tm,detector:n5,loader:l5},em="railroadPeg",c5=g(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),u5=g(async()=>{const{diagram:e}=await Mt(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-CosznoAs.js");return{diagram:t}},__vite__mapDeps([60,57,20,21,1,2,3]));return{id:em,diagram:e}},"loader"),d5={id:em,detector:c5,loader:u5},Tu=!1,Ha=g(()=>{Tu||(Tu=!0,Zs("error",VL,e=>e.toLowerCase().trim()==="error"),Zs("---",{db:{clear:g(()=>{},"clear")},styles:{},renderer:{draw:g(()=>{},"draw")},parser:{parse:g(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:g(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Po(JL,nF,$F),Po($v,uF,$L,FL,Vv,iL,oL,hL,kL,_L,jv,Wv,Iv,iF,Jv,WL,IL,jL,fL,pF,xF,mL,_F,IF,FF,kF,NF,GF,i5,o5,h5,d5,YF,KF,t5))},"addDiagrams"),f5=g(async()=>{I.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(br).map(async([r,{detector:i,loader:s}])=>{if(s)try{No(r)}catch{try{const{diagram:a,id:o}=await s();Zs(o,a,i)}catch(a){throw I.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete br[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){I.error(`Failed to load ${t.length} external diagrams`);for(const r of t)I.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),g5="graphics-document document";function rm(e,t){e.attr("role",g5),t!==""&&e.attr("aria-roledescription",t)}g(rm,"setA11yDiagramInfo");function im(e,t,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}g(im,"addSVGa11yTitleDescription");var xr,wn=(xr=class{constructor(t,r,i,s,a){this.type=t,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(t,r={}){var c,h;const i=Yt(),s=Bn(t,i);t=Dk(t)+` `;try{No(s)}catch{const u=n0(s);if(!u)throw new Nu(`Diagram ${s} not found.`);const{id:d,diagram:f}=await u();Zs(d,f)}const{db:a,parser:o,renderer:n,init:l}=No(s);return o.parser&&(o.parser.yy=a),(c=a.clear)==null||c.call(a),l==null||l(i),r.title&&((h=a.setDiagramTitle)==null||h.call(a,r.title)),await o.parse(t),new xr(s,t,a,o,n)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},g(xr,"Diagram"),xr),_u=[],p5=g(()=>{_u.forEach(e=>{e()}),_u=[]},"attachFunctions"),y5=g(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function sm(e){const t=e.match(qu);if(!t)return{text:e,metadata:{}};const r=t[1],i=r?t[2].split(` `).map(o=>o.startsWith(r)?o.slice(r.length):o).join(` `):t[2];let s=hv(i,{schema:lv})??{};s=typeof s=="object"&&!Array.isArray(s)?s:{};const a={};return s.displayMode&&(a.displayMode=s.displayMode.toString()),s.title&&(a.title=s.title.toString()),s.config&&(a.config=s.config),{text:e.slice(t[0].length),metadata:a}}g(sm,"extractFrontMatter");var m5=g(e=>e.replace(/\r\n?/g,` diff --git a/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js b/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-DYGePCnN.js similarity index 99% rename from amplifier_web/static/assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js rename to amplifier_web/static/assets/mindmap-definition-YA3MSWOX-DYGePCnN.js index a2f49d367..1d50277b1 100644 --- a/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-CnwxkU_o.js +++ b/amplifier_web/static/assets/mindmap-definition-YA3MSWOX-DYGePCnN.js @@ -1,4 +1,4 @@ -import{g as oe}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as ce}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as h,l as R,u as le,v as he,y as de,B as W,c as U,i as H,b3 as ge,U as ue,V as pe,W as fe}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function me(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}const ye=new Uint8Array(16);function Ee(){return crypto.getRandomValues(ye)}function _e(t,e,o){return crypto.randomUUID?crypto.randomUUID():be(t)}function be(t,e,o){var n;t=t||{};const l=t.random??((n=t.rng)==null?void 0:n.call(t))??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,me(l)}var K=(function(){var t=h(function(O,s,i,a){for(i=i||{},a=O.length;a--;i[O[a]]=s);return i},"o"),e=[1,4],o=[1,13],l=[1,12],n=[1,15],d=[1,16],p=[1,20],y=[1,19],E=[6,7,8],k=[1,26],L=[1,24],D=[1,25],b=[6,7,11],$=[1,6,13,15,16,19,22],f=[1,33],B=[1,34],P=[1,6,7,11,13,15,16,19,22],z={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,i,a,c,u,r,M){var g=r.length-1;switch(u){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[g].id),c.addNode(r[g-1].length,r[g].id,r[g].descr,r[g].type);break;case 16:c.getLogger().trace("Icon: ",r[g]),c.decorateNode({icon:r[g]});break;case 17:case 21:c.decorateNode({class:r[g]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[g].id),c.addNode(0,r[g].id,r[g].descr,r[g].type);break;case 20:c.decorateNode({icon:r[g]});break;case 25:c.getLogger().trace("node found ..",r[g-2]),this.$={id:r[g-1],descr:r[g-1],type:c.getType(r[g-2],r[g])};break;case 26:this.$={id:r[g],descr:r[g],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[g-3]),this.$={id:r[g-3],descr:r[g-1],type:c.getType(r[g-2],r[g])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:o,7:[1,10],9:9,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:o,9:22,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:k,7:L,10:23,11:D},t(b,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:y}),t(b,[2,18]),t(b,[2,19]),t(b,[2,20]),t(b,[2,21]),t(b,[2,23]),t(b,[2,24]),t(b,[2,26],{19:[1,30]}),{20:[1,31]},{6:k,7:L,10:32,11:D},{1:[2,7],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t($,[2,14],{7:f,11:B}),t(P,[2,8]),t(P,[2,9]),t(P,[2,10]),t(b,[2,15]),t(b,[2,16]),t(b,[2,17]),{20:[1,35]},{21:[1,36]},t($,[2,13],{7:f,11:B}),t(P,[2,11]),t(P,[2,12]),{21:[1,37]},t(b,[2,25]),t(b,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,i){if(i.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=i,a}},"parseError"),parse:h(function(s){var i=this,a=[0],c=[],u=[null],r=[],M=this.table,g="",F=0,Q=0,ie=2,Z=1,se=r.slice.call(arguments,1),m=Object.create(this.lexer),C={yy:{}};for(var X in this.yy)Object.prototype.hasOwnProperty.call(this.yy,X)&&(C.yy[X]=this.yy[X]);m.setInput(s,C.yy),C.yy.lexer=m,C.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Y=m.yylloc;r.push(Y);var re=m.options&&m.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ae(x){a.length=a.length-2*x,u.length=u.length-x,r.length=r.length-x}h(ae,"popStack");function ee(){var x;return x=c.pop()||m.lex()||Z,typeof x!="number"&&(x instanceof Array&&(c=x,x=c.pop()),x=i.symbols_[x]||x),x}h(ee,"lex");for(var S,I,N,q,w={},G,v,te,j;;){if(I=a[a.length-1],this.defaultActions[I]?N=this.defaultActions[I]:((S===null||typeof S>"u")&&(S=ee()),N=M[I]&&M[I][S]),typeof N>"u"||!N.length||!N[0]){var J="";j=[];for(G in M[I])this.terminals_[G]&&G>ie&&j.push("'"+this.terminals_[G]+"'");m.showPosition?J="Parse error on line "+(F+1)+`: +import{g as oe}from"./chunk-XXDRQBXY-CEoTwp0p.js";import{s as ce}from"./chunk-POPQ4Y6H-OaNnn-K8.js";import{_ as h,l as R,u as le,v as he,y as de,B as W,c as U,i as H,b3 as ge,U as ue,V as pe,W as fe}from"./mermaid.core-YRnlneqM.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function me(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}const ye=new Uint8Array(16);function Ee(){return crypto.getRandomValues(ye)}function _e(t,e,o){return crypto.randomUUID?crypto.randomUUID():be(t)}function be(t,e,o){var n;t=t||{};const l=t.random??((n=t.rng)==null?void 0:n.call(t))??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,me(l)}var K=(function(){var t=h(function(O,s,i,a){for(i=i||{},a=O.length;a--;i[O[a]]=s);return i},"o"),e=[1,4],o=[1,13],l=[1,12],n=[1,15],d=[1,16],p=[1,20],y=[1,19],E=[6,7,8],k=[1,26],L=[1,24],D=[1,25],b=[6,7,11],$=[1,6,13,15,16,19,22],f=[1,33],B=[1,34],P=[1,6,7,11,13,15,16,19,22],z={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,i,a,c,u,r,M){var g=r.length-1;switch(u){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[g].id),c.addNode(r[g-1].length,r[g].id,r[g].descr,r[g].type);break;case 16:c.getLogger().trace("Icon: ",r[g]),c.decorateNode({icon:r[g]});break;case 17:case 21:c.decorateNode({class:r[g]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[g].id),c.addNode(0,r[g].id,r[g].descr,r[g].type);break;case 20:c.decorateNode({icon:r[g]});break;case 25:c.getLogger().trace("node found ..",r[g-2]),this.$={id:r[g-1],descr:r[g-1],type:c.getType(r[g-2],r[g])};break;case 26:this.$={id:r[g],descr:r[g],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[g-3]),this.$={id:r[g-3],descr:r[g-1],type:c.getType(r[g-2],r[g])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:o,7:[1,10],9:9,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:o,9:22,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},{6:k,7:L,10:23,11:D},t(b,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:y}),t(b,[2,18]),t(b,[2,19]),t(b,[2,20]),t(b,[2,21]),t(b,[2,23]),t(b,[2,24]),t(b,[2,26],{19:[1,30]}),{20:[1,31]},{6:k,7:L,10:32,11:D},{1:[2,7],6:o,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:p,22:y},t($,[2,14],{7:f,11:B}),t(P,[2,8]),t(P,[2,9]),t(P,[2,10]),t(b,[2,15]),t(b,[2,16]),t(b,[2,17]),{20:[1,35]},{21:[1,36]},t($,[2,13],{7:f,11:B}),t(P,[2,11]),t(P,[2,12]),{21:[1,37]},t(b,[2,25]),t(b,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,i){if(i.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=i,a}},"parseError"),parse:h(function(s){var i=this,a=[0],c=[],u=[null],r=[],M=this.table,g="",F=0,Q=0,ie=2,Z=1,se=r.slice.call(arguments,1),m=Object.create(this.lexer),C={yy:{}};for(var X in this.yy)Object.prototype.hasOwnProperty.call(this.yy,X)&&(C.yy[X]=this.yy[X]);m.setInput(s,C.yy),C.yy.lexer=m,C.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Y=m.yylloc;r.push(Y);var re=m.options&&m.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ae(x){a.length=a.length-2*x,u.length=u.length-x,r.length=r.length-x}h(ae,"popStack");function ee(){var x;return x=c.pop()||m.lex()||Z,typeof x!="number"&&(x instanceof Array&&(c=x,x=c.pop()),x=i.symbols_[x]||x),x}h(ee,"lex");for(var S,I,N,q,w={},G,v,te,j;;){if(I=a[a.length-1],this.defaultActions[I]?N=this.defaultActions[I]:((S===null||typeof S>"u")&&(S=ee()),N=M[I]&&M[I][S]),typeof N>"u"||!N.length||!N[0]){var J="";j=[];for(G in M[I])this.terminals_[G]&&G>ie&&j.push("'"+this.terminals_[G]+"'");m.showPosition?J="Parse error on line "+(F+1)+`: `+m.showPosition()+` Expecting `+j.join(", ")+", got '"+(this.terminals_[S]||S)+"'":J="Parse error on line "+(F+1)+": Unexpected "+(S==Z?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(J,{text:m.match,token:this.terminals_[S]||S,line:m.yylineno,loc:Y,expected:j})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+S);switch(N[0]){case 1:a.push(S),u.push(m.yytext),r.push(m.yylloc),a.push(N[1]),S=null,Q=m.yyleng,g=m.yytext,F=m.yylineno,Y=m.yylloc;break;case 2:if(v=this.productions_[N[1]][1],w.$=u[u.length-v],w._$={first_line:r[r.length-(v||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(v||1)].first_column,last_column:r[r.length-1].last_column},re&&(w._$.range=[r[r.length-(v||1)].range[0],r[r.length-1].range[1]]),q=this.performAction.apply(w,[g,Q,F,C.yy,N[1],u,r].concat(se)),typeof q<"u")return q;v&&(a=a.slice(0,-1*v*2),u=u.slice(0,-1*v),r=r.slice(0,-1*v)),a.push(this.productions_[N[1]][0]),u.push(w.$),r.push(w._$),te=M[a[a.length-2]][a[a.length-1]],a.push(te);break;case 3:return!0}}return!0},"parse")},ne=(function(){var O={EOF:1,parseError:h(function(i,a){if(this.yy.parser)this.yy.parser.parseError(i,a);else throw new Error(i)},"parseError"),setInput:h(function(s,i){return this.yy=i||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var i=s.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:h(function(s){var i=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===c.length?this.yylloc.first_column:0)+c[c.length-a.length].length-a[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:h(function(s){this.unput(this.match.slice(s))},"less"),pastInput:h(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/pegDiagram-XKGWAZYB-C77gkBP1.js b/amplifier_web/static/assets/pegDiagram-XKGWAZYB-CosznoAs.js similarity index 87% rename from amplifier_web/static/assets/pegDiagram-XKGWAZYB-C77gkBP1.js rename to amplifier_web/static/assets/pegDiagram-XKGWAZYB-CosznoAs.js index 3323d78ed..8473ec5f8 100644 --- a/amplifier_web/static/assets/pegDiagram-XKGWAZYB-C77gkBP1.js +++ b/amplifier_web/static/assets/pegDiagram-XKGWAZYB-CosznoAs.js @@ -1 +1 @@ -import{g as l,r as m,d as a}from"./chunk-SVP7TREG-DegBQCYH.js";import{p}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as t,l as o}from"./mermaid.core-BQ5lTCZr.js";import{M as u,d as c}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; +import{g as l,r as m,d as a}from"./chunk-SVP7TREG-Wjd95MYc.js";import{p}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{_ as t,l as o}from"./mermaid.core-YRnlneqM.js";import{M as u,d as c}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; diff --git a/amplifier_web/static/assets/pieDiagram-E7YTZNPT-DYkXhOYb.js b/amplifier_web/static/assets/pieDiagram-E7YTZNPT-COMLqW9-.js similarity index 94% rename from amplifier_web/static/assets/pieDiagram-E7YTZNPT-DYkXhOYb.js rename to amplifier_web/static/assets/pieDiagram-E7YTZNPT-COMLqW9-.js index a6c01251a..29f58a0b6 100644 --- a/amplifier_web/static/assets/pieDiagram-E7YTZNPT-DYkXhOYb.js +++ b/amplifier_web/static/assets/pieDiagram-E7YTZNPT-COMLqW9-.js @@ -1,4 +1,4 @@ -import{p as rt}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{a3 as T,a6 as B,b2 as nt,g as it,s as ot,a as st,b as lt,o as ct,n as ut,_ as d,l as G,c as gt,A as dt,D as pt,L as ht,d as ft,p as mt,B as vt}from"./mermaid.core-BQ5lTCZr.js";import{p as xt}from"./cynefin-OW5HDTMX-C5aohCXI.js";import{d as J}from"./arc-CxD3pp7w.js";import{o as St}from"./ordinal-Cboi1Yqb.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function yt(t,n){return nt?1:n>=t?0:NaN}function wt(t){return t}function At(){var t=wt,n=yt,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=nt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,R=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=R*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:R};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var Ct=vt.pie,I={sections:new Map,showData:!1},F=I.sections,V=I.showData,$t=structuredClone(Ct),Dt=d(()=>structuredClone($t),"getConfig"),Tt=d(()=>{F=new Map,V=I.showData,mt()},"clear"),bt=d(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);F.has(t)||(F.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),kt=d(()=>F,"getSections"),zt=d(t=>{V=t},"setShowData"),Et=d(()=>V,"getShowData"),K={getConfig:Dt,clear:Tt,setDiagramTitle:ut,getDiagramTitle:ct,setAccTitle:lt,getAccTitle:st,setAccDescription:ot,getAccDescription:it,addSection:bt,getSections:kt,setShowData:zt,getShowData:Et},Mt=d((t,n)=>{rt(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Lt={parse:d(async t=>{const n=await xt("pie",t);G.debug(n),Mt(n,K)},"parse")},Rt=d(t=>` +import{p as rt}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{a3 as T,a6 as B,b2 as nt,g as it,s as ot,a as st,b as lt,o as ct,n as ut,_ as d,l as G,c as gt,A as dt,D as pt,L as ht,d as ft,p as mt,B as vt}from"./mermaid.core-YRnlneqM.js";import{p as xt}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import{d as J}from"./arc-D2jKxjLS.js";import{o as St}from"./ordinal-Cboi1Yqb.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function yt(t,n){return nt?1:n>=t?0:NaN}function wt(t){return t}function At(){var t=wt,n=yt,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=nt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,R=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=R*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:R};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var Ct=vt.pie,I={sections:new Map,showData:!1},F=I.sections,V=I.showData,$t=structuredClone(Ct),Dt=d(()=>structuredClone($t),"getConfig"),Tt=d(()=>{F=new Map,V=I.showData,mt()},"clear"),bt=d(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);F.has(t)||(F.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),kt=d(()=>F,"getSections"),zt=d(t=>{V=t},"setShowData"),Et=d(()=>V,"getShowData"),K={getConfig:Dt,clear:Tt,setDiagramTitle:ut,getDiagramTitle:ct,setAccTitle:lt,getAccTitle:st,setAccDescription:ot,getAccDescription:it,addSection:bt,getSections:kt,setShowData:zt,getShowData:Et},Mt=d((t,n)=>{rt(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Lt={parse:d(async t=>{const n=await xt("pie",t);G.debug(n),Mt(n,K)},"parse")},Rt=d(t=>` .pieCircle{ stroke: ${t.pieStrokeColor}; stroke-width : ${t.pieStrokeWidth}; diff --git a/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js b/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-B0v9e3iH.js similarity index 99% rename from amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js rename to amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-B0v9e3iH.js index 7cefed7e9..b3ac8863f 100644 --- a/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-DHRSmvLk.js +++ b/amplifier_web/static/assets/quadrantDiagram-AXDQQJYC-B0v9e3iH.js @@ -1,4 +1,4 @@ -import{s as Ae,g as ke,o as ae,n as Fe,a as Pe,b as ve,_ as o,c as wt,l as At,j as zt,d as Ce,p as Le,B as z,i as Ee,E as De}from"./mermaid.core-BQ5lTCZr.js";import{l as ie}from"./linear-BcEdwvr4.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Vt=(function(){var t=o(function(j,r,l,g){for(l=l||{},g=j.length;g--;l[j[g]]=r);return l},"o"),n=[1,3],u=[1,4],c=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],S=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],d=[1,37],T=[1,36],m=[1,38],q=[1,35],b=[1,43],x=[1,41],_=[1,45],Y=[1,14],G=[1,23],yt=[1,18],Tt=[1,19],dt=[1,20],Ft=[1,21],ut=[1,22],xt=[1,24],ft=[1,25],gt=[1,26],i=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Ht=[1,71],Xt=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],J=[1,91],$=[1,92],tt=[1,93],et=[1,100],it=[1,94],at=[1,97],nt=[1,95],st=[1,96],rt=[1,98],ot=[1,99],Pt=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],vt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,g,f,A,e,pt){var s=e.length-1;switch(A){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],f.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),f.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),f.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),f.setAccDescription(this.$);break;case 46:f.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:f.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:f.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:f.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:f.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:f.setXAxisLeftText(e[s-2]),f.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟶ ",f.setXAxisLeftText(e[s-1]);break;case 53:f.setXAxisLeftText(e[s]);break;case 54:f.setYAxisBottomText(e[s-2]),f.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟶ ",f.setYAxisBottomText(e[s-1]);break;case 56:f.setYAxisBottomText(e[s]);break;case 57:f.setQuadrant1Text(e[s]);break;case 58:f.setQuadrant2Text(e[s]);break;case 59:f.setQuadrant3Text(e[s]);break;case 60:f.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:u,55:c,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:u,55:c,56:h,57:p},{18:n,26:9,27:2,28:u,55:c,56:h,57:p},t(y,[2,33],{29:10}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:c,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{46:[1,102]},t(a,[2,29],{10:Pt}),t(Zt,[2,27],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:Pt}),t(a,[2,48],{22:89,16:90,23:105,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:106},t(N,[2,26]),t(a,[2,50],{10:Pt}),t(Zt,[2,28],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=l,g}},"parseError"),parse:o(function(r){var l=this,g=[0],f=[],A=[null],e=[],pt=this.table,s="",qt=0,Jt=0,qe=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),K={yy:{}};for(var Ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ct)&&(K.yy[Ct]=this.yy[Ct]);D.setInput(r,K.yy),K.yy.lexer=D,K.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Lt=D.yylloc;e.push(Lt);var Se=D.options&&D.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){g.length=g.length-2*R,A.length=A.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=f.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(f=R,R=f.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,Z,W,Et,lt={},bt,M,ee,St;;){if(Z=g[g.length-1],this.defaultActions[Z]?W=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=te()),W=pt[Z]&&pt[Z][B]),typeof W>"u"||!W.length||!W[0]){var Dt="";St=[];for(bt in pt[Z])this.terminals_[bt]&&bt>qe&&St.push("'"+this.terminals_[bt]+"'");D.showPosition?Dt="Parse error on line "+(qt+1)+`: +import{s as Ae,g as ke,o as ae,n as Fe,a as Pe,b as ve,_ as o,c as wt,l as At,j as zt,d as Ce,p as Le,B as z,i as Ee,E as De}from"./mermaid.core-YRnlneqM.js";import{l as ie}from"./linear-61bSIS_K.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Vt=(function(){var t=o(function(j,r,l,g){for(l=l||{},g=j.length;g--;l[j[g]]=r);return l},"o"),n=[1,3],u=[1,4],c=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],S=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],d=[1,37],T=[1,36],m=[1,38],q=[1,35],b=[1,43],x=[1,41],_=[1,45],Y=[1,14],G=[1,23],yt=[1,18],Tt=[1,19],dt=[1,20],Ft=[1,21],ut=[1,22],xt=[1,24],ft=[1,25],gt=[1,26],i=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Ht=[1,71],Xt=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],J=[1,91],$=[1,92],tt=[1,93],et=[1,100],it=[1,94],at=[1,97],nt=[1,95],st=[1,96],rt=[1,98],ot=[1,99],Pt=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],vt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,g,f,A,e,pt){var s=e.length-1;switch(A){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],f.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),f.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),f.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),f.setAccDescription(this.$);break;case 46:f.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:f.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:f.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:f.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:f.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:f.setXAxisLeftText(e[s-2]),f.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟶ ",f.setXAxisLeftText(e[s-1]);break;case 53:f.setXAxisLeftText(e[s]);break;case 54:f.setYAxisBottomText(e[s-2]),f.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟶ ",f.setYAxisBottomText(e[s-1]);break;case 56:f.setYAxisBottomText(e[s]);break;case 57:f.setQuadrant1Text(e[s]);break;case 58:f.setQuadrant2Text(e[s]);break;case 59:f.setQuadrant3Text(e[s]);break;case 60:f.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:u,55:c,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:u,55:c,56:h,57:p},{18:n,26:9,27:2,28:u,55:c,56:h,57:p},t(y,[2,33],{29:10}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:c,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{46:[1,102]},t(a,[2,29],{10:Pt}),t(Zt,[2,27],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:Pt}),t(a,[2,48],{22:89,16:90,23:105,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:106},t(N,[2,26]),t(a,[2,50],{10:Pt}),t(Zt,[2,28],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=l,g}},"parseError"),parse:o(function(r){var l=this,g=[0],f=[],A=[null],e=[],pt=this.table,s="",qt=0,Jt=0,qe=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),K={yy:{}};for(var Ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ct)&&(K.yy[Ct]=this.yy[Ct]);D.setInput(r,K.yy),K.yy.lexer=D,K.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Lt=D.yylloc;e.push(Lt);var Se=D.options&&D.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){g.length=g.length-2*R,A.length=A.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=f.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(f=R,R=f.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,Z,W,Et,lt={},bt,M,ee,St;;){if(Z=g[g.length-1],this.defaultActions[Z]?W=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=te()),W=pt[Z]&&pt[Z][B]),typeof W>"u"||!W.length||!W[0]){var Dt="";St=[];for(bt in pt[Z])this.terminals_[bt]&&bt>qe&&St.push("'"+this.terminals_[bt]+"'");D.showPosition?Dt="Parse error on line "+(qt+1)+`: `+D.showPosition()+` Expecting `+St.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Dt="Parse error on line "+(qt+1)+": Unexpected "+(B==$t?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Dt,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:Lt,expected:St})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Z+", token: "+B);switch(W[0]){case 1:g.push(B),A.push(D.yytext),e.push(D.yylloc),g.push(W[1]),B=null,Jt=D.yyleng,s=D.yytext,qt=D.yylineno,Lt=D.yylloc;break;case 2:if(M=this.productions_[W[1]][1],lt.$=A[A.length-M],lt._$={first_line:e[e.length-(M||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(M||1)].first_column,last_column:e[e.length-1].last_column},Se&&(lt._$.range=[e[e.length-(M||1)].range[0],e[e.length-1].range[1]]),Et=this.performAction.apply(lt,[s,Jt,qt,K.yy,W[1],A,e].concat(be)),typeof Et<"u")return Et;M&&(g=g.slice(0,-1*M*2),A=A.slice(0,-1*M),e=e.slice(0,-1*M)),g.push(this.productions_[W[1]][0]),A.push(lt.$),e.push(lt._$),ee=pt[g[g.length-2]][g[g.length-1]],g.push(ee);break;case 3:return!0}}return!0},"parse")},me=(function(){var j={EOF:1,parseError:o(function(l,g){if(this.yy.parser)this.yy.parser.parseError(l,g);else throw new Error(l)},"parseError"),setInput:o(function(r,l){return this.yy=l||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:o(function(r){var l=r.length,g=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===f.length?this.yylloc.first_column:0)+f[f.length-g.length].length-g[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(r){this.unput(this.match.slice(r))},"less"),pastInput:o(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js b/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-nUeJW8RG.js similarity index 84% rename from amplifier_web/static/assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js rename to amplifier_web/static/assets/railroadDiagram-O6MQD6OU-nUeJW8RG.js index f39555fac..e8e6df56d 100644 --- a/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-ByMdCyuE.js +++ b/amplifier_web/static/assets/railroadDiagram-O6MQD6OU-nUeJW8RG.js @@ -1 +1 @@ -import{g as s,r as l,d as t}from"./chunk-SVP7TREG-DegBQCYH.js";import{p as m}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{_ as n,l as i}from"./mermaid.core-BQ5lTCZr.js";import{M as p,c as u}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; +import{g as s,r as l,d as t}from"./chunk-SVP7TREG-Wjd95MYc.js";import{p as m}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{_ as n,l as i}from"./mermaid.core-YRnlneqM.js";import{M as p,c as u}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; diff --git a/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js b/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-Cb83i4fD.js similarity index 99% rename from amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js rename to amplifier_web/static/assets/requirementDiagram-BXWQKSXE-Cb83i4fD.js index 20beef1c9..f5fb2b635 100644 --- a/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-DEA-5bvx.js +++ b/amplifier_web/static/assets/requirementDiagram-BXWQKSXE-Cb83i4fD.js @@ -1,4 +1,4 @@ -import{g as ze}from"./chunk-XXDRQBXY-DdE0HtLo.js";import{s as Xe}from"./chunk-POPQ4Y6H-C_hQ_kWj.js";import{_ as d,y as Be,b as Je,a as Ze,s as et,g as tt,n as st,o as it,c as Ne,l as qe,p as rt,t as nt,u as at,v as lt,x as ct}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Ce=(function(){var e=d(function($,i,n,l){for(n=n||{},l=$.length;l--;n[$[l]]=i);return n},"o"),r=[1,3],u=[1,4],h=[1,5],o=[1,6],c=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,22],p=[2,7],y=[1,26],f=[1,27],m=[1,28],k=[1,29],C=[1,33],V=[1,34],A=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],_=[1,39],S=[1,40],g=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ve=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ee=[27,29],Ae=[1,70],ve=[1,71],Le=[1,72],xe=[1,73],Oe=[1,74],we=[1,75],De=[1,76],ee=[1,83],U=[1,80],te=[1,84],se=[1,85],ie=[1,86],re=[1,87],ne=[1,88],ae=[1,89],le=[1,90],ce=[1,91],oe=[1,92],pe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],Me=[1,101],Fe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],N=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],he=[1,116],ue=[1,117],fe=[1,114],me=[1,115],Se={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:d(function(i,n,l,s,R,t,de){var a=t.length-1;switch(R){case 4:this.$=t[a].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[a].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[a-3],t[a-4]);break;case 22:s.addRequirement(t[a-5],t[a-6]),s.setClass([t[a-5]],t[a-3]);break;case 23:s.setNewReqId(t[a-2]);break;case 24:s.setNewReqText(t[a-2]);break;case 25:s.setNewReqRisk(t[a-2]);break;case 26:s.setNewReqVerifyMethod(t[a-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[a-3]);break;case 43:s.addElement(t[a-5]),s.setClass([t[a-5]],t[a-3]);break;case 44:s.setNewElementType(t[a-2]);break;case 45:s.setNewElementDocRef(t[a-2]);break;case 48:s.addRelationship(t[a-2],t[a],t[a-4]);break;case 49:s.addRelationship(t[a-2],t[a-4],t[a]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[a-2],s.defineClass(t[a-1],t[a]);break;case 58:s.setClass(t[a-1],t[a]);break;case 59:s.setClass([t[a-2]],t[a]);break;case 60:case 62:this.$=[t[a]];break;case 61:case 63:this.$=t[a-2].concat([t[a]]);break;case 64:this.$=t[a-2],s.setCssStyle(t[a-1],t[a]);break;case 65:this.$=[t[a]];break;case 66:t[a-2].push(t[a]),this.$=t[a-2];break;case 68:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,6:r,9:u,11:h,13:o},{1:[3]},{3:8,4:2,5:[1,7],6:r,9:u,11:h,13:o},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(c,[2,6]),{3:12,4:2,6:r,9:u,11:h,13:o},{1:[2,2]},{4:17,5:E,7:13,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},e(c,[2,4]),e(c,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:E,7:42,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:43,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:44,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:45,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:46,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:47,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:48,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:49,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:50,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),{30:60,33:62,75:P,89:_,90:S},{30:63,33:62,75:P,89:_,90:S},{30:64,33:62,75:P,89:_,90:S},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ve,[2,81]),e(Ve,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(Ee,[2,79]),e(Ee,[2,80]),{27:[1,67],29:[1,68]},e(Ee,[2,85]),e(Ee,[2,86]),{62:69,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{62:77,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{30:78,33:62,75:P,89:_,90:S},{73:79,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,60]),e(pe,[2,62]),{73:93,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},{30:94,33:62,75:P,76:U,89:_,90:S},{5:[1,95]},{30:96,33:62,75:P,89:_,90:S},{5:[1,97]},{30:98,33:62,75:P,89:_,90:S},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(g,[2,59],{76:U}),e(g,[2,64],{76:Me}),{33:103,75:[1,102],89:_,90:S},e(Fe,[2,65],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),e(N,[2,67]),e(N,[2,69]),e(N,[2,70]),e(N,[2,71]),e(N,[2,72]),e(N,[2,73]),e(N,[2,74]),e(N,[2,75]),e(N,[2,76]),e(N,[2,77]),e(N,[2,78]),e(g,[2,57],{76:Me}),e(g,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:he,40:ue,56:113,57:fe,59:me},{27:[1,118],76:U},{33:119,89:_,90:S},{33:120,89:_,90:S},{75:ee,78:121,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,61]),e(pe,[2,63]),e(N,[2,68]),e(g,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(g,[2,28]),{5:[1,127]},e(g,[2,42]),{32:[1,128]},{32:[1,129]},{5:he,40:ue,56:130,57:fe,59:me},e(g,[2,47]),{5:[1,131]},e(g,[2,48]),e(g,[2,49]),e(Fe,[2,66],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),{33:132,89:_,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(g,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(g,[2,46]),{5:he,40:ue,56:152,57:fe,59:me},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(g,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(g,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:he,40:ue,56:163,57:fe,59:me},{5:he,40:ue,56:164,57:fe,59:me},e(g,[2,23]),e(g,[2,24]),e(g,[2,25]),e(g,[2,26]),e(g,[2,44]),e(g,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:d(function(i,n){if(n.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=n,l}},"parseError"),parse:d(function(i){var n=this,l=[0],s=[],R=[null],t=[],de=this.table,a="",ge=0,$e=0,Ke=2,Pe=1,We=t.slice.call(arguments,1),b=Object.create(this.lexer),G={yy:{}};for(var be in this.yy)Object.prototype.hasOwnProperty.call(this.yy,be)&&(G.yy[be]=this.yy[be]);b.setInput(i,G.yy),G.yy.lexer=b,G.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Ie=b.yylloc;t.push(Ie);var je=b.options&&b.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ge(T){l.length=l.length-2*T,R.length=R.length-T,t.length=t.length-T}d(Ge,"popStack");function Ue(){var T;return T=s.pop()||b.lex()||Pe,typeof T!="number"&&(T instanceof Array&&(s=T,T=s.pop()),T=n.symbols_[T]||T),T}d(Ue,"lex");for(var I,z,q,Te,J={},ye,F,Ye,_e;;){if(z=l[l.length-1],this.defaultActions[z]?q=this.defaultActions[z]:((I===null||typeof I>"u")&&(I=Ue()),q=de[z]&&de[z][I]),typeof q>"u"||!q.length||!q[0]){var ke="";_e=[];for(ye in de[z])this.terminals_[ye]&&ye>Ke&&_e.push("'"+this.terminals_[ye]+"'");b.showPosition?ke="Parse error on line "+(ge+1)+`: +import{g as ze}from"./chunk-XXDRQBXY-CEoTwp0p.js";import{s as Xe}from"./chunk-POPQ4Y6H-OaNnn-K8.js";import{_ as d,y as Be,b as Je,a as Ze,s as et,g as tt,n as st,o as it,c as Ne,l as qe,p as rt,t as nt,u as at,v as lt,x as ct}from"./mermaid.core-YRnlneqM.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var Ce=(function(){var e=d(function($,i,n,l){for(n=n||{},l=$.length;l--;n[$[l]]=i);return n},"o"),r=[1,3],u=[1,4],h=[1,5],o=[1,6],c=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,22],p=[2,7],y=[1,26],f=[1,27],m=[1,28],k=[1,29],C=[1,33],V=[1,34],A=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],_=[1,39],S=[1,40],g=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ve=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ee=[27,29],Ae=[1,70],ve=[1,71],Le=[1,72],xe=[1,73],Oe=[1,74],we=[1,75],De=[1,76],ee=[1,83],U=[1,80],te=[1,84],se=[1,85],ie=[1,86],re=[1,87],ne=[1,88],ae=[1,89],le=[1,90],ce=[1,91],oe=[1,92],pe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],Me=[1,101],Fe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],N=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],he=[1,116],ue=[1,117],fe=[1,114],me=[1,115],Se={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:d(function(i,n,l,s,R,t,de){var a=t.length-1;switch(R){case 4:this.$=t[a].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[a].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[a-3],t[a-4]);break;case 22:s.addRequirement(t[a-5],t[a-6]),s.setClass([t[a-5]],t[a-3]);break;case 23:s.setNewReqId(t[a-2]);break;case 24:s.setNewReqText(t[a-2]);break;case 25:s.setNewReqRisk(t[a-2]);break;case 26:s.setNewReqVerifyMethod(t[a-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[a-3]);break;case 43:s.addElement(t[a-5]),s.setClass([t[a-5]],t[a-3]);break;case 44:s.setNewElementType(t[a-2]);break;case 45:s.setNewElementDocRef(t[a-2]);break;case 48:s.addRelationship(t[a-2],t[a],t[a-4]);break;case 49:s.addRelationship(t[a-2],t[a-4],t[a]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[a-2],s.defineClass(t[a-1],t[a]);break;case 58:s.setClass(t[a-1],t[a]);break;case 59:s.setClass([t[a-2]],t[a]);break;case 60:case 62:this.$=[t[a]];break;case 61:case 63:this.$=t[a-2].concat([t[a]]);break;case 64:this.$=t[a-2],s.setCssStyle(t[a-1],t[a]);break;case 65:this.$=[t[a]];break;case 66:t[a-2].push(t[a]),this.$=t[a-2];break;case 68:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,6:r,9:u,11:h,13:o},{1:[3]},{3:8,4:2,5:[1,7],6:r,9:u,11:h,13:o},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(c,[2,6]),{3:12,4:2,6:r,9:u,11:h,13:o},{1:[2,2]},{4:17,5:E,7:13,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},e(c,[2,4]),e(c,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:E,7:42,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:43,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:44,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:45,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:46,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:47,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:48,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:49,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:50,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:f,23:m,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),{30:60,33:62,75:P,89:_,90:S},{30:63,33:62,75:P,89:_,90:S},{30:64,33:62,75:P,89:_,90:S},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ve,[2,81]),e(Ve,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(Ee,[2,79]),e(Ee,[2,80]),{27:[1,67],29:[1,68]},e(Ee,[2,85]),e(Ee,[2,86]),{62:69,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{62:77,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{30:78,33:62,75:P,89:_,90:S},{73:79,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,60]),e(pe,[2,62]),{73:93,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},{30:94,33:62,75:P,76:U,89:_,90:S},{5:[1,95]},{30:96,33:62,75:P,89:_,90:S},{5:[1,97]},{30:98,33:62,75:P,89:_,90:S},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(g,[2,59],{76:U}),e(g,[2,64],{76:Me}),{33:103,75:[1,102],89:_,90:S},e(Fe,[2,65],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),e(N,[2,67]),e(N,[2,69]),e(N,[2,70]),e(N,[2,71]),e(N,[2,72]),e(N,[2,73]),e(N,[2,74]),e(N,[2,75]),e(N,[2,76]),e(N,[2,77]),e(N,[2,78]),e(g,[2,57],{76:Me}),e(g,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:he,40:ue,56:113,57:fe,59:me},{27:[1,118],76:U},{33:119,89:_,90:S},{33:120,89:_,90:S},{75:ee,78:121,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,61]),e(pe,[2,63]),e(N,[2,68]),e(g,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(g,[2,28]),{5:[1,127]},e(g,[2,42]),{32:[1,128]},{32:[1,129]},{5:he,40:ue,56:130,57:fe,59:me},e(g,[2,47]),{5:[1,131]},e(g,[2,48]),e(g,[2,49]),e(Fe,[2,66],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),{33:132,89:_,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(g,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(g,[2,46]),{5:he,40:ue,56:152,57:fe,59:me},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(g,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(g,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:he,40:ue,56:163,57:fe,59:me},{5:he,40:ue,56:164,57:fe,59:me},e(g,[2,23]),e(g,[2,24]),e(g,[2,25]),e(g,[2,26]),e(g,[2,44]),e(g,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:d(function(i,n){if(n.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=n,l}},"parseError"),parse:d(function(i){var n=this,l=[0],s=[],R=[null],t=[],de=this.table,a="",ge=0,$e=0,Ke=2,Pe=1,We=t.slice.call(arguments,1),b=Object.create(this.lexer),G={yy:{}};for(var be in this.yy)Object.prototype.hasOwnProperty.call(this.yy,be)&&(G.yy[be]=this.yy[be]);b.setInput(i,G.yy),G.yy.lexer=b,G.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Ie=b.yylloc;t.push(Ie);var je=b.options&&b.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ge(T){l.length=l.length-2*T,R.length=R.length-T,t.length=t.length-T}d(Ge,"popStack");function Ue(){var T;return T=s.pop()||b.lex()||Pe,typeof T!="number"&&(T instanceof Array&&(s=T,T=s.pop()),T=n.symbols_[T]||T),T}d(Ue,"lex");for(var I,z,q,Te,J={},ye,F,Ye,_e;;){if(z=l[l.length-1],this.defaultActions[z]?q=this.defaultActions[z]:((I===null||typeof I>"u")&&(I=Ue()),q=de[z]&&de[z][I]),typeof q>"u"||!q.length||!q[0]){var ke="";_e=[];for(ye in de[z])this.terminals_[ye]&&ye>Ke&&_e.push("'"+this.terminals_[ye]+"'");b.showPosition?ke="Parse error on line "+(ge+1)+`: `+b.showPosition()+` Expecting `+_e.join(", ")+", got '"+(this.terminals_[I]||I)+"'":ke="Parse error on line "+(ge+1)+": Unexpected "+(I==Pe?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(ke,{text:b.match,token:this.terminals_[I]||I,line:b.yylineno,loc:Ie,expected:_e})}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+I);switch(q[0]){case 1:l.push(I),R.push(b.yytext),t.push(b.yylloc),l.push(q[1]),I=null,$e=b.yyleng,a=b.yytext,ge=b.yylineno,Ie=b.yylloc;break;case 2:if(F=this.productions_[q[1]][1],J.$=R[R.length-F],J._$={first_line:t[t.length-(F||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(F||1)].first_column,last_column:t[t.length-1].last_column},je&&(J._$.range=[t[t.length-(F||1)].range[0],t[t.length-1].range[1]]),Te=this.performAction.apply(J,[a,$e,ge,G.yy,q[1],R,t].concat(We)),typeof Te<"u")return Te;F&&(l=l.slice(0,-1*F*2),R=R.slice(0,-1*F),t=t.slice(0,-1*F)),l.push(this.productions_[q[1]][0]),R.push(J.$),t.push(J._$),Ye=de[l[l.length-2]][l[l.length-1]],l.push(Ye);break;case 3:return!0}}return!0},"parse")},He=(function(){var $={EOF:1,parseError:d(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:d(function(i,n){return this.yy=n||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var n=i.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:d(function(i){var n=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===s.length?this.yylloc.first_column:0)+s[s.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(i){this.unput(this.match.slice(i))},"less"),pastInput:d(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var i=this.pastInput(),n=new Array(i.length+1).join("-");return i+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js b/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Dv0jV2ka.js similarity index 99% rename from amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js rename to amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Dv0jV2ka.js index e1fe9c3a1..4256794a5 100644 --- a/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Sw8LLWTQ.js +++ b/amplifier_web/static/assets/sankeyDiagram-P5KCCOFB-Dv0jV2ka.js @@ -1,4 +1,4 @@ -import{n as xt,o as _t,s as vt,g as bt,b as St,a as wt,_ as d,c as lt,b6 as Lt,j as H,X as Et,p as At,k as Tt}from"./mermaid.core-BQ5lTCZr.js";import{o as Mt}from"./ordinal-Cboi1Yqb.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function Nt(t){for(var n=t.length/6|0,s=new Array(n),a=0;a=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s=u)&&(s=u)}return s}function pt(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s>a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function nt(t,n){let s=0;if(n===void 0)for(let a of t)(a=+a)&&(s+=a);else{let a=-1;for(let u of t)(u=+n(u,++a,t))&&(s+=u)}return s}function Pt(t){return t.target.depth}function It(t){return t.depth}function Ot(t,n){return n-1-t.height}function kt(t,n){return t.sourceLinks.length?t.depth:n-1}function $t(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?pt(t.sourceLinks,Pt)-1:0}function q(t){return function(){return t}}function ut(t,n){return Q(t.source,n.source)||t.index-n.index}function ht(t,n){return Q(t.target,n.target)||t.index-n.index}function Q(t,n){return t.y0-n.y0}function it(t){return t.value}function jt(t){return t.index}function Dt(t){return t.nodes}function zt(t){return t.links}function ft(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function yt({nodes:t}){for(const n of t){let s=n.y0,a=s;for(const u of n.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of n.targetLinks)u.y1=a+u.width/2,a+=u.width}}function Bt(){let t=0,n=0,s=1,a=1,u=24,y=8,p,m=jt,o=kt,l,h,x=Dt,_=zt,g=6;function v(){const i={nodes:x.apply(null,arguments),links:_.apply(null,arguments)};return T(i),A(i),M(i),I(i),S(i),yt(i),i}v.update=function(i){return yt(i),i},v.nodeId=function(i){return arguments.length?(m=typeof i=="function"?i:q(i),v):m},v.nodeAlign=function(i){return arguments.length?(o=typeof i=="function"?i:q(i),v):o},v.nodeSort=function(i){return arguments.length?(l=i,v):l},v.nodeWidth=function(i){return arguments.length?(u=+i,v):u},v.nodePadding=function(i){return arguments.length?(y=p=+i,v):y},v.nodes=function(i){return arguments.length?(x=typeof i=="function"?i:q(i),v):x},v.links=function(i){return arguments.length?(_=typeof i=="function"?i:q(i),v):_},v.linkSort=function(i){return arguments.length?(h=i,v):h},v.size=function(i){return arguments.length?(t=n=0,s=+i[0],a=+i[1],v):[s-t,a-n]},v.extent=function(i){return arguments.length?(t=+i[0][0],s=+i[1][0],n=+i[0][1],a=+i[1][1],v):[[t,n],[s,a]]},v.iterations=function(i){return arguments.length?(g=+i,v):g};function T({nodes:i,links:f}){for(const[e,r]of i.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(i.map((e,r)=>[m(e,r,i),e]));for(const[e,r]of f.entries()){r.index=e;let{source:k,target:b}=r;typeof k!="object"&&(k=r.source=ft(c,k)),typeof b!="object"&&(b=r.target=ft(c,b)),k.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of i)e.sort(h),r.sort(h)}function A({nodes:i}){for(const f of i)f.value=f.fixedValue===void 0?Math.max(nt(f.sourceLinks,it),nt(f.targetLinks,it)):f.fixedValue}function M({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.depth=r;for(const{target:b}of k.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.height=r;for(const{source:b}of k.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:i}){const f=ct(i,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of i){const k=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=k,r.x0=t+k*c,r.x1=r.x0+u,e[k]?e[k].push(r):e[k]=[r]}if(l)for(const r of e)r.sort(l);return e}function j(i){const f=pt(i,c=>(a-n-(c.length-1)*p)/nt(c,it));for(const c of i){let e=n;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+p;for(const k of r.sourceLinks)k.width=k.value*f}e=(a-e+p)/(c.length+1);for(let r=0;rc.length)-1)),j(f);for(let c=0;c0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function R(i,f,c){for(let e=i.length,r=e-2;r>=0;--r){const k=i[r];for(const b of k){let L=0,B=0;for(const{target:X,value:et}of b.sourceLinks){let Y=et*(X.layer-b.layer);L+=E(b,X)*Y,B+=Y}if(!(B>0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function D(i,f){const c=i.length>>1,e=i[c];O(i,e.y0-p,c-1,f),V(i,e.y1+p,c+1,f),O(i,a,i.length-1,f),V(i,n,0,f)}function V(i,f,c,e){for(;c1e-6&&(r.y0+=k,r.y1+=k),f=r.y1+p}}function O(i,f,c,e){for(;c>=0;--c){const r=i[c],k=(r.y1-f)*e;k>1e-6&&(r.y0-=k,r.y1-=k),f=r.y0-p}}function z({sourceLinks:i,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ht);for(const{target:{targetLinks:c}}of i)c.sort(ut)}}function w(i){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of i)f.sort(ht),c.sort(ut)}function P(i,f){let c=i.y0-(i.sourceLinks.length-1)*p/2;for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c+=r+p}for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c-=r}return c}function E(i,f){let c=f.y0-(f.targetLinks.length-1)*p/2;for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c+=r+p}for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c-=r}return c}return v}var rt=Math.PI,st=2*rt,F=1e-6,Ft=st-F;function ot(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function mt(){return new ot}ot.prototype=mt.prototype={constructor:ot,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,a){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+a)},bezierCurveTo:function(t,n,s,a,u,y){this._+="C"+ +t+","+ +n+","+ +s+","+ +a+","+(this._x1=+u)+","+(this._y1=+y)},arcTo:function(t,n,s,a,u){t=+t,n=+n,s=+s,a=+a,u=+u;var y=this._x1,p=this._y1,m=s-t,o=a-n,l=y-t,h=p-n,x=l*l+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(x>F)if(!(Math.abs(h*m-o*l)>F)||!u)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var _=s-y,g=a-p,v=m*m+o*o,T=_*_+g*g,A=Math.sqrt(v),M=Math.sqrt(x),I=u*Math.tan((rt-Math.acos((v+x-T)/(2*A*M)))/2),N=I/M,j=I/A;Math.abs(N-1)>F&&(this._+="L"+(t+N*l)+","+(n+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>l*g)+","+(this._x1=t+j*m)+","+(this._y1=n+j*o)}},arc:function(t,n,s,a,u,y){t=+t,n=+n,s=+s,y=!!y;var p=s*Math.cos(a),m=s*Math.sin(a),o=t+p,l=n+m,h=1^y,x=y?a-u:u-a;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+l:(Math.abs(this._x1-o)>F||Math.abs(this._y1-l)>F)&&(this._+="L"+o+","+l),s&&(x<0&&(x=x%st+st),x>Ft?this._+="A"+s+","+s+",0,1,"+h+","+(t-p)+","+(n-m)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=l):x>F&&(this._+="A"+s+","+s+",0,"+ +(x>=rt)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=n+s*Math.sin(u))))},rect:function(t,n,s,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +a+"h"+-s+"Z"},toString:function(){return this._}};function dt(t){return function(){return t}}function Rt(t){return t[0]}function Vt(t){return t[1]}var Wt=Array.prototype.slice;function Gt(t){return t.source}function Ut(t){return t.target}function Xt(t){var n=Gt,s=Ut,a=Rt,u=Vt,y=null;function p(){var m,o=Wt.call(arguments),l=n.apply(this,o),h=s.apply(this,o);if(y||(y=m=mt()),t(y,+a.apply(this,(o[0]=l,o)),+u.apply(this,o),+a.apply(this,(o[0]=h,o)),+u.apply(this,o)),m)return y=null,m+""||null}return p.source=function(m){return arguments.length?(n=m,p):n},p.target=function(m){return arguments.length?(s=m,p):s},p.x=function(m){return arguments.length?(a=typeof m=="function"?m:dt(+m),p):a},p.y=function(m){return arguments.length?(u=typeof m=="function"?m:dt(+m),p):u},p.context=function(m){return arguments.length?(y=m??null,p):y},p}function Yt(t,n,s,a,u){t.moveTo(n,s),t.bezierCurveTo(n=(n+a)/2,s,n,u,a,u)}function Ht(){return Xt(Yt)}function qt(t){return[t.source.x1,t.y0]}function Qt(t){return[t.target.x0,t.y1]}function Kt(){return Ht().source(qt).target(Qt)}var at=(function(){var t=d(function(m,o,l,h){for(l=l||{},h=m.length;h--;l[m[h]]=o);return l},"o"),n=[1,9],s=[1,10],a=[1,5,10,12],u={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:d(function(o,l,h,x,_,g,v){var T=g.length-1;switch(_){case 7:const A=x.findOrCreateNode(g[T-4].trim().replaceAll('""','"')),M=x.findOrCreateNode(g[T-2].trim().replaceAll('""','"')),I=parseFloat(g[T].trim());x.addLink(A,M,I);break;case 8:case 9:case 11:this.$=g[T];break;case 10:this.$=g[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:d(function(o,l){if(l.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=l,h}},"parseError"),parse:d(function(o){var l=this,h=[0],x=[],_=[null],g=[],v=this.table,T="",A=0,M=0,I=2,N=1,j=g.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(C.yy[R]=this.yy[R]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;g.push(D);var V=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,g.length=g.length-L}d(O,"popStack");function z(){var L;return L=x.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(x=L,L=x.pop()),L=l.symbols_[L]||L),L}d(z,"lex");for(var w,P,E,i,f={},c,e,r,k;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=z()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";k=[];for(c in v[P])this.terminals_[c]&&c>I&&k.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: +import{n as xt,o as _t,s as vt,g as bt,b as St,a as wt,_ as d,c as lt,b6 as Lt,j as H,X as Et,p as At,k as Tt}from"./mermaid.core-YRnlneqM.js";import{o as Mt}from"./ordinal-Cboi1Yqb.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";import"./init-Gi6I4Gst.js";function Nt(t){for(var n=t.length/6|0,s=new Array(n),a=0;a=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s=u)&&(s=u)}return s}function pt(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s>a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function nt(t,n){let s=0;if(n===void 0)for(let a of t)(a=+a)&&(s+=a);else{let a=-1;for(let u of t)(u=+n(u,++a,t))&&(s+=u)}return s}function Pt(t){return t.target.depth}function It(t){return t.depth}function Ot(t,n){return n-1-t.height}function kt(t,n){return t.sourceLinks.length?t.depth:n-1}function $t(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?pt(t.sourceLinks,Pt)-1:0}function q(t){return function(){return t}}function ut(t,n){return Q(t.source,n.source)||t.index-n.index}function ht(t,n){return Q(t.target,n.target)||t.index-n.index}function Q(t,n){return t.y0-n.y0}function it(t){return t.value}function jt(t){return t.index}function Dt(t){return t.nodes}function zt(t){return t.links}function ft(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function yt({nodes:t}){for(const n of t){let s=n.y0,a=s;for(const u of n.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of n.targetLinks)u.y1=a+u.width/2,a+=u.width}}function Bt(){let t=0,n=0,s=1,a=1,u=24,y=8,p,m=jt,o=kt,l,h,x=Dt,_=zt,g=6;function v(){const i={nodes:x.apply(null,arguments),links:_.apply(null,arguments)};return T(i),A(i),M(i),I(i),S(i),yt(i),i}v.update=function(i){return yt(i),i},v.nodeId=function(i){return arguments.length?(m=typeof i=="function"?i:q(i),v):m},v.nodeAlign=function(i){return arguments.length?(o=typeof i=="function"?i:q(i),v):o},v.nodeSort=function(i){return arguments.length?(l=i,v):l},v.nodeWidth=function(i){return arguments.length?(u=+i,v):u},v.nodePadding=function(i){return arguments.length?(y=p=+i,v):y},v.nodes=function(i){return arguments.length?(x=typeof i=="function"?i:q(i),v):x},v.links=function(i){return arguments.length?(_=typeof i=="function"?i:q(i),v):_},v.linkSort=function(i){return arguments.length?(h=i,v):h},v.size=function(i){return arguments.length?(t=n=0,s=+i[0],a=+i[1],v):[s-t,a-n]},v.extent=function(i){return arguments.length?(t=+i[0][0],s=+i[1][0],n=+i[0][1],a=+i[1][1],v):[[t,n],[s,a]]},v.iterations=function(i){return arguments.length?(g=+i,v):g};function T({nodes:i,links:f}){for(const[e,r]of i.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(i.map((e,r)=>[m(e,r,i),e]));for(const[e,r]of f.entries()){r.index=e;let{source:k,target:b}=r;typeof k!="object"&&(k=r.source=ft(c,k)),typeof b!="object"&&(b=r.target=ft(c,b)),k.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of i)e.sort(h),r.sort(h)}function A({nodes:i}){for(const f of i)f.value=f.fixedValue===void 0?Math.max(nt(f.sourceLinks,it),nt(f.targetLinks,it)):f.fixedValue}function M({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.depth=r;for(const{target:b}of k.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const k of c){k.height=r;for(const{source:b}of k.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:i}){const f=ct(i,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of i){const k=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=k,r.x0=t+k*c,r.x1=r.x0+u,e[k]?e[k].push(r):e[k]=[r]}if(l)for(const r of e)r.sort(l);return e}function j(i){const f=pt(i,c=>(a-n-(c.length-1)*p)/nt(c,it));for(const c of i){let e=n;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+p;for(const k of r.sourceLinks)k.width=k.value*f}e=(a-e+p)/(c.length+1);for(let r=0;rc.length)-1)),j(f);for(let c=0;c0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function R(i,f,c){for(let e=i.length,r=e-2;r>=0;--r){const k=i[r];for(const b of k){let L=0,B=0;for(const{target:X,value:et}of b.sourceLinks){let Y=et*(X.layer-b.layer);L+=E(b,X)*Y,B+=Y}if(!(B>0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&k.sort(Q),D(k,c)}}function D(i,f){const c=i.length>>1,e=i[c];O(i,e.y0-p,c-1,f),V(i,e.y1+p,c+1,f),O(i,a,i.length-1,f),V(i,n,0,f)}function V(i,f,c,e){for(;c1e-6&&(r.y0+=k,r.y1+=k),f=r.y1+p}}function O(i,f,c,e){for(;c>=0;--c){const r=i[c],k=(r.y1-f)*e;k>1e-6&&(r.y0-=k,r.y1-=k),f=r.y0-p}}function z({sourceLinks:i,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ht);for(const{target:{targetLinks:c}}of i)c.sort(ut)}}function w(i){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of i)f.sort(ht),c.sort(ut)}function P(i,f){let c=i.y0-(i.sourceLinks.length-1)*p/2;for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c+=r+p}for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c-=r}return c}function E(i,f){let c=f.y0-(f.targetLinks.length-1)*p/2;for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c+=r+p}for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c-=r}return c}return v}var rt=Math.PI,st=2*rt,F=1e-6,Ft=st-F;function ot(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function mt(){return new ot}ot.prototype=mt.prototype={constructor:ot,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,a){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+a)},bezierCurveTo:function(t,n,s,a,u,y){this._+="C"+ +t+","+ +n+","+ +s+","+ +a+","+(this._x1=+u)+","+(this._y1=+y)},arcTo:function(t,n,s,a,u){t=+t,n=+n,s=+s,a=+a,u=+u;var y=this._x1,p=this._y1,m=s-t,o=a-n,l=y-t,h=p-n,x=l*l+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(x>F)if(!(Math.abs(h*m-o*l)>F)||!u)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var _=s-y,g=a-p,v=m*m+o*o,T=_*_+g*g,A=Math.sqrt(v),M=Math.sqrt(x),I=u*Math.tan((rt-Math.acos((v+x-T)/(2*A*M)))/2),N=I/M,j=I/A;Math.abs(N-1)>F&&(this._+="L"+(t+N*l)+","+(n+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>l*g)+","+(this._x1=t+j*m)+","+(this._y1=n+j*o)}},arc:function(t,n,s,a,u,y){t=+t,n=+n,s=+s,y=!!y;var p=s*Math.cos(a),m=s*Math.sin(a),o=t+p,l=n+m,h=1^y,x=y?a-u:u-a;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+l:(Math.abs(this._x1-o)>F||Math.abs(this._y1-l)>F)&&(this._+="L"+o+","+l),s&&(x<0&&(x=x%st+st),x>Ft?this._+="A"+s+","+s+",0,1,"+h+","+(t-p)+","+(n-m)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=l):x>F&&(this._+="A"+s+","+s+",0,"+ +(x>=rt)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=n+s*Math.sin(u))))},rect:function(t,n,s,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +a+"h"+-s+"Z"},toString:function(){return this._}};function dt(t){return function(){return t}}function Rt(t){return t[0]}function Vt(t){return t[1]}var Wt=Array.prototype.slice;function Gt(t){return t.source}function Ut(t){return t.target}function Xt(t){var n=Gt,s=Ut,a=Rt,u=Vt,y=null;function p(){var m,o=Wt.call(arguments),l=n.apply(this,o),h=s.apply(this,o);if(y||(y=m=mt()),t(y,+a.apply(this,(o[0]=l,o)),+u.apply(this,o),+a.apply(this,(o[0]=h,o)),+u.apply(this,o)),m)return y=null,m+""||null}return p.source=function(m){return arguments.length?(n=m,p):n},p.target=function(m){return arguments.length?(s=m,p):s},p.x=function(m){return arguments.length?(a=typeof m=="function"?m:dt(+m),p):a},p.y=function(m){return arguments.length?(u=typeof m=="function"?m:dt(+m),p):u},p.context=function(m){return arguments.length?(y=m??null,p):y},p}function Yt(t,n,s,a,u){t.moveTo(n,s),t.bezierCurveTo(n=(n+a)/2,s,n,u,a,u)}function Ht(){return Xt(Yt)}function qt(t){return[t.source.x1,t.y0]}function Qt(t){return[t.target.x0,t.y1]}function Kt(){return Ht().source(qt).target(Qt)}var at=(function(){var t=d(function(m,o,l,h){for(l=l||{},h=m.length;h--;l[m[h]]=o);return l},"o"),n=[1,9],s=[1,10],a=[1,5,10,12],u={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:d(function(o,l,h,x,_,g,v){var T=g.length-1;switch(_){case 7:const A=x.findOrCreateNode(g[T-4].trim().replaceAll('""','"')),M=x.findOrCreateNode(g[T-2].trim().replaceAll('""','"')),I=parseFloat(g[T].trim());x.addLink(A,M,I);break;case 8:case 9:case 11:this.$=g[T];break;case 10:this.$=g[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:d(function(o,l){if(l.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=l,h}},"parseError"),parse:d(function(o){var l=this,h=[0],x=[],_=[null],g=[],v=this.table,T="",A=0,M=0,I=2,N=1,j=g.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(C.yy[R]=this.yy[R]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;g.push(D);var V=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,g.length=g.length-L}d(O,"popStack");function z(){var L;return L=x.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(x=L,L=x.pop()),L=l.symbols_[L]||L),L}d(z,"lex");for(var w,P,E,i,f={},c,e,r,k;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=z()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";k=[];for(c in v[P])this.terminals_[c]&&c>I&&k.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: `+S.showPosition()+` Expecting `+k.join(", ")+", got '"+(this.terminals_[w]||w)+"'":b="Parse error on line "+(A+1)+": Unexpected "+(w==N?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(b,{text:S.match,token:this.terminals_[w]||w,line:S.yylineno,loc:D,expected:k})}if(E[0]instanceof Array&&E.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+w);switch(E[0]){case 1:h.push(w),_.push(S.yytext),g.push(S.yylloc),h.push(E[1]),w=null,M=S.yyleng,T=S.yytext,A=S.yylineno,D=S.yylloc;break;case 2:if(e=this.productions_[E[1]][1],f.$=_[_.length-e],f._$={first_line:g[g.length-(e||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(e||1)].first_column,last_column:g[g.length-1].last_column},V&&(f._$.range=[g[g.length-(e||1)].range[0],g[g.length-1].range[1]]),i=this.performAction.apply(f,[T,M,A,C.yy,E[1],_,g].concat(j)),typeof i<"u")return i;e&&(h=h.slice(0,-1*e*2),_=_.slice(0,-1*e),g=g.slice(0,-1*e)),h.push(this.productions_[E[1]][0]),_.push(f.$),g.push(f._$),r=v[h[h.length-2]][h[h.length-1]],h.push(r);break;case 3:return!0}}return!0},"parse")},y=(function(){var m={EOF:1,parseError:d(function(l,h){if(this.yy.parser)this.yy.parser.parseError(l,h);else throw new Error(l)},"parseError"),setInput:d(function(o,l){return this.yy=l||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var l=o.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:d(function(o){var l=o.length,h=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===x.length?this.yylloc.first_column:0)+x[x.length-h.length].length-h[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(o){this.unput(this.match.slice(o))},"less"),pastInput:d(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var o=this.pastInput(),l=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js b/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-D69Gj_rf.js similarity index 99% rename from amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js rename to amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-D69Gj_rf.js index 6e8f5b81f..a83c4fd0d 100644 --- a/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-CRJ_wlXl.js +++ b/amplifier_web/static/assets/sequenceDiagram-WJ2MYXX4-D69Gj_rf.js @@ -1,4 +1,4 @@ -import{I as er}from"./chunk-2Q5K7J3B-DR5XPUmF.js";import{_ as x,F as rr,c as j,j as Yt,l as it,G as Me,d as ar,e as sr,k as m,b as De,s as ir,n as nr,a as or,g as cr,o as lr,H as hr,J as dr,p as Tr,i as Wt,x as Z,I as Q,K as kt,L as Be,Z as pr,y as Ft,M as Er,N as Ve}from"./mermaid.core-BQ5lTCZr.js";import{a as ur,g as se,b as dt,d as fr,c as ie,e as ne}from"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var ee=(function(){var e=x(function(ut,N,v,k){for(v=v||{},k=ut.length;k--;v[ut[k]]=N);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],E=[1,14],h=[1,15],p=[1,17],_=[1,18],u=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],P=[1,32],S=[1,33],w=[1,34],M=[1,35],V=[1,36],Y=[1,37],z=[1,38],K=[1,39],X=[1,40],$=[1,42],tt=[1,43],U=[1,44],nt=[1,45],et=[1,46],W=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],wt=[1,74],Dt=[1,80],A=[1,81],D=[1,82],rt=[1,83],at=[1,84],F=[1,85],Ot=[1,86],oe=[1,87],ce=[1,88],le=[1,89],he=[1,90],de=[1,91],Te=[1,92],pe=[1,93],Ee=[1,94],ue=[1,95],fe=[1,96],_e=[1,97],ge=[1,98],xe=[1,99],Ie=[1,100],ye=[1,101],Re=[1,102],Oe=[1,103],Le=[1,104],be=[1,105],Ae=[2,78],Nt=[4,5,17,51,53,54],vt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Gt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],we=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Xt=[5,52],H=[70,71,72,73],ct=[1,151],Jt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(N,v,k,y,G,c,mt){var d=c.length-1;switch(G){case 3:return y.apply(c[d]),c[d];case 4:case 10:this.$=[];break;case 5:case 11:c[d-1].push(c[d]),this.$=c[d-1];break;case 6:case 7:case 12:case 13:this.$=c[d];break;case 8:case 9:case 14:this.$=[];break;case 16:c[d].type="createParticipant",this.$=c[d];break;case 17:c[d-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[d-2])}),c[d-1].push({type:"boxEnd",boxText:c[d-2]}),this.$=c[d-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-2]),sequenceIndexStep:Number(c[d-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-1].actor};break;case 30:y.setDiagramTitle(c[d].substring(6)),this.$=c[d].substring(6);break;case 31:y.setDiagramTitle(c[d].substring(7)),this.$=c[d].substring(7);break;case 32:this.$=c[d].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[d].trim(),y.setAccDescription(this.$);break;case 35:c[d-1].unshift({type:"loopStart",loopText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.LOOP_START}),c[d-1].push({type:"loopEnd",loopText:c[d-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[d-1];break;case 36:c[d-1].unshift({type:"rectStart",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_START}),c[d-1].push({type:"rectEnd",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[d-1];break;case 37:c[d-1].unshift({type:"optStart",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_START}),c[d-1].push({type:"optEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[d-1];break;case 38:c[d-1].unshift({type:"altStart",altText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.ALT_START}),c[d-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[d-1];break;case 39:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 40:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 41:c[d-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.CRITICAL_START}),c[d-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[d-1];break;case 42:c[d-1].unshift({type:"breakStart",breakText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_START}),c[d-1].push({type:"breakEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[d-1];break;case 44:this.$=c[d-3].concat([{type:"option",optionText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[d]]);break;case 46:this.$=c[d-3].concat([{type:"and",parText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.PAR_AND},c[d]]);break;case 48:this.$=c[d-3].concat([{type:"else",altText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.ALT_ELSE},c[d]]);break;case 49:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 50:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 51:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 52:case 57:c[d-1].draw="actor",c[d-1].type="addParticipant",this.$=c[d-1];break;case 53:c[d-1].type="destroyParticipant",this.$=c[d-1];break;case 54:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 55:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 56:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 58:this.$=[c[d-1],{type:"addNote",placement:c[d-2],actor:c[d-1].actor,text:c[d]}];break;case 59:c[d-2]=[].concat(c[d-1],c[d-1]).slice(0,2),c[d-2][0]=c[d-2][0].actor,c[d-2][1]=c[d-2][1].actor,this.$=[c[d-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[d-2].slice(0,2),text:c[d]}];break;case 60:this.$=[c[d-1],{type:"addLinks",actor:c[d-1].actor,text:c[d]}];break;case 61:this.$=[c[d-1],{type:"addALink",actor:c[d-1].actor,text:c[d]}];break;case 62:this.$=[c[d-1],{type:"addProperties",actor:c[d-1].actor,text:c[d]}];break;case 63:this.$=[c[d-1],{type:"addDetails",actor:c[d-1].actor,text:c[d]}];break;case 66:this.$=[c[d-2],c[d]];break;case 67:this.$=c[d];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor}];break;case 71:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-4].actor}];break;case 72:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor}];break;case 73:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-4].actor}];break;case 74:this.$=[c[d-5],c[d-1],{type:"addMessage",from:c[d-5].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-5].actor}];break;case 75:this.$=[c[d-3],c[d-1],{type:"addMessage",from:c[d-3].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d]}];break;case 76:this.$={type:"addParticipant",actor:c[d-1],config:c[d]};break;case 77:this.$=c[d-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[d]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[d].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,5]),{9:48,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:z,53:K,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:W},{23:56,73:W},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:wt},{23:75,55:76,73:wt},{23:77,73:W},{69:78,72:[1,79],78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:W},{23:111,73:W},{23:112,73:W},{23:113,73:W},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],Ae),e(C,[2,6]),e(C,[2,16]),e(Nt,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(vt,i,{7:120}),e(vt,i,{7:121}),e(vt,i,{7:122}),e(Se,i,{41:123,7:124}),e(Gt,i,{43:125,7:126}),e(Gt,i,{7:126,43:127}),e(we,i,{46:128,7:129}),e(vt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Xt,Ae,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:W},{69:146,78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},e(H,[2,79]),e(H,[2,80]),e(H,[2,81]),e(H,[2,82]),e(H,[2,83]),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(H,[2,89]),e(H,[2,90]),e(H,[2,91]),e(H,[2,92]),e(H,[2,93]),e(H,[2,94]),e(H,[2,95]),e(H,[2,96]),e(H,[2,97]),e(H,[2,98]),e(H,[2,99]),e(H,[2,100]),e(H,[2,101]),e(H,[2,102]),e(H,[2,103]),e(H,[2,104]),{23:147,73:W},{23:149,60:148,73:W},{73:[2,68]},{73:[2,69]},{58:150,104:ct},{58:152,104:ct},{58:153,104:ct},{58:154,104:ct},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:z,53:K,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,161],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,162],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,163],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,47],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,50:[1,165],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,45],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,49:[1,167],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,43],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,48:[1,170],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,171],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Xt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:W},{23:178,73:W},{23:179,73:W},{58:180,104:ct},{23:181,72:[1,182],73:W},{58:183,104:ct},{58:184,104:ct},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(Nt,[2,11]),{13:186,51:z,53:K,54:X},e(Nt,[2,13]),e(Nt,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ct},{58:196,104:ct},{58:197,104:ct},{5:[2,75]},{58:198,104:ct},{23:199,73:W},{5:[2,58]},{5:[2,59]},{23:200,73:W},e(Nt,[2,12]),e(Se,i,{7:124,41:201}),e(Gt,i,{7:126,43:202}),e(we,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Xt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ct},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(N,v){if(v.recoverable)this.trace(N);else{var k=new Error(N);throw k.hash=v,k}},"parseError"),parse:x(function(N){var v=this,k=[0],y=[],G=[null],c=[],mt=this.table,d="",Mt=0,Ne=0,Qe=2,me=1,$e=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Zt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Zt)&&(gt.yy[Zt]=this.yy[Zt]);J.setInput(N,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Qt=J.yylloc;c.push(Qt);var je=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tr(ot){k.length=k.length-2*ot,G.length=G.length-ot,c.length=c.length-ot}x(tr,"popStack");function Pe(){var ot;return ot=y.pop()||J.lex()||me,typeof ot!="number"&&(ot instanceof Array&&(y=ot,ot=y.pop()),ot=v.symbols_[ot]||ot),ot}x(Pe,"lex");for(var st,xt,lt,$t,Lt={},Bt,Tt,ke,Vt;;){if(xt=k[k.length-1],this.defaultActions[xt]?lt=this.defaultActions[xt]:((st===null||typeof st>"u")&&(st=Pe()),lt=mt[xt]&&mt[xt][st]),typeof lt>"u"||!lt.length||!lt[0]){var jt="";Vt=[];for(Bt in mt[xt])this.terminals_[Bt]&&Bt>Qe&&Vt.push("'"+this.terminals_[Bt]+"'");J.showPosition?jt="Parse error on line "+(Mt+1)+`: +import{I as er}from"./chunk-2Q5K7J3B-Ca-MXWFO.js";import{_ as x,F as rr,c as j,j as Yt,l as it,G as Me,d as ar,e as sr,k as m,b as De,s as ir,n as nr,a as or,g as cr,o as lr,H as hr,J as dr,p as Tr,i as Wt,x as Z,I as Q,K as kt,L as Be,Z as pr,y as Ft,M as Er,N as Ve}from"./mermaid.core-YRnlneqM.js";import{a as ur,g as se,b as dt,d as fr,c as ie,e as ne}from"./chunk-F27PBJKO-2GmsQB4U.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var ee=(function(){var e=x(function(ut,N,v,k){for(v=v||{},k=ut.length;k--;v[ut[k]]=N);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],E=[1,14],h=[1,15],p=[1,17],_=[1,18],u=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],P=[1,32],S=[1,33],w=[1,34],M=[1,35],V=[1,36],Y=[1,37],z=[1,38],K=[1,39],X=[1,40],$=[1,42],tt=[1,43],U=[1,44],nt=[1,45],et=[1,46],W=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],wt=[1,74],Dt=[1,80],A=[1,81],D=[1,82],rt=[1,83],at=[1,84],F=[1,85],Ot=[1,86],oe=[1,87],ce=[1,88],le=[1,89],he=[1,90],de=[1,91],Te=[1,92],pe=[1,93],Ee=[1,94],ue=[1,95],fe=[1,96],_e=[1,97],ge=[1,98],xe=[1,99],Ie=[1,100],ye=[1,101],Re=[1,102],Oe=[1,103],Le=[1,104],be=[1,105],Ae=[2,78],Nt=[4,5,17,51,53,54],vt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Gt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],we=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Xt=[5,52],H=[70,71,72,73],ct=[1,151],Jt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(N,v,k,y,G,c,mt){var d=c.length-1;switch(G){case 3:return y.apply(c[d]),c[d];case 4:case 10:this.$=[];break;case 5:case 11:c[d-1].push(c[d]),this.$=c[d-1];break;case 6:case 7:case 12:case 13:this.$=c[d];break;case 8:case 9:case 14:this.$=[];break;case 16:c[d].type="createParticipant",this.$=c[d];break;case 17:c[d-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[d-2])}),c[d-1].push({type:"boxEnd",boxText:c[d-2]}),this.$=c[d-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-2]),sequenceIndexStep:Number(c[d-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-1].actor};break;case 30:y.setDiagramTitle(c[d].substring(6)),this.$=c[d].substring(6);break;case 31:y.setDiagramTitle(c[d].substring(7)),this.$=c[d].substring(7);break;case 32:this.$=c[d].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[d].trim(),y.setAccDescription(this.$);break;case 35:c[d-1].unshift({type:"loopStart",loopText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.LOOP_START}),c[d-1].push({type:"loopEnd",loopText:c[d-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[d-1];break;case 36:c[d-1].unshift({type:"rectStart",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_START}),c[d-1].push({type:"rectEnd",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[d-1];break;case 37:c[d-1].unshift({type:"optStart",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_START}),c[d-1].push({type:"optEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[d-1];break;case 38:c[d-1].unshift({type:"altStart",altText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.ALT_START}),c[d-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[d-1];break;case 39:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 40:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 41:c[d-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.CRITICAL_START}),c[d-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[d-1];break;case 42:c[d-1].unshift({type:"breakStart",breakText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_START}),c[d-1].push({type:"breakEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[d-1];break;case 44:this.$=c[d-3].concat([{type:"option",optionText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[d]]);break;case 46:this.$=c[d-3].concat([{type:"and",parText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.PAR_AND},c[d]]);break;case 48:this.$=c[d-3].concat([{type:"else",altText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.ALT_ELSE},c[d]]);break;case 49:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 50:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 51:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 52:case 57:c[d-1].draw="actor",c[d-1].type="addParticipant",this.$=c[d-1];break;case 53:c[d-1].type="destroyParticipant",this.$=c[d-1];break;case 54:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 55:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 56:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 58:this.$=[c[d-1],{type:"addNote",placement:c[d-2],actor:c[d-1].actor,text:c[d]}];break;case 59:c[d-2]=[].concat(c[d-1],c[d-1]).slice(0,2),c[d-2][0]=c[d-2][0].actor,c[d-2][1]=c[d-2][1].actor,this.$=[c[d-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[d-2].slice(0,2),text:c[d]}];break;case 60:this.$=[c[d-1],{type:"addLinks",actor:c[d-1].actor,text:c[d]}];break;case 61:this.$=[c[d-1],{type:"addALink",actor:c[d-1].actor,text:c[d]}];break;case 62:this.$=[c[d-1],{type:"addProperties",actor:c[d-1].actor,text:c[d]}];break;case 63:this.$=[c[d-1],{type:"addDetails",actor:c[d-1].actor,text:c[d]}];break;case 66:this.$=[c[d-2],c[d]];break;case 67:this.$=c[d];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor}];break;case 71:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-4].actor}];break;case 72:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor}];break;case 73:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-4].actor}];break;case 74:this.$=[c[d-5],c[d-1],{type:"addMessage",from:c[d-5].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-5].actor}];break;case 75:this.$=[c[d-3],c[d-1],{type:"addMessage",from:c[d-3].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d]}];break;case 76:this.$={type:"addParticipant",actor:c[d-1],config:c[d]};break;case 77:this.$=c[d-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[d]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[d].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,5]),{9:48,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:z,53:K,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:W},{23:56,73:W},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:wt},{23:75,55:76,73:wt},{23:77,73:W},{69:78,72:[1,79],78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:W},{23:111,73:W},{23:112,73:W},{23:113,73:W},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],Ae),e(C,[2,6]),e(C,[2,16]),e(Nt,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(vt,i,{7:120}),e(vt,i,{7:121}),e(vt,i,{7:122}),e(Se,i,{41:123,7:124}),e(Gt,i,{43:125,7:126}),e(Gt,i,{7:126,43:127}),e(we,i,{46:128,7:129}),e(vt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Xt,Ae,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:W},{69:146,78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},e(H,[2,79]),e(H,[2,80]),e(H,[2,81]),e(H,[2,82]),e(H,[2,83]),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(H,[2,89]),e(H,[2,90]),e(H,[2,91]),e(H,[2,92]),e(H,[2,93]),e(H,[2,94]),e(H,[2,95]),e(H,[2,96]),e(H,[2,97]),e(H,[2,98]),e(H,[2,99]),e(H,[2,100]),e(H,[2,101]),e(H,[2,102]),e(H,[2,103]),e(H,[2,104]),{23:147,73:W},{23:149,60:148,73:W},{73:[2,68]},{73:[2,69]},{58:150,104:ct},{58:152,104:ct},{58:153,104:ct},{58:154,104:ct},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:z,53:K,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,161],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,162],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,163],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,47],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,50:[1,165],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,45],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,49:[1,167],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,43],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,48:[1,170],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,171],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Xt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:W},{23:178,73:W},{23:179,73:W},{58:180,104:ct},{23:181,72:[1,182],73:W},{58:183,104:ct},{58:184,104:ct},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(Nt,[2,11]),{13:186,51:z,53:K,54:X},e(Nt,[2,13]),e(Nt,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ct},{58:196,104:ct},{58:197,104:ct},{5:[2,75]},{58:198,104:ct},{23:199,73:W},{5:[2,58]},{5:[2,59]},{23:200,73:W},e(Nt,[2,12]),e(Se,i,{7:124,41:201}),e(Gt,i,{7:126,43:202}),e(we,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Xt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ct},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(N,v){if(v.recoverable)this.trace(N);else{var k=new Error(N);throw k.hash=v,k}},"parseError"),parse:x(function(N){var v=this,k=[0],y=[],G=[null],c=[],mt=this.table,d="",Mt=0,Ne=0,Qe=2,me=1,$e=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Zt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Zt)&&(gt.yy[Zt]=this.yy[Zt]);J.setInput(N,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Qt=J.yylloc;c.push(Qt);var je=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tr(ot){k.length=k.length-2*ot,G.length=G.length-ot,c.length=c.length-ot}x(tr,"popStack");function Pe(){var ot;return ot=y.pop()||J.lex()||me,typeof ot!="number"&&(ot instanceof Array&&(y=ot,ot=y.pop()),ot=v.symbols_[ot]||ot),ot}x(Pe,"lex");for(var st,xt,lt,$t,Lt={},Bt,Tt,ke,Vt;;){if(xt=k[k.length-1],this.defaultActions[xt]?lt=this.defaultActions[xt]:((st===null||typeof st>"u")&&(st=Pe()),lt=mt[xt]&&mt[xt][st]),typeof lt>"u"||!lt.length||!lt[0]){var jt="";Vt=[];for(Bt in mt[xt])this.terminals_[Bt]&&Bt>Qe&&Vt.push("'"+this.terminals_[Bt]+"'");J.showPosition?jt="Parse error on line "+(Mt+1)+`: `+J.showPosition()+` Expecting `+Vt.join(", ")+", got '"+(this.terminals_[st]||st)+"'":jt="Parse error on line "+(Mt+1)+": Unexpected "+(st==me?"end of input":"'"+(this.terminals_[st]||st)+"'"),this.parseError(jt,{text:J.match,token:this.terminals_[st]||st,line:J.yylineno,loc:Qt,expected:Vt})}if(lt[0]instanceof Array&<.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xt+", token: "+st);switch(lt[0]){case 1:k.push(st),G.push(J.yytext),c.push(J.yylloc),k.push(lt[1]),st=null,Ne=J.yyleng,d=J.yytext,Mt=J.yylineno,Qt=J.yylloc;break;case 2:if(Tt=this.productions_[lt[1]][1],Lt.$=G[G.length-Tt],Lt._$={first_line:c[c.length-(Tt||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(Tt||1)].first_column,last_column:c[c.length-1].last_column},je&&(Lt._$.range=[c[c.length-(Tt||1)].range[0],c[c.length-1].range[1]]),$t=this.performAction.apply(Lt,[d,Ne,Mt,gt.yy,lt[1],G,c].concat($e)),typeof $t<"u")return $t;Tt&&(k=k.slice(0,-1*Tt*2),G=G.slice(0,-1*Tt),c=c.slice(0,-1*Tt)),k.push(this.productions_[lt[1]][0]),G.push(Lt.$),c.push(Lt._$),ke=mt[k[k.length-2]][k[k.length-1]],k.push(ke);break;case 3:return!0}}return!0},"parse")},Ze=(function(){var ut={EOF:1,parseError:x(function(v,k){if(this.yy.parser)this.yy.parser.parseError(v,k);else throw new Error(v)},"parseError"),setInput:x(function(N,v){return this.yy=v||this.yy||{},this._input=N,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:x(function(){var N=this._input[0];this.yytext+=N,this.yyleng++,this.offset++,this.match+=N,this.matched+=N;var v=N.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),N},"input"),unput:x(function(N){var v=N.length,k=N.split(/(?:\r\n?|\n)/g);this._input=N+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),k.length-1&&(this.yylineno-=k.length-1);var G=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===y.length?this.yylloc.first_column:0)+y[y.length-k.length].length-k[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[G[0],G[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:x(function(){return this._more=!0,this},"more"),reject:x(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:x(function(N){this.unput(this.match.slice(N))},"less"),pastInput:x(function(){var N=this.matched.substr(0,this.matched.length-this.match.length);return(N.length>20?"...":"")+N.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:x(function(){var N=this.match;return N.length<20&&(N+=this._input.substr(0,20-N.length)),(N.substr(0,20)+(N.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:x(function(){var N=this.pastInput(),v=new Array(N.length+1).join("-");return N+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/sizeCapture-INFHLROL-CKc8uScH.js b/amplifier_web/static/assets/sizeCapture-INFHLROL-Bt4UpecU.js similarity index 87% rename from amplifier_web/static/assets/sizeCapture-INFHLROL-CKc8uScH.js rename to amplifier_web/static/assets/sizeCapture-INFHLROL-Bt4UpecU.js index c55e5a23e..2948c8f2d 100644 --- a/amplifier_web/static/assets/sizeCapture-INFHLROL-CKc8uScH.js +++ b/amplifier_web/static/assets/sizeCapture-INFHLROL-Bt4UpecU.js @@ -1 +1 @@ -import{_ as n}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var c=1;function a(){if(!(typeof globalThis>"u"))return globalThis}n(a,"getCaptureGlobal");function m(){var o;return!!((o=a())!=null&&o.mermaidCaptureSizes)}n(m,"shouldCaptureSizes");function d(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}n(d,"capturedFromLocation");function s(o,r){const e=a();if(!e)return;const t=r.node(),i=(t&&"ownerSVGElement"in t?t.ownerSVGElement:null)??t,p=(i==null?void 0:i.id)??"(unknown)";e.mermaidCapturedSizes??(e.mermaidCapturedSizes=[]);const u={svgId:p,sizes:o};e.mermaidCapturedSizes.push(u),e.mermaidLastCapturedSizes=u}n(s,"emitCapturedSizes");function l(o,r){const e=[];for(const t of r.nodes)t.isGroup||e.push({id:t.id,width:t.width??0,height:t.height??0});e.length!==0&&s({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:d()},nodes:e},o)}n(l,"captureNodeSizes");export{l as captureNodeSizes,m as shouldCaptureSizes}; +import{_ as n}from"./mermaid.core-YRnlneqM.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var c=1;function a(){if(!(typeof globalThis>"u"))return globalThis}n(a,"getCaptureGlobal");function m(){var o;return!!((o=a())!=null&&o.mermaidCaptureSizes)}n(m,"shouldCaptureSizes");function d(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}n(d,"capturedFromLocation");function s(o,r){const e=a();if(!e)return;const t=r.node(),i=(t&&"ownerSVGElement"in t?t.ownerSVGElement:null)??t,p=(i==null?void 0:i.id)??"(unknown)";e.mermaidCapturedSizes??(e.mermaidCapturedSizes=[]);const u={svgId:p,sizes:o};e.mermaidCapturedSizes.push(u),e.mermaidLastCapturedSizes=u}n(s,"emitCapturedSizes");function l(o,r){const e=[];for(const t of r.nodes)t.isGroup||e.push({id:t.id,width:t.width??0,height:t.height??0});e.length!==0&&s({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:d()},nodes:e},o)}n(l,"captureNodeSizes");export{l as captureNodeSizes,m as shouldCaptureSizes}; diff --git a/amplifier_web/static/assets/stateDiagram-D77RDMKH-sy7Rfo0f.js b/amplifier_web/static/assets/stateDiagram-D77RDMKH-BaS0tICg.js similarity index 96% rename from amplifier_web/static/assets/stateDiagram-D77RDMKH-sy7Rfo0f.js rename to amplifier_web/static/assets/stateDiagram-D77RDMKH-BaS0tICg.js index 70ee9388e..c6eb2671f 100644 --- a/amplifier_web/static/assets/stateDiagram-D77RDMKH-sy7Rfo0f.js +++ b/amplifier_web/static/assets/stateDiagram-D77RDMKH-BaS0tICg.js @@ -1 +1 @@ -import{s as G,a as P,S as N}from"./chunk-IMKFNOWR-D_IoXv7y.js";import{_ as f,c as t,j as H,l as S,d as W,P as _,k as z,Q as U,R as C,M as F,x as O}from"./mermaid.core-BQ5lTCZr.js";import{l as J}from"./layout-xx7K6ykp.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),j=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),q=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Q=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
");p=p.replace(/\n/g,"
");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),Z=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Q(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&j(n),(i.type==="fork"||i.type==="join")&&q(n,i),i.type==="note"&&Z(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),R=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=U().x(function(s){return s.x}).y(function(s){return s.y}).curve(C),p=e.append("path").attr("d",l(n)).attr("id","edge"+R).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=F(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=O.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}R++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;W(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},ht={parser:P,get db(){return new N(1)},renderer:it,styles:G,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ht as diagram}; +import{s as G,a as P,S as N}from"./chunk-IMKFNOWR-qeP8E-nc.js";import{_ as f,c as t,j as H,l as S,d as W,P as _,k as z,Q as U,R as C,M as F,x as O}from"./mermaid.core-YRnlneqM.js";import{l as J}from"./layout-B_w7f5cg.js";import"./chunk-XXDRQBXY-CEoTwp0p.js";import"./chunk-POPQ4Y6H-OaNnn-K8.js";import"./chunk-F27PBJKO-2GmsQB4U.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),j=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),q=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Q=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
");p=p.replace(/\n/g,"
");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),Z=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Q(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&j(n),(i.type==="fork"||i.type==="join")&&q(n,i),i.type==="note"&&Z(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),R=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=U().x(function(s){return s.x}).y(function(s){return s.y}).curve(C),p=e.append("path").attr("d",l(n)).attr("id","edge"+R).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=F(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=O.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}R++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;W(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},ht={parser:P,get db(){return new N(1)},renderer:it,styles:G,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ht as diagram}; diff --git a/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js b/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js deleted file mode 100644 index c5367fec1..000000000 --- a/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-BRTKjL6-.js +++ /dev/null @@ -1 +0,0 @@ -import{s as r,b as e,a,S as s}from"./chunk-IMKFNOWR-D_IoXv7y.js";import{_ as i}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CtqGz6p6.js b/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CtqGz6p6.js new file mode 100644 index 000000000..28cc17f36 --- /dev/null +++ b/amplifier_web/static/assets/stateDiagram-v2-MP3YSRHH-CtqGz6p6.js @@ -0,0 +1 @@ +import{s as r,b as e,a,S as s}from"./chunk-IMKFNOWR-qeP8E-nc.js";import{_ as i}from"./mermaid.core-YRnlneqM.js";import"./chunk-XXDRQBXY-CEoTwp0p.js";import"./chunk-POPQ4Y6H-OaNnn-K8.js";import"./chunk-F27PBJKO-2GmsQB4U.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/amplifier_web/static/assets/swimlanes-42K2YHIH-1QzInuS-.js b/amplifier_web/static/assets/swimlanes-42K2YHIH-BcKWWDjF.js similarity index 99% rename from amplifier_web/static/assets/swimlanes-42K2YHIH-1QzInuS-.js rename to amplifier_web/static/assets/swimlanes-42K2YHIH-BcKWWDjF.js index e92fd6214..dcfeb714f 100644 --- a/amplifier_web/static/assets/swimlanes-42K2YHIH-1QzInuS-.js +++ b/amplifier_web/static/assets/swimlanes-42K2YHIH-BcKWWDjF.js @@ -1 +1 @@ -import{ap as Tr,l as Ln,_ as d,aA as No}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var Oo=5,ze=1e-5,Ve=1e-6;function Je(t){const e=[];for(let n=0;n=1-Ve||I<=Ve||I>=1-Ve?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:I}}d(Do,"segmentIntersection");function En(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(En,"isHorizontalSeg");function Ho(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Xo,"getArcSweepFlag");var Ar=.001;function Yo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&No[e.arrowTypeStart];if(o){const r=t[0],f=t[1],a=Math.atan2(f.y-r.y,f.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&No[e.arrowTypeEnd];if(s){const r=t.length,f=t[r-2],a=t[r-1],l=Math.atan2(a.y-f.y,a.x-f.x);n[r-1].x=a.x-s*Math.cos(l),n[r-1].y=a.y-s*Math.sin(l)}return n}d(Yo,"applyMarkerOffsets");function Go(t,e,n,o,s){const r=t.point.x,f=t.point.y,a={x:r-e*t.r,y:f-n*t.r},l={x:r+e*t.r,y:f+n*t.r},c=[`L${Oe(a)}`];return s==="arc"?c.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(l)}`):c.push(`M${Oe(l)}`),c}d(Go,"emitJump");function Tn(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=n.x-e.x,a=n.y-e.y,l=Math.hypot(s,r),c=Math.hypot(f,a);if(l0){const v=Tn(s[c-1],s[c],s[c+1]??s[c],Oo);v&&(i=v.cutLen)}let x=p,C=null;r&&cv.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-i,x-v.d);for(let v=0;vL){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r=2?o:null}catch{return null}}d(jo,"decodeDataPoints");function Uo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const c of e)s.set(c.id,c);const r=[],f=new Map;for(const c of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(c.id):c.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;f.set(c.id,p);const u=jo(p.getAttribute("data-points"))??c.points;r.push({...c,points:u})}const a=Ho(r);if(a.length===0)return;const l=new Map;for(const c of a){const g=l.get(c.jumpEdgeId)??[];g.push(c),l.set(c.jumpEdgeId,g)}for(const c of r){const g=l.get(c.id);if(!g||g.length===0)continue;const p=s.get(c.id),I=p==null?void 0:p.curve;if(I!==void 0&&!Vo(I))continue;const u=f.get(c.id);if(!u)continue;if(I===void 0){const v=u.getAttribute("d")??"";if(!zo(v))continue}const h=u.getAttribute("style")??"",i=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=i?Number.parseFloat(i[1]):null,C=i?Number.parseFloat(i[2]):null,b=$o(c,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,M=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",M)}}}d(Uo,"applyLineJumpsToSvg");function Wo(t,{measure:e}){var r,f;const n=(f=(r=t.config)==null?void 0:r.swimlane)==null?void 0:f.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(a=>Array.isArray(a.points)&&a.points.length>=2).map(a=>({id:a.id,points:a.points,curve:a.curve,arrowTypeStart:a.arrowTypeStart,arrowTypeEnd:a.arrowTypeEnd}));Uo(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}d(Wo,"applySwimlaneLineJumps");var In="__swimlane_default__",wr=21,Po=20;function An(t){return Math.max(t.padding??Po,Po)}d(An,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const f=n-s/2,a=Math.min(r,n+s/2),l=Math.min(wr,Math.max(0,a-f)),c=f+l;if(c<=f){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:f,bottom:c}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===In);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:In,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=In}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const l of t.nodes??[])e.set(l.id,l);const n=[];for(const l of t.edges??[]){const c=typeof l.start=="string"?l.start:void 0,g=typeof l.end=="string"?l.end:void 0;!c||!g||l.labelNodeId||n.push({id:l.id,src:c,dst:g,ref:l})}const o=t.nodes??[],s=o.filter(l=>l.isGroup),r=o.filter(l=>!l.isGroup);return{nodes:[...[...s].reverse(),...r].map(l=>l.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,f=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let l=0;for(const I of e.layers){let u=0;for(const h of I){const i=r.get(h);if(!i){u++;continue}i.layer=l,i.order=u;const x=n.x[h]??u*a,C=n.y[h]??l*f;i.x=x,i.y=C,u++}l++}const c=s.nodes??[],g=new Map,p=[];for(const I of c){if(!(I!=null&&I.isGroup))continue;I.parentId||p.push(I);const u=c.filter(b=>b.parentId===I.id);let h=1/0,i=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,M=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),i=Math.max(i,v+y/2),x=Math.min(x,L-M/2),C=Math.max(C,L+M/2))}if(h===1/0||x===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const b=I.padding??20,v=I.parentId?b:2*An(I),L=b,y=Math.max(0,i-h)+v,M=Math.max(0,C-x)+L,E=(h+i)/2,w=(x+C)/2;I.x=E,I.y=w,I.width=y,I.height=M,g.set(I.id,{minX:h,maxX:i,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let I=1/0,u=-1/0,h=0;for(const i of p){const x=i.padding??20;x>h&&(h=x);const C=g.get(i.id);C&&(I=Math.min(I,C.minY),u=Math.max(u,C.maxY))}if(I!==1/0&&u!==-1/0){const i=Math.max(0,u-I),C=Math.max(h,36),b=i+2*C,v=(I+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=I;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],M=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*An(B),H=(O.minX+O.maxX)/2;y.push(B.id),M.push(H),E.push(k)}const w=y.length;if(w>0){const B=new Map;if(w===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(ro,"measuredNodeRect");function io(t){if(t.isGroup)return;const e=ro(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(io,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&>(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function co(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(co,"classifyThreeSegmentRoute");function an(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),f=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&fe.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Ze(t,e){return t.lefte.left&&t.tope.top}d(Ze,"rectsOverlap");function wn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(wn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=ro(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Le,"portForRectSide");function lo(t,e,n,o,s,r=Yt){const f=e==="left"||e==="right",a=o==="left"||o==="right";if(f&&a){if(e==="right"&&o==="left"&&t.xn.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!f&&!a){if(e===o){if(gt(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(f&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const l=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return l&&c?[t,{x:t.x,y:n.y},n]:void 0}d(lo,"buildOrthogonalPortPath");function fo(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(fo,"buildSameSideTrackPath");function ln(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=io(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(ln,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=io(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,f=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,f,a)})}return n}d(es,"collectLayoutNodeRects");function uo(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),f=e.get(s);if(!(!r||!f))return{srcId:o,dstId:s,srcInfo:r,dstInfo:f,collinearX:Math.abs(r.cx-f.cx)h||IC)return!1;const b=Math.abs(i-g.a.x)s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Qe(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const f of n){if(f===o||f.isLayoutOnly)continue;const a=f.points;if(!(!a||a.length<2))for(let l=0;lI+s&&hi+s&&po+Yt&&t=2?e[e.length-2]:void 0,l=(f?gt(f,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(l)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(tn,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Nr=.5,Bo=4;function go(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const f=rs(t[s],t[r],e);return n?[f,...t.slice(s)]:[...t.slice(0,s+1),f]}d(Nn,"clipEndpoint");function is(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Nn(s,o.srcRect,!0)),o.dstRect&&(s=Nn(s,o.dstRect,!1)),s=ue(tn(s)),s=mo(s,o.srcRect,o.dstRect),o.edge.points=ue(tn(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function On(t,e,n,o=!1){if(yt(t,e,it)){if(e.yn.bottom+it)return e;if(o){if(t.xn.right+it)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(gt(t,e,it)){if(e.xn.right+it)return e;if(o){if(t.yn.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(On,"snapEndpointToBoundary");function en(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function Bn(t,e){return e==="left"||e==="right"?nn(t.top,t.bottom):nn(t.left,t.right)}d(Bn,"clearanceRangeForSide");function on(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function kn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const f=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,f));if(!(Math.abs(a-f)({...a}));for(let a=e;a>=0&&a=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)o.bottom+it;case"left":return yt(e,n,it)&&n.xo.right+it}}d(Dn,"leavesOutward");function Hn(t,e,n){if(t.length<3)return t;if(n){const r=_n(t[0],t[1],e);return r&&Dn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=_n(t[o-1],t[o],e);return s&&Dn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Hn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=en(o,0,1);if(r){const f=On(r,o[0],e);f!==o[0]&&(o=[f,...o.slice(1)])}o=Hn(o,e,!0)}if(n){const r=o.length-1,f=en(o,r,-1);if(f){const a=On(f,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Hn(o,n,!1)}const s=mo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Fn(o,e,!0)),n&&(o=Fn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Xn(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const f=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=f}}d(Xn,"prepareEdgeEndpointsForRenderer");function yo(t){return new Map(t.map(e=>[e.id,e]))}d(yo,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Yn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d(Yn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const f=r.x,a=r.y;if(typeof f!="number"||typeof a!="number")continue;const l=r.width??0,c=r.height??0;e=Math.min(e,f-l/2),n=Math.max(n,f+l/2),o=Math.min(o,a-c/2),s=Math.max(s,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=yo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Yn(s,e)-Yn(o,e));for(const o of n){const s=t.filter(f=>f.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function sn(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup);let r=1/0,f=-1/0;for(const l of s){const c=l[e];typeof c=="number"&&(r=Math.min(r,c),f=Math.max(f,c))}if(!Number.isFinite(r)||!Number.isFinite(f))return!1;const a=d(l=>r+f-l,"mirror");for(const l of n){const c=l[e];typeof c=="number"&&(l[e]=a(c));const g=l.groupTitleRect;g&&(l.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const l of o)for(const c of l.points??[])c[e]=a(c[e]);return!0}d(sn,"mirrorAxis");function ms(t){return(t.nodes??[]).some(n=>!n.isGroup)?sn(t,"y"):!0}d(ms,"applyBtDirectionTransform");function ys(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,f=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-f)*I+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-f)*I+a,Mt=j-r;G.x=ft,G.y=Mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&sn(t,"x"),!0;const h=yo(n),i=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,h);if(!G)continue;const j=i.get(G)??[];j.push(P),i.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=i.get(P.id)??[],j=po(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),M=L+2*y,E=a+M,O=(b+v)/2-M/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?C.bottom:C.top,H=I.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>I.cx?C.right:C.left,H=I.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const M=ce(v,L,ae),E=ce(L,y,ae);if(M&&E||!M&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const w=!M&&Qe(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&Qe(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(w||B)){M?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(ps,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<4)continue;const c=xt(l,.001);if(c.length<4)continue;const g=c.length-1,p=c[g],I=c[g-1],u=c[g-2],h=p.x-I.x,i=p.y-I.y,x=Math.hypot(h,i);if(x>=10||x<.001)continue;const C=I.x-u.x,b=I.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(I,p,.001),y=Ot(I,p,.001),M=Nt(u,I,.001),E=Ot(u,I,.001);if(!(L&&E||y&&M))continue;const w=a.end,B=a.start,O=w?e.get(w):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,w?[w]:[],-2)||Pt(G,j,f,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&ao(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St=0){const J=c[g-3],rt=[B,w].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const _t=[...c.slice(0,g-2),G,j];a.points=_t;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,At=-1;for(let Kt=0;Kt<_t.length-1;Kt++){const qt=_t[Kt],Jt=_t[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>At&&(At=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(xs,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Sn=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function bs(t,e){const s=d((u,h)=>{const i=u.x??0,x=u.y??0,C=h.x-i,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:i+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:i+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const i=xt(u.points??[]);if(i.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?i[0]:i[i.length-1],L=h?i[1]:i[i.length-2],y=s(C,v);let M=v;if(Sn(L,y)&&(M=L),gt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,M.y),max:Math.max(y.y,M.y),boundary:y,railEnd:M,rect:b};if(yt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,M.x),max:Math.max(y.x,M.x),boundary:y,railEnd:M,rect:b}},"terminalLaneFor"),f=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&>(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),l=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:f(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),c=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const i=f(u,h);if(i2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const i=xt(u.edge.points??[]);if(i.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const M=i.length>1&&ce(i[1],u.railEnd,et),E=i.slice(M?2:1),w=E[0];return w&&!Sn(w,C)?void 0:[x,C,...E]}const v=i.length>1&&ce(i[i.length-2],u.railEnd,et),L=i.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Sn(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,i=xt(h.points??[]);if(i.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,M=v.x??0,E=v.y??0,[w,B]=i;return yt(w,B,et)&&Math.abs(y-E)<1&&Math.abs(L-M)>1||gt(w,B,et)&&Math.abs(L-M)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let i=!1;for(let x=0;x{const w=p(M),B=p(E);return w!==B?Number(w)-Number(B):+!E.atStart-+!M.atStart});for(const M of y){for(const E of I){const w=g(M,E);if(!w)continue;const B=r({...M.edge,points:w},M.atStart);if(!(!B||h.some(O=>O.edge!==M.edge&&(l(B,O)||L&&c(B,O))))){M.edge.points=w,i=!0;break}}if(i)break}}if(!i)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,l)=>{const c=a.start,g=a.end,p=at(l);if(p.length!==l.length-1)return!1;const I=[c,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,I,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const i of p)for(const x of at(xt(h)))if(de(i,x,.5)>=Xt||he(i.a,i.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),f=d((a,l)=>{if(l+4>=a.length)return;const c=a[l],g=a[l+1],p=a[l+2],I=a[l+3],u=a[l+4],h=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&>(c,I,et)&>(c,u,et)&>(g,p,et)&&(g.x-c.x)*(I.x-p.x)<0,i=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&yt(c,I,et)&&yt(c,u,et)&&yt(g,p,et)&&(g.y-c.y)*(I.y-p.y)<0;if(h||i)return xt([...a.slice(0,l+1),u,...a.slice(l+5)]);if(l+5>=a.length)return;const x=a[l+5],C=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&Ot(u,x)&>(c,u,et)&>(c,x,et)&>(p,I,et)&&(p.x-g.x)*(u.x-I.x)<0,b=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&&Nt(u,x)&&yt(c,u,et)&&yt(c,x,et)&&yt(p,I,et)&&(p.y-g.y)*(u.y-I.y)<0;if(!(!C&&!b))return xt([...a.slice(0,l+1),x,...a.slice(l+6)])},"withoutDogleg");for(let a=0;a<8;a++){let l=!1;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(let p=0;p<=g.length-5;p++){const I=f(g,p);if(!(!I||!r(c,I))){c.points=I,l=!0;break}}if(l)break}if(!l)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Gn(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),l=d((h,i,x)=>xt(h===i?x??[]:h.points??[]),"pointsFor"),c=d((h,i)=>{let x=0;for(let C=0;C{const i=at(h);if(i.length!==3)return;const x=i[1];if(!(i[0].horizontal===x.horizontal||i[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return i.horizontal?Wt(i.a.x,i.b.x,b.left,b.right)>=Xt&&i.a.y>=b.top-2&&i.a.y<=b.bottom+2:Wt(i.a.y,i.b.y,b.top,b.bottom)>=Xt&&i.a.x>=b.left-2&&i.a.x<=b.right+2})},"blockingRectsFor"),I=d((h,i,x)=>{const C=h.map(v=>({...v}));if(i.horizontal)C[i.index].y=x,C[i.index+1].y=x;else if(i.vertical)C[i.index].x=x,C[i.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,i,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(i);if(b.length!==i.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,f,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(l(v)))if(de(L,y,.5)>=Xt)return!1}return c(h,i)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const i=c();let x=!1;for(const C of a){const b=l(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(M=>M.rect.top))-20,Math.max(...L.map(M=>M.rect.bottom))+20]:[Math.min(...L.map(M=>M.rect.left))-20,Math.max(...L.map(M=>M.rect.right))+20];for(const M of y){const E=I(b,v.segment,M);if(!(!E||!u(C,E,i))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(Gn,"liftObstacleHuggingSameSideRails");function $n(t,e){const o=d(l=>{const c=l.groupTitleRect;if(!(!c||typeof c.left!="number"||typeof c.right!="number"||typeof c.top!="number"||typeof c.bottom!="number"||!Number.isFinite(c.left)||!Number.isFinite(c.right)||!Number.isFinite(c.top)||!Number.isFinite(c.bottom)||c.right<=c.left||c.bottom<=c.top))return{left:c.left,right:c.right,top:c.top,bottom:c.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId)return;const c=l.direction,g=typeof c=="string"?c.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(l),I=l.y,u=l.height;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(i<=0||h{if(!l.horizontal)return!1;const g=l.a.y;return g<=c.top+et||g>=c.bottom-et?!1:Wt(l.a.x,l.b.x,c.left,c.right)>=Xt},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(l=>!!l);if(f.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const c=xt(l.points??[]);for(const g of at(c))for(const p of f)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const l of f){const c=l.node.y,g=l.node.height;typeof c!="number"||typeof g!="number"||!Number.isFinite(c)||!Number.isFinite(g)||g<=0||(l.node.y=c-a/2,l.node.height=g+a,l.node.groupTitleRect={...l.rect,top:l.rect.top-a,bottom:l.rect.bottom-a})}}d($n,"liftTopLaneTitleBandsAboveRails");function zn(t,e){const o=d(c=>{const g=c.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId||c.direction!=="LR")return;const p=o(c),I=c.x,u=c.width;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(h<=0||i{if(!c.vertical)return!1;const p=c.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(c.a.y,c.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),f=d((c,g)=>{if(!c.horizontal)return!1;const p=c.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(c.a.x,c.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(c=>!!c);if(a.length===0)return;let l=0;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(const p of at(g))for(const I of a)if(r(p,I.rect))l=Math.max(l,I.rect.right-p.a.x+4);else if(f(p,I.rect)){const u=Math.min(p.a.x,p.b.x);l=Math.max(l,I.rect.right-u+4)}}if(!(l<=et))for(const c of a){const g=c.node.x,p=c.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(c.node.x=g-l/2,c.node.width=p+l,c.node.groupTitleRect={...c.rect,left:c.rect.left-l,right:c.rect.right-l})}}d(zn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,i=new Map)=>xt(i.get(h)??h.points??[]),"replacementPointsFor"),f=d((h=new Map)=>{let i=0;for(let x=0;xs.reduce((i,x)=>i+oe(r(x,h)),0),"totalBends"),l=d(h=>{const i=r(h);if(i.length<4)return;const x=i[i.length-2],C=i[i.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),c=d((h,i)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:i.tailStart.y};else if(Ot(C,b,et))v={x:i.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,i.tailStart,i.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(i))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,i,x)=>{for(const C of s)if(C!==h){for(const b of at(i))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),I=d((h,i,x)=>!g(h,i)&&!p(h,i,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const i of s){const x=i.end;if(!x||!e.has(x)||r(i).length<4)continue;const b=h.get(x)??[];b.push(i),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const i=f();if(i===0)return;const x=a();let C,b=i,v=x;for(const L of u().values())for(let y=0;y=i||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),l=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),c=d((L=new Map)=>{let y=0;for(let M=0;Ma.reduce((y,M)=>y+oe(l(M,L)),0),"totalBends"),p=d(L=>{const y=L.start,M=L.end,E=y?e.get(y):void 0,w=M?e.get(M):void 0,B=E?te(E):void 0,O=w?te(w):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),I=d((L,y,M)=>{if(M.index<=0||M.index+1>=y.length-1)return;const E=p(L);if(E){if(M.vertical){const w=M.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=wO+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"vertical",side:k,coord:w,min:Math.min(M.a.y,M.b.y),max:Math.max(M.a.y,M.b.y)}:void 0}if(M.horizontal){const w=M.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=wO+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"horizontal",side:k,coord:w,min:Math.min(M.a.x,M.b.x),max:Math.max(M.a.x,M.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const M=l(y);for(const E of at(M)){const w=I(y,M,E);w&&L.push(w)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),i=d(L=>{const y=[],M=new Set;for(const E of L){if(M.has(E))continue;const w=[E],B=[];for(M.add(E);w.length>0;){const O=w.pop();B.push(O);for(const k of L)!M.has(k)&&h(O,k)&&(M.add(k),w.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const M of L)y.some(E=>Math.abs(E-M.coord){const y=L.map(w=>w.coord),M=x(L),E=[];if(L.length<=6){const w=new Array(M.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of M.entries())w[k]||(w[k]=!0,B.push(H),O(),B.pop(),w[k]=!1)},"visit");return O(),E}for(let w=0;w{const M=new Map;for(const[w,B]of L.entries()){const O=y[w],k=M.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),M.set(B.edge,k)}const E=new Map;for(const[w,B]of M){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(w,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,M]of L){const E=[y.start,y.end].filter(w=>!!w);for(const w of at(M))if(Pt(w.a,w.b,r,E,-2)||Pt(w.a,w.b,f,[],-2))return!1}for(let y=0;y=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=c();if(y===0)return;let M,E=y,w=g(),B=Number.POSITIVE_INFINITY;for(const O of i(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=c(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>w||G===w&&j>=B)||(M=H,E=P,w=G,B=j)}if(!M)return;for(const[O,k]of M)O.points=k}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),f=d((u,h,i)=>xt(u===h?i??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,i)=>{const x=i.a.x-i.b.x,C=i.a.y-i.b.y;return h+Math.hypot(x,C)},0),"pathLength"),l=d((u,h)=>{let i=0;for(let x=0;x{if(u.horizontal){const i=u.a.y;return(Math.abs(i-h.top)<1||Math.abs(i-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const i=u.a.x;return(Math.abs(i-h.left)<1||Math.abs(i-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),i=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&i.push(b)}return i},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const i=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(i,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(i,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-i.x)!==Math.sign(b.x-C.x):Math.sign(x.y-i.y)!==Math.sign(b.y-C.y)))return[];const M=gt(i,b,et)||yt(i,b,et)?[]:[{x:i.x,y:b.y},{x:b.x,y:i.y}],E=M.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:M.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),w=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return w.has(O)?!1:(w.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,h,i)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>c(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(f(b)))if(de(v,L,.5)>=Xt)return!1}return l(u,h)<=i},"candidateIsSafe");for(let u=0;u<8;u++){const h=l();let i,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=f(L),M=oe(y,et),E=a(y);for(let w=0;w<=y.length-4;w++)for(const B of p(y,w)){const O=oe(B,et),k=a(B);if(!(OC||P===C&&(O>b||O===b&&k>=v)||(i=L,x=B,C=P,b=O,v=k)}}if(!i||!x)return;i.points=x}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const f=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const F=R.x??0,_=R.y??0,V=te(R);V&&f.push({id:String(R.id??""),cx:F,cy:_,rect:V})}if(f.length===0)return;const a=new Map(f.map(R=>[R.id,R])),l=f.map(R=>({id:R.id,rect:R.rect})),c=["top","bottom","left","right"],g={top:Math.min(...f.map(R=>R.rect.top))-20,bottom:Math.max(...f.map(R=>R.rect.bottom))+20,left:Math.min(...f.map(R=>R.rect.left))-20,right:Math.max(...f.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),I=new Map(p.map((R,F)=>[R,F])),u=d(R=>{const F=R==="left"||R==="top"?-1:1,_=[];for(let V=0;V<=2;V++)_.push(g[R]+F*20*V);return _},"outwardTracksForSide"),h=d((R,F=new Map)=>xt(F.get(R)??R.points??[]),"replacementPointsFor"),i=d((R,F)=>{let _=0;for(const V of R)for(const K of F)he(V.a,V.b,K.a,K.b,et)&&_++;return _},"crossingCountBetweenSegments"),x=d((R,F)=>i(at(R),at(F)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let F=0;const _=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y0&&(F+=T,_.push({first:q,second:A,count:T}),Z(q),Z(A))}}return K.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),{count:F,pairs:_,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,F)=>{const _=new Set(F.keys());if(_.size===0)return R.count;let V=0;for(const Z of R.pairs)(_.has(Z.first)||_.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z{const F=new Map;for(const K of R.pairs){const Z=F.get(K.first)??new Set;Z.add(K.second),F.set(K.first,Z);const Y=F.get(K.second)??new Set;Y.add(K.first),F.set(K.second,Y)}const _=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of F.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(I.get(q)??0)-(I.get(m)??0)),Y.length>1&&_.push(Y)}return _},"crossingComponents"),L=d(R=>[R.start,R.end].filter(F=>!!F),"endpointIdsFor"),y=d(R=>{const F=[];for(const _ of v(R)){const V=new Set(_),K=new Set(_.flatMap(Y=>L(Y))),Z=[..._];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),F.push(Z)}return F},"pairSearchGroups"),M=d((R,F,_)=>b(R,new Map([[F,_]])),"crossingCountWithSingleReplacement"),E=d(R=>{const F=new Map;for(const _ of R.pairs)F.set(_.first,(F.get(_.first)??0)+_.count),F.set(_.second,(F.get(_.second)??0)+_.count);return F},"currentCrossingsByEdge"),w=d(R=>R.slice(1).reduce((F,_,V)=>{const K=R[V];return F+Math.abs(_.x-K.x)+Math.abs(_.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((F,_)=>F+oe(h(_,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((F,_)=>F+w(h(_,R)),0),"totalLength"),k=d((R,F,_=new Map)=>{const V=at(F);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,_)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,F)=>{const _=[R.start,R.end].filter(V=>!!V);for(const V of at(F))if(Pt(V.a,V.b,l,_,-2))return!0;return!1},"pathHitsNode"),P=d((R,F)=>{const _=ue(xt(F));at(_).length===_.length-1&&R.push(_)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,F,_)=>{switch(F){case"left":return Math.min(R.x,_.x)-20;case"right":return Math.max(R.x,_.x)+20;case"top":return Math.min(R.y,_.y)-20;case"bottom":return Math.max(R.y,_.y)+20}},"localTrackForSameSide"),tt=d((R,F,_,V)=>{const K=_==="left"||_==="top"?-1:1,Z=[j(F,_,V),g[_]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,fo(F,_,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:Z,y:F.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:F.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,F,_,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:Y,y:F.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),_t=d((R,F,_,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:F.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const F=new Set;return R.map(_=>xt(_)).filter(_=>{const V=_.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return F.has(V)||_.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,F,_,V)=>{const K=[],Z=lo(R,F,_,V,20,et);Z&&P(K,Z),F===V&&tt(K,R,F,_);const Y=G(F),q=G(V);return Y&&!q?ft(K,R,F,_,V):!Y&&q?Mt(K,R,F,_,V):Y?Ht(K,R,F,_,V):_t(K,R,F,_,V),nt(K)},"buildCandidatesForSides"),rt=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[F,_,{x:S,y:_.y},{x:S,y:q.y},q]);for(const A of m)P(R,[F,_,{x:S,y:_.y},{x:S,y:A},{x:q.x,y:A},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[F,_,{x:_.x,y:S},{x:q.x,y:S},q]);for(const A of m)P(R,[F,_,{x:_.x,y:S},{x:A,y:S},{x:A,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const F=R.start,_=R.end,V=_?a.get(_):void 0;if(!F||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const F=R.start,_=R.end,V=F?a.get(F):void 0,K=_?a.get(_):void 0;if(!V||!K)return[];const Z=[];for(const Y of c){const q=Le(V,Y);for(const m of c)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),At=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,F,_)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=_.get(K)??at(h(K));F.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,F,_,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=i(q,_.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:F.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:w(Y)}}).filter(({crossings:Y})=>Y<=F.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,_),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,F,_,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===F||m.second===F||m.first===V||m.second===V)&&(Y+=m.count);let q=i(_.segments,K.segments);for(const m of p){if(m===F||m===V)continue;const S=Z.get(m)??at(h(m));q+=i(_.segments,S)+i(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,F)=>{for(const _ of R.sharedTrackConflicts)if(_!==F)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,F)=>R.segments.some(_=>F.segments.some(V=>de(_,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,F,_,V)=>se(F,_.edge)&&se(V,R.edge)&&!Ee(F,V),"pairCandidatesAreCompatible"),Te=d((R,F,_,V,K)=>{const Z=Jt(R.current,F.edge,_,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[F.edge,_.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(F.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+_.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(F.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+_.length+K.length}},"scorePairReplacement"),un=d((R,F)=>R.crossings{let K=V;for(const Z of F.candidates)for(const Y of _.candidates){if(!me(F,Z,_,Y))continue;const q=Te(R,F,Z,_,Y);q&&un(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),gn=d(R=>{const F=B(),_=O(),V=At(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,w(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:F,length:_};const A={current:R,currentBends:F,currentLength:_,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const F=C(),_=F.count;if(_===0)return;let V,K,Z=_,Y=Number.POSITIVE_INFINITY;for(const m of F.edges){const S=oe(h(m),et);for(const A of St(m)){const T=H(m,A),N=!T&&k(m,A),D=M(F,m,A),W=oe(A,et);T||N||!(D<_||D===_&&WZ||D===Z&&W>=Y||(V=m,K=A,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=gn(F);if(!q)return;for(const[m,S]of q)m.points=S}}d(vs,"resolveRenderedOrthogonalCrossings");var be=.001,Br=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=ln(e),s=["top","bottom","left","right"],r=20,f={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},a=d((i,x,C,b)=>{const v=[],L=lo(i,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(fo(i,x,C,f[x])),v},"buildOrthogonalPathCandidates"),l=d((i,x)=>{for(let C=0;C{let b=0;const v=Be(i,be),L=x.start,y=x.end;for(const M of t){if(M===x||M.isLayoutOnly)continue;const E=M.start,w=M.end;if(!C&&L&&y&&(E===L||E===y||w===L||w===y))continue;const B=M.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(ho(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Br&&b++}}return b},"pathConflictCount"),g=4,p=d((i,x)=>{const C=Math.abs(i.y-x.rect.top),b=Math.abs(i.y-x.rect.bottom),v=Math.abs(i.x-x.rect.left),L=Math.abs(i.x-x.rect.right);let y="top",M=C;return b{const b=I.get(i)??[];b.push({side:x,edgeId:C}),I.set(i,b)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points??[];if(x.length<1)continue;const C=i.id??"",b=i.start,v=i.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((i,x,C)=>{var b;return((b=I.get(i))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C0){const Mt=c(tt,i,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}c(tt,i)>w||ftG.edgeId!==M));const P=I.get(v);P&&I.set(v,P.filter(G=>G.edgeId!==M)),u(b,p(B[0],L),M),u(v,p(B[B.length-1],y),M)}}}d(Ls,"simplifyDetouredEdges");var Qt=.001,ko=10,Ue=7;function Vn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const f=r.x-s.x,a=r.y-s.y;if(!(Math.abs(f)+Math.abs(a)r&&Ze(t,Es(r)))}d(jn,"labelOverlapsOwnMarker");function Ke(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const i=h.points;if(!(!i||i.length<2))for(let x=0;x{const x=wn(i,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&Ze(x,b))return!0;return!1},"labelOverlapsForeignNode"),c=d((h,i)=>{const x=wn(i,r);for(const C of n)if(C.edgeId!==h&&an(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,i,x)=>l(h,x)||c(i,x),"labelOverlapsAnything"),p=[],I=d(h=>{for(const{id:i,rect:x}of s)if(ts(x,h))return i},"findContainingLane"),u=d((h,i)=>p.some(x=>x.labelId!==h&&Ze(i,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const i=h.labelNodeId;if(!i)continue;const x=e.get(i);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx0?y:L,E=b>=v?"horizontal":"vertical",w=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,At=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==At?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=I(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+f,St=ut.rect.right-b/2-f,At=ut.rect.top+v/2+f,Kt=ut.rect.bottom-v/2-f;if(pt>St||At>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,At,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt{const J=w(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!jn(St.rect,C)&&!u(i,St.rect)&&!g(i,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=w(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const At=j(St);if(At&&!jn(At.rect,C)&&!u(i,At.rect)&&!l(i,At.rect)&&(rt||!c(h.id,At.rect)))return{laneId:At.laneId,anchor:At.anchor}}},"findLaneContainingFallback"),_t=Mt(M)??(M.lengthrt.labelId===i);J>=0?p[J]={labelId:i,rect:nt}:p.push({labelId:i,rect:nt})}}}d(Ke,"anchorLabelsToPolyline");var Cn=1e-6,kr=8,Fo=kr/2,Fr=3;function Un(t,e){return t{const g=Un(a,l);let p=0;const I=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const i=c==="x"?h.w/2:h.h/2;i>p&&(p=i)},"consider");I(f.labelNodeId);for(const u of t){if(u===f||u.isLayoutOnly)continue;const h=u.start,i=u.end;!h||!i||Un(h,i)===g&&I(u.labelNodeId)}return p>0?p+Fr:0},"labelClearanceFor");for(const f of t){if(f.isLayoutOnly)continue;const a=f.points;if(!co(a,Cn))continue;const l=uo(f,n,Cn);if(!l)continue;const{srcId:c,dstId:g,srcInfo:p,dstInfo:I,collinearX:u,collinearY:h}=l;if(u===h)continue;let i,x;if(u){const y=I.cy>p.cy;i={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:I.cx,y:y?I.rect.top:I.rect.bottom}}else{const y=I.cx>p.cx;i={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?I.rect.left:I.rect.right,y:I.cy}}if(Pt(i,x,o,[c,g],1))continue;const b=r(f,c,g,u?"x":"y"),v=b>Fo?b:Fo,L=[0,v,-v];for(const y of L){const M={...i},E={...x};if(u){if(M.x+=y,E.x+=y,M.x<=p.rect.left||M.x>=p.rect.right||E.x<=I.rect.left||E.x>=I.rect.right)continue}else if(M.y+=y,E.y+=y,M.y<=p.rect.top||M.y>=p.rect.bottom||E.y<=I.rect.top||E.y>=I.rect.bottom)continue;if(!Pt(M,E,o,[c,g],1)&&!Qe(M,E,t,f,{epsilon:Cn})){f.points=[M,E];break}}}}d(Ts,"straightenCollinearSiblingDetours");function Wn(t,e){const{realNodeRects:l,labelNodeRects:c}=Me(e.values()),g=d((y,M)=>Be(M,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=M.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const M of t){if(M.isLayoutOnly)continue;const E=M.points;!E||E.length<2||y.push(...g(M,xt(E)))}return y},"allSegments"),I=d((y,M)=>y.horizontal&&M.horizontal?Wt(y.a.x,y.b.x,M.a.x,M.b.x)>=8&&Math.abs(y.a.y-M.a.y)<7:y.vertical&&M.vertical?Wt(y.a.y,y.b.y,M.a.y,M.b.y)>=8&&Math.abs(y.a.x-M.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,M)=>{const E=y.start,w=y.end,B=g(y,M);if(B.length!==M.length-1)return!1;const O=[E,w].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,l,O,-2)||Pt(H.a,H.b,c,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(I(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,M)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const w=E.map(B=>({...B}));if(y.horizontal)w[y.index].y+=M,w[y.index+1].y+=M;else if(y.vertical)w[y.index].x+=M,w[y.index+1].x+=M;else return;return g(y.edge,w).length===w.length-1?w:void 0},"shiftedCandidate"),i=d((y,M)=>({x:y.x??(M.left+M.right)/2,y:y.y??(M.top+M.bottom)/2}),"nodeCenter"),x=d(y=>{const M=y.edge,E=xt(M.points??[]);if(E.length!==4||y.index!==1)return;const w=M.start?e.get(M.start):void 0,B=M.end?e.get(M.end):void 0,O=w?te(w):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!w||!B||!O||!k||H.length===0))return{sourceCenter:i(w,O),targetCenter:i(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,M,E,w,B,O)=>{const k=w.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+M;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,M,E,w,B,O)=>{const k=w.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+M;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,M)=>{const E=x(y);if(E){if(y.vertical)return C(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const M=p();let E=!1;for(let w=0;wP.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(Wn,"nudgeSharedInteriorSubpaths");function As(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=o.x-n.x,a=o.y-n.y,l=s*a-r*f;if(Math.abs(l)<1e-10)return!1;const c=n.x-t.x,g=n.y-t.y,p=(c*a-g*f)/l,I=(c*r-g*s)/l,u=.01;return p>u&&p<1-u&&I>u&&I<1-u}d(As,"segmentsIntersect");function ws(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<2)continue;const c=a.start,g=a.end,p=a.labelNodeId,I=a.id??`${c}->${g}`;for(const u of s)if(!(u.nodeId===c||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h0){const a=o.filter(c=>c.type==="edge-node-overlap").length,l=o.filter(c=>c.type==="edge-edge-crossing").length;Ln.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${l} edge crossing(s)`);for(const c of o)Ln.warn(`[SWIMLANE_VALIDATE] ${c.type}: ${c.detail}`)}return o}d(ws,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ys(t,e)||e==="BT"&&s.length>0&&!ms(t))return;for(const a of o){if(a.isLayoutOnly)continue;const l=a.points;!l||l.length<2||(a.points=ue(tn(l)))}Ls(o,n),Ts(o,n),ps(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Ke(o,r),is(o,r),xs(o,r),Wn(o,r),bs(o,r),Ms(o,r),Gn(o,r),Is(o,r);const f=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ke(o,r),Xn(o,r),Gn(o,r),Ke(o,r),Xn(o,r)},"finalizeRenderedEdges");f(),Wn(o,r),f(),$n(o,r),zn(o,r),$n(o,r),zn(o,r)}d(Rs,"postProcessSwimlaneLayout");function Ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const f=`${r.id}:${r.src}->${r.dst}`;n.has(f)||(n.add(f),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function xo(t,e){return t.edges.filter(n=>n.dst===e)}d(xo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function bo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(bo,"buildSortedSuccessorMap");function Mo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(Mo,"buildInDegreeMap");function Io(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Io,"sortedZeroInDegreeNodes");function fn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(fn,"buildPredecessorSuccessorMaps");function So(t,e,n,o){var f,a;let s=0;for(const l of t.nodes)o!=null&&o.skipGroups&&((f=t.nodeById.get(l))!=null&&f.isGroup)||(s=Math.max(s,n[l]??0));const r=Array.from({length:s+1},()=>[]);for(const l of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(l))!=null&&a.isGroup)||r[Math.max(0,n[l]??0)].push(l);return r}d(So,"buildLayersFromRanks");function _e(t){const e=Mo(t),n=Io(e),o=[],s=bo(t);for(;n.length;){const r=n.shift();o.push(r);for(const f of s.get(r)??[])if(e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0){let a=0;for(;a{if(s-o<=1)return 0;const r=o+s>>1;let f=n(o,r)+n(r,s),a=o,l=r,c=o;for(;a=s||ap.dst===I.dst?p.id.localeCompare(I.id):p.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const I=p.dst;o[I]===0?r(I):o[I]===1&&s.push(p)}o[g]=2},"dfs"),f=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of f)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),l=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:l,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function ge(t){const e=Ps(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function dn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(dn,"buildTopLaneOrder");function vo(t,e){const n=dn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const f of e)!o.has(f)||s.has(f)||(s.add(f),r.push(f));for(const f of n)s.has(f)||r.push(f);return r}d(vo,"resolveTopLaneOrder");var _r={EPSILON:1e-6},rn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},_o={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=fn(n);for(const y of r.values())y.sort((M,E)=>M.localeCompare(E));const f=_e(n)??[...n.nodes].sort((y,M)=>y.localeCompare(M)),a=new Map;for(const[y,M]of f.entries())a.set(M,y);const l=new Map,c=new Map;for(const y of n.nodes)c.set(y,[]);for(const y of f){const M=(r.get(y)??[]).filter(E=>l.has(E));if(M.length>0){const E=ks(y,M,{laneOf:o,rankHint:s,topoIndex:a});l.set(y,E),c.get(E).push(y)}else l.has(y)||l.set(y,null)}for(const y of n.nodes)l.has(y)||l.set(y,null);const g=new Set;for(const y of n.nodes)(l.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,M)=>{const E=a.get(y)??0,w=a.get(M)??0;return E===w?y.localeCompare(M):E-w}),I=Fs(n),u=new Map;for(const[y,M]of I.entries())u.set(y,[...M].sort((E,w)=>E.localeCompare(w)));const h=_s(u),i=Ds(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of i)for(const M of y.nodes){const E=x.get(M);E?E.push(y.id):x.set(M,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const M of c.get(y)??[])L(M);b.push(y)}},"walk");for(const y of p)L(y);for(const y of f)L(y);return{parent:l,children:c,roots:p,componentOf:h,blocks:i,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:f}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,f)=>{var i,x;const a=n.laneOf(r),l=n.laneOf(f),c=a!=null&&a===o,g=l!=null&&l===o;if(c!==g)return c?-1:1;const p=(i=n.rankHint)==null?void 0:i[r],I=(x=n.rankHint)==null?void 0:x[f];if(p!=null&&I!=null&&p!==I)return I-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(f)??0;return u!==h?u-h:r.localeCompare(f)})[0]}d(ks,"chooseParent");function Fs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Fs,"buildAdjacency");function _s(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const f of t.get(r)??[])e.has(f)||s.push(f)}}n++}return e}d(_s,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const f=d((a,l)=>{e.set(a,++r),n.set(a,r);for(const c of t.get(a)??[])c!==l&&(e.has(c)?(e.get(c)??0)<(e.get(a)??0)&&(o.push([a,c]),n.set(a,Math.min(n.get(a)??r,e.get(c)??r))):(o.push([a,c]),f(c,a),n.set(a,Math.min(n.get(a)??r,n.get(c)??r)),(n.get(c)??0)>=(e.get(a)??0)&&s.push(Hs(a,c,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||f(a,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const f=n.pop();if(s.push(f),r.add(f[0]),r.add(f[1]),f[0]===t&&f[1]===e||f[0]===e&&f[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,f=new Array(r).fill(-1),a=new Array(r).fill(0),l=[],c=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(f[L]=-1,a[L]=0,c.has(b)||(c.add(b),l.push(b)))}for(;l.length>0;){const b=l.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(c.has(y))continue;const M=s.get(y);M!=null&&(f[M]=v,a[M]=a[v]+1,c.add(y),l.push(y))}}for(const b of o){if(c.has(b))continue;const v=s.get(b);v!=null&&(f[v]=-1,a[v]=0,c.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b{if(b===-1||v===-1)return-1;a[b]>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const M=p[y][b],E=p[y][v];M===-1||E===-1||M!==E&&(b=M,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],M=e[L];if(y==null||M==null||(y>M&&([v,L]=[L,v],[y,M]=[M,y]),y==null||M==null||y===M))continue;const E=s.get(v),w=s.get(L);if(E==null||w==null)continue;const B=I(E,w);if(B===-1)continue;const O=u[B];for(let k=y;k{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,M=n.children.get(b)??[];for(const E of M){const w=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=w.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}i(y,w)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let f=n[r]??0;const a=[...e.get(r)??[]];a.sort(Lo(n));for(const l of a){s(l);const c=o.get(l);c!=null&&(f=Math.min(f,c))}o.set(r,f)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Lo(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Lo,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const l of e){const c=n[l]??0;c>s&&(s=c)}const r=Array.from({length:s+1},()=>[]),f=new Set,a=d(l=>{if(f.has(l))return;f.add(l);const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l);for(const g of o(l))a(g)},"emit");for(const l of t)a(l);for(const l of e)if(!f.has(l)){const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l),f.add(l)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const f=e[s]??0,a=[],l=[],c=n.get(s);for(const g of r){const p=o.get(g)??f;p>f?a.push({child:g,min:p}):l.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),l.sort((g,p)=>{const I=(c==null?void 0:c.get(g))??0,u=(c==null?void 0:c.get(p))??0;if(I!==u)return I-u;const h=o.get(g)??f,i=o.get(p)??f;return h!==i?h-i:g.localeCompare(p)}),[...a.map(g=>g.child),...l]}}d(zs,"createChildOrderer");function cn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const f=Xs(t,e,o),a=[...r].sort(Lo(e)),l=Ys(a,s,e),c=zs(s,e,f,l);let g=Gs(a,t.nodes,e,c);return g=$s(g),g}d(cn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),f=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&f.push(r.get(a.dst));return Co(f)}d(Vs,"countCrossingsBetweenAdjacent");function Kn(t,e,n){const o=[];for(const r of e){const f=n[r.src],a=n[r.dst];if(f==null||a==null||f===a)continue;let l=r.src,c=r.dst,g=f,p=a;f>a&&(l=r.dst,c=r.src,g=a,p=f);for(let I=g;I(n[I]??0)-(n[p]??0));for(const p of g){const I=n[p]??0;if(I===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=I)continue;const h=I;n[p]=u;const i=cn(t,n,s),x=Kn(i,t.edges,n);x(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const f=t.edges.filter(i=>i.src===s);if(f.length===0)continue;let a=!1,l=0;for(const i of f){const x=n(i.dst);x==null||x===r?a=!0:l++}if(l===0||a)continue;let c=0,g=!1;for(const i of t.edges){if(i.dst!==s)continue;const x=n(i.src);x&&(x===r?g=!0:c++)}if(c>0||!g)continue;const p=e[s]??0,I=p+l;let u=0;for(const i of t.edges)i.dst===s&&(u=Math.max(u,(e[i.src]??0)+1));const h=Math.max(p,u,I);h!==p&&(e[s]=h)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=Ie(t),o=_e(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let f=Object.create(null);for(const l of o){const c=xo(n,l),g=e!=null&&e.ignoreCrossLaneEdges?c.filter(p=>{const I=r(p.src),u=r(l);return!I||!u?!0:I===u}):c;if(g.length===0)f[l]=0;else if(s&&g.length===1){const p=g[0].src,I=r(p),u=r(l);I!==u?f[l]=f[p]??0:f[l]=(f[p]??0)+1}else{let p=-1/0;for(const I of g)p=Math.max(p,(f[I.src]??0)+1);f[l]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(f=js(n,f)),e!=null&&e.ignoreCrossLaneEdges&&Us(n,f),{layers:cn(n,f,r),rankOf:f,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=Ie(t),s={...Ws(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:f,succs:a}=fn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const i=r(h.src),x=r(h.dst);if(i&&x&&i!==x)return!1}return!0}),l=_e(n)??[...n.nodes],c=[...l].reverse(),g=d((h,i)=>{let x=0;for(const v of f.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,i)),Math.min(Math.max(i,x),C)},"clampFeasible"),p=rn.GRAVITY_ITERATIONS,I=d(h=>{let i=!1;for(const x of h){const C=f.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,w)=>E+(s[w]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,w)=>E+(s[w]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),M=g(x,y);M!==s[x]&&(s[x]=M,i=!0)}return i},"relaxOrder");for(let h=0;h0){const x=Math.min(...i.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:So(n,l,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=Mo(t),n=bo(t);let o=Io(e);const s=[];for(;o.length>0;){const r=[];for(const f of o){s.push(f);for(const a of n.get(f)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((f,a)=>f.localeCompare(a))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?qs(n)??[...n.nodes].sort():_e(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),f=Object.create(null),a=new Map,l=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const I=xo(n,g);let u=0;if(I.length>0)for(const C of I){const b=C.src,v=f[b]??0;u=Math.max(u,v+l(b,g))}const h=r(g),i=a.get(h)??0,x=Math.max(u,i);f[g]=x,a.set(h,x+1)}return{layers:So(n,o,f,{skipGroups:!0}),rankOf:f,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let f=0;const a=new Map(n.nodeById),l=d(u=>{const h=`placeholder-${f++}`,i={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,i),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),c=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of c){const h=o[u.src]??0,i=o[u.dst]??0;if(i-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function qn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(qn,"median");function Jn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Jn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function Zn(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),f=ke(e),a=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&a.push({u:r.get(c.src),v:f.get(c.dst)});a.sort((c,g)=>c.u===g.u?c.v-g.v:c.u-g.u);const l=a.map(c=>c.v);return Co(l)}d(Zn,"countCrossingsBetweenAdjacent");function qe(t,e,n){return[...t].sort((o,s)=>{const r=qn(e.get(o)??[]),f=qn(e.get(s)??[]);return r===f?tr(o,s,n):isFinite(r)?isFinite(f)?r-f:-1:1})}d(qe,"sortByHeuristic");function Qn(t,e,n,o,s,r){const f=ke(t),a=ke(e),l=Qs(e,f,n,o);if(!s||!r||r.length===0)return qe(e,l,a);const c=new Map;for(const I of e){const u=s(I),h=c.get(u)??[];h.push(I),c.set(u,h)}const g=[];for(const I of r){const u=c.get(I);if(!u||u.length===0)continue;const h=qe(u,l,a);g.push(...h)}const p=c.get(null);if(p&&p.length>0){const I=qe(p,l,a);for(const u of I){const h=Jn(l.get(u)??[]);let i=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Jn(l.get(C)??[]);if(hf.has(i.src)&&a.has(i.dst)),g=l?n.filter(i=>a.has(i.src)&&l.has(i.dst)):void 0,p=d(i=>{let x=Zn(t,i,c);return g&&o&&(x+=Zn(i,o,g)),x},"crossingScore"),I=s?new Map:null;if(s&&I)for(const i of e)I.set(i,s(i));let u=!0,h=p(r);for(;u;){u=!1;for(let i=0;i+1[...a]),s=e.edges,r=ge(e),f=vo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let l=1;l=0;l--)o[l]=Qn(o[l+1],o[l],s,"up",r,f),o[l]=to(o[l+1],o[l],s,o[l-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=(n==null?void 0:n.layerGap)??_o.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??_o.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,f=(n==null?void 0:n.direction)??"TB",a=f==="LR"||f==="RL",l=t.layers,c=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),i=vo(e,n==null?void 0:n.laneOrder),x=l.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1Math.max(Mt,I(Ht)),0),H=l[O+1].reduce((Mt,Ht)=>Math.max(Mt,I(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of l)for(const k of O)b.add(h(k));const v=b.has(null),L=i.filter(O=>b.has(O)),y=[...v?[null]:[],...L],M=Object.create(null);for(const O of L)M[O]=0;v&&(M.null=0);for(const O of l){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+I(ft),0)+s*Math.max(0,G.length-1);M[P]=Math.max(M[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);M.null=Math.max(M.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?M.null:M[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;PI(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let _t=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];c[J]=_t+rt/2,g[J]=w+H/2,_t+=rt+s}}}const G=C[O]??0;w+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((c[H]??0)+(c[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(c[tt]=G)}}return{x:c,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function eo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:f}of e){const a=n.get(s),l=n.get(r);a==null||l==null||(o+=f*Math.abs(a-l))}return o}d(eo,"laneArrangementCost");function ar(t){const e=dn(t);if(e.length<2)return[];const n=new Map(e.map((r,f)=>[r,f])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const f=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!f||!a||!t.nodeById.has(f)||!t.nodeById.has(a))continue;const l=o(f),c=o(a);if(!l||!c||l===c)continue;const g=n.get(l),p=n.get(c);if(g==null||p==null)continue;const[I,u]=g<=p?[l,c]:[c,l],h=`${I}\0${u}`,i=s.get(h);i?i.weight++:s.set(h,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function no(t,e,n){const o=[...t];let s=eo(o,e),r=!0,f=0;const a=Math.max(1,o.length);for(;r&&fs.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:f})=>`${s}:${r}:${f}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=dn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((a,l)=>[a,l]));let r=no(n,o,s);const f=Math.max(0,e.restarts??or);for(let a=0;alt&&l*3>=a?f>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(oo,"chooseOrthogonalSide");function so(t,e){return Math.abs(t.to-e.from)m.isGroup&&!m.parentId);for(const m of c){const S={id:m.id},A=d(T=>{f.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(A)},"assignLane");A(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,A=m.height??10,T=m.x??0,N=m.y??0,D=Dr;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-A/2-D,maxY:N+A/2+D,visualXHalfExtent:l?A/2+D:S/2+D}}),p=d((m,S,A,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:A,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,A),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),I=d((m,S)=>{const A=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-A/2,y:D};case"right":return{x:N+A/2,y:D}}},"portForSide"),u=d((m,S,A)=>I(m,oo(m,S,A?"bottom":"top")),"getOrthogonalPort"),h=[],i=[],x=new Set,C=1e3,b=d((m,S,A)=>{if(h.length===0)return 0;const T=Math.abs(S.y-A.y)U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,A.y)-lt,U=Math.max(S.y,A.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coordU||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const A=r.get(m.start),T=r.get(m.end),N=f.get(m.start),D=f.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=A&&T?Math.abs((T.x??0)-(A.x??0)):0,U=A&&T?Math.abs((T.y??0)-(A.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const A=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(A-T)>1?A-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,A,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>A&&z.nodeId===A||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minYm.y&&z.maxX>N&&z.minXm.x&&z.maxY>W&&z.minYoo(m,S,"bottom"),"determineSide"),w=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const N=(T.x??0)-(A.x??0),D=(T.y??0)-(A.y??0);w.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(A,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:A.x??0,y:A.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of w.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of w.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,A)=>{const T=B(S),N=B(A);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-A.edgeIdx});for(let S=1;S=N||(H.set(P(A.srcId,A.srcSide),N-1),H.set(P(A.srcId,T),D+1),A.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of w.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of w.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const A=O(m);if(S.has(A)||(H.get(P(m.srcId,A))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,A),1),m.srcSide=A}for(const m of w.values()){const{edgeIdx:S,srcId:A,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(A),ot=r.get(T),U=`${A}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((wt,Gt)=>wt.oppositeCoord-Gt.oppositeCoord);const A=m.split(":"),T=A.slice(0,-2).join(":"),N=A[A.length-2],D=A[A.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[wt,Gt]of S.entries()){const ee=Bt+wt*st,mn=`${Gt.edgeIdx}:${D}`;tt.set(mn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:A})=>Mt(A))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:A})=>Mt(A)):!1,"faceHasLabelNode"),_t=d((m,S,A)=>S==="top"||S==="bottom"?{x:m.x+A,y:m.y}:{x:m.x,y:m.y+A},"applyPortOffset"),nt=d((m,S,A)=>{const T=w.get(m),N={x:A.x??0,y:A.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(A,D);let U=T?I(S,T.srcSide):u(S,N,!0),z=T?I(A,T.dstSide):u(A,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=_t(U,W,bt)),dt!==void 0&&(z=_t(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(i[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,A,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(A.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(A.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.xQ.minY&&X.y{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],wt=ct(U,Bt);if(wt.inside&&wt.obstacle){const X=wt.obstacle;if(bt){const $=st(N,A,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,A,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,A,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,A,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)1||Ct>1,kt=M.get(S.start??"")??0,mt=M.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const mn=p("vertical",U.x,U.y,U.y);U.x=mn.coord;const pr=p("vertical",z.x,z.y,z.y);z.x=pr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,Ae=Math.min(U.y,z.y)-50,we=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX$&&X.minYht&&(ye=Math.min(ye,X.minX-We),pe=Math.max(pe,X.maxX+We),Ae=Math.min(Ae,X.minY-We),we=Math.max(we,X.maxY+We))}for(const X of g){if(X.maxXpe||X.maxYwe)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,Ae,we),p("vertical",X.maxX+Q,Ae,we)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const xr=a.filter(X=>X.orientation==="horizontal"&&X.coord>=Ae&&X.coord<=we),br=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),De=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),He=De(U.x,U.y),Eo=De(z.x,z.y),Xe=new Map,yn=new Map,pn=new Map,Ye=new Set,Se=[];Xe.set(He,0),pn.set(He,"n"),Se.push({key:He,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ye.add(He);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),xn={x:z.x,y:U.y},Mr=xe(U,xn),Ir=xe(xn,z),Sr=Mr||Ir,bn={x:U.x,y:z.y},Cr=xe(U,bn),vr=xe(bn,z);if(Sr?Cr||vr||(Math.abs(U.x-z.x)0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ye.delete(X.key),X.key===Eo){let mt=Eo,Vt=z;for($t=[Vt];yn.has(mt);){const re=yn.get(mt);$t.unshift(re),Vt=re,mt=De(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=br.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=xr.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rtne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minYQ&&ne.maxX>Vt&&ne.minX$&&ne.maxY>Dt&&ne.minY10&&Mn<-5||Re<-10&&Mn>5)&&(Et=Math.abs(Mn)*100),(Zt>10&&Ge<-5||Zt<-10&&Ge>5)&&(Et+=Math.abs(Ge)*50);let To=0;const Ao=pn.get(X.key)??"n",wo=Math.abs(Ge)>lt?"h":"v";Ao!=="n"&&Ao!==wo&&(To=50);const Lr=Ut+Lt+Et+To,$e=(Xe.get(X.key)??1/0)+Lr,Ro=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if($e<(Xe.get(vt)??1/0))if(yn.set(vt,X.pt),Xe.set(vt,$e),pn.set(vt,wo),!Ye.has(vt))Se.push({key:vt,f:$e+Ro,pt:mt}),Ye.add(vt);else{const ne=Se.findIndex(Er=>Er.key===vt);ne!==-1&&(Se[ne].f=$e+Ro)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=QLt.minXjt&&Lt.minYFt);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(Ft=>Ft.minXMath.min(X.y,$.y));if(jt.length>0){let Ft=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;Ft=Math.min(Ft,Lt)}Q=Ft}}}const mt=d(Dt=>{const jt=$.y>X.y,Ft=g.filter(Lt=>{const Et=Math.min(X.x,$.x)Lt.minX,Zt=Math.min(X.y,$.y)Lt.minY;return Et&&Zt});let vt=Ft;if(l&&Ft.length>0){const Lt=Ft.filter(Et=>Et.minXDt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),Ft={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,Ft),Et=xe(Ft,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;Xm.from{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!A.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=A.index,A.segments=[...A.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const A=m.pipe.tracks[m.trackIndex];A.segments=A.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const A=i[m.edgeIndex];for(const T of A){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),At=d(m=>{const S=i[m.edgeIndex],A=S.indexOf(h.indexOf(m)),T=[];return A>0&&T.push(h[S[A-1]]),A{if(m.orientation===S.orientation)return!1;const A=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>A.from&&T.pipe.coordT.from&&A.pipe.coord{for(const A of m.tracks)if(!A.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return A.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const A=At(m),T=At(S);return A.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,A)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);A(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let A=0;A{if(me.has(m))return me.get(m);const S=i[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;otMath.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),un=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())i[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const A=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=A(D),bt=A(W);if(Math.abs(z-bt)>1)return bt-z;const dt=i[D].length,ct=i[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=i[D][0],It=i[W][0];if(h[st]&&h[It]){const Bt=h[st],wt=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(wt.to-wt.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[i[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),hn=d(()=>{let m=0;const S=new Map;for(const[A,T]of s.entries())i[A].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(A));for(const A of S.values()){A.sort((N,D)=>{const W=d(z=>{const bt=i[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=A.map(N=>h[i[N][i[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),gn=d(()=>{let m=0;for(const S of a){const A=[];for(const T of S.tracks)for(const N of T.segments){const D=i[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&A.push(h[D])}A.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const A=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;DN.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const wt=x.has(Bt.edgeIndex)?m.coord:It;_.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,wt)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*vn);if(U.length===0&&N.size>0){const st=[...N].sort((wt,Gt)=>Math.abs(D.get(wt)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*vn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*vn)}}for(const[m,S]of s.entries()){const A=i[m]??[];if(A.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=A.map(dt=>{const ct=h[dt],st=_.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dtlt&&T.push(ve(ct,It)),Gt&&wt.orient===ct.orient)if(Math.abs(ct.coord-wt.coord)>lt){const ee=ct.orient==="vertical"?(It+wt.from)/2:so(ct,wt);T.push(ve(ct,ee),ve(wt,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,so(ct,wt)));else if(Gt)T.push(ve(ct,wt.coord));else{const ee=Math.abs(ct.from-It)lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dtlt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const A=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=A-N/2,ot=A+N/2,U=T-D/2,z=T+D/2;if(m.xot||m.yz)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const A=m.start,T=m.end,N=A?r.get(A):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function mr(t){var g,p,I,u,h;const e=Jo(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((I=t.config.swimlane)==null?void 0:I.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,f=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=gr(t),{ordered:l,coordinates:c}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:f,direction:a});Zo(e,l,c,{nodeGap:n,layerGap:o});for(const i of t.edges??[])delete i.points;hr(t,a);for(const i of t.edges??[])(!i.curve||i.curve==="basis")&&(i.curve="rounded");return Rs(t,a),ws(t),a}d(mr,"runSwimlaneLayoutCore");function yr(t){qo(t);const e=Qo(t);t.nodes=e.nodes,t.edges=e.edges}d(yr,"prepareSwimlaneLayout");var $r=Tr({prepareLayout:yr,runLayoutCore:mr,afterPaint:Wo});export{$r as render}; +import{ap as Tr,l as Ln,_ as d,aA as No}from"./mermaid.core-YRnlneqM.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var Oo=5,ze=1e-5,Ve=1e-6;function Je(t){const e=[];for(let n=0;n=1-Ve||I<=Ve||I>=1-Ve?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:I}}d(Do,"segmentIntersection");function En(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(En,"isHorizontalSeg");function Ho(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Xo,"getArcSweepFlag");var Ar=.001;function Yo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&No[e.arrowTypeStart];if(o){const r=t[0],f=t[1],a=Math.atan2(f.y-r.y,f.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&No[e.arrowTypeEnd];if(s){const r=t.length,f=t[r-2],a=t[r-1],l=Math.atan2(a.y-f.y,a.x-f.x);n[r-1].x=a.x-s*Math.cos(l),n[r-1].y=a.y-s*Math.sin(l)}return n}d(Yo,"applyMarkerOffsets");function Go(t,e,n,o,s){const r=t.point.x,f=t.point.y,a={x:r-e*t.r,y:f-n*t.r},l={x:r+e*t.r,y:f+n*t.r},c=[`L${Oe(a)}`];return s==="arc"?c.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(l)}`):c.push(`M${Oe(l)}`),c}d(Go,"emitJump");function Tn(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=n.x-e.x,a=n.y-e.y,l=Math.hypot(s,r),c=Math.hypot(f,a);if(l0){const v=Tn(s[c-1],s[c],s[c+1]??s[c],Oo);v&&(i=v.cutLen)}let x=p,C=null;r&&cv.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-i,x-v.d);for(let v=0;vL){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r=2?o:null}catch{return null}}d(jo,"decodeDataPoints");function Uo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const c of e)s.set(c.id,c);const r=[],f=new Map;for(const c of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(c.id):c.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;f.set(c.id,p);const u=jo(p.getAttribute("data-points"))??c.points;r.push({...c,points:u})}const a=Ho(r);if(a.length===0)return;const l=new Map;for(const c of a){const g=l.get(c.jumpEdgeId)??[];g.push(c),l.set(c.jumpEdgeId,g)}for(const c of r){const g=l.get(c.id);if(!g||g.length===0)continue;const p=s.get(c.id),I=p==null?void 0:p.curve;if(I!==void 0&&!Vo(I))continue;const u=f.get(c.id);if(!u)continue;if(I===void 0){const v=u.getAttribute("d")??"";if(!zo(v))continue}const h=u.getAttribute("style")??"",i=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=i?Number.parseFloat(i[1]):null,C=i?Number.parseFloat(i[2]):null,b=$o(c,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,M=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",M)}}}d(Uo,"applyLineJumpsToSvg");function Wo(t,{measure:e}){var r,f;const n=(f=(r=t.config)==null?void 0:r.swimlane)==null?void 0:f.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(a=>Array.isArray(a.points)&&a.points.length>=2).map(a=>({id:a.id,points:a.points,curve:a.curve,arrowTypeStart:a.arrowTypeStart,arrowTypeEnd:a.arrowTypeEnd}));Uo(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}d(Wo,"applySwimlaneLineJumps");var In="__swimlane_default__",wr=21,Po=20;function An(t){return Math.max(t.padding??Po,Po)}d(An,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const f=n-s/2,a=Math.min(r,n+s/2),l=Math.min(wr,Math.max(0,a-f)),c=f+l;if(c<=f){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:f,bottom:c}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===In);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:In,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=In}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const l of t.nodes??[])e.set(l.id,l);const n=[];for(const l of t.edges??[]){const c=typeof l.start=="string"?l.start:void 0,g=typeof l.end=="string"?l.end:void 0;!c||!g||l.labelNodeId||n.push({id:l.id,src:c,dst:g,ref:l})}const o=t.nodes??[],s=o.filter(l=>l.isGroup),r=o.filter(l=>!l.isGroup);return{nodes:[...[...s].reverse(),...r].map(l=>l.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,f=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let l=0;for(const I of e.layers){let u=0;for(const h of I){const i=r.get(h);if(!i){u++;continue}i.layer=l,i.order=u;const x=n.x[h]??u*a,C=n.y[h]??l*f;i.x=x,i.y=C,u++}l++}const c=s.nodes??[],g=new Map,p=[];for(const I of c){if(!(I!=null&&I.isGroup))continue;I.parentId||p.push(I);const u=c.filter(b=>b.parentId===I.id);let h=1/0,i=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,M=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),i=Math.max(i,v+y/2),x=Math.min(x,L-M/2),C=Math.max(C,L+M/2))}if(h===1/0||x===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const b=I.padding??20,v=I.parentId?b:2*An(I),L=b,y=Math.max(0,i-h)+v,M=Math.max(0,C-x)+L,E=(h+i)/2,w=(x+C)/2;I.x=E,I.y=w,I.width=y,I.height=M,g.set(I.id,{minX:h,maxX:i,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let I=1/0,u=-1/0,h=0;for(const i of p){const x=i.padding??20;x>h&&(h=x);const C=g.get(i.id);C&&(I=Math.min(I,C.minY),u=Math.max(u,C.maxY))}if(I!==1/0&&u!==-1/0){const i=Math.max(0,u-I),C=Math.max(h,36),b=i+2*C,v=(I+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=I;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],M=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*An(B),H=(O.minX+O.maxX)/2;y.push(B.id),M.push(H),E.push(k)}const w=y.length;if(w>0){const B=new Map;if(w===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(ro,"measuredNodeRect");function io(t){if(t.isGroup)return;const e=ro(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(io,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&>(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function co(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(co,"classifyThreeSegmentRoute");function an(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),f=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&fe.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Ze(t,e){return t.lefte.left&&t.tope.top}d(Ze,"rectsOverlap");function wn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(wn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=ro(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Le,"portForRectSide");function lo(t,e,n,o,s,r=Yt){const f=e==="left"||e==="right",a=o==="left"||o==="right";if(f&&a){if(e==="right"&&o==="left"&&t.xn.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!f&&!a){if(e===o){if(gt(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(f&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const l=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return l&&c?[t,{x:t.x,y:n.y},n]:void 0}d(lo,"buildOrthogonalPortPath");function fo(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(fo,"buildSameSideTrackPath");function ln(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=io(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(ln,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=io(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,f=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,f,a)})}return n}d(es,"collectLayoutNodeRects");function uo(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),f=e.get(s);if(!(!r||!f))return{srcId:o,dstId:s,srcInfo:r,dstInfo:f,collinearX:Math.abs(r.cx-f.cx)h||IC)return!1;const b=Math.abs(i-g.a.x)s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Qe(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const f of n){if(f===o||f.isLayoutOnly)continue;const a=f.points;if(!(!a||a.length<2))for(let l=0;lI+s&&hi+s&&po+Yt&&t=2?e[e.length-2]:void 0,l=(f?gt(f,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(l)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(tn,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Nr=.5,Bo=4;function go(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const f=rs(t[s],t[r],e);return n?[f,...t.slice(s)]:[...t.slice(0,s+1),f]}d(Nn,"clipEndpoint");function is(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Nn(s,o.srcRect,!0)),o.dstRect&&(s=Nn(s,o.dstRect,!1)),s=ue(tn(s)),s=mo(s,o.srcRect,o.dstRect),o.edge.points=ue(tn(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function On(t,e,n,o=!1){if(yt(t,e,it)){if(e.yn.bottom+it)return e;if(o){if(t.xn.right+it)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(gt(t,e,it)){if(e.xn.right+it)return e;if(o){if(t.yn.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(On,"snapEndpointToBoundary");function en(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function Bn(t,e){return e==="left"||e==="right"?nn(t.top,t.bottom):nn(t.left,t.right)}d(Bn,"clearanceRangeForSide");function on(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function kn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const f=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,f));if(!(Math.abs(a-f)({...a}));for(let a=e;a>=0&&a=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)o.bottom+it;case"left":return yt(e,n,it)&&n.xo.right+it}}d(Dn,"leavesOutward");function Hn(t,e,n){if(t.length<3)return t;if(n){const r=_n(t[0],t[1],e);return r&&Dn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=_n(t[o-1],t[o],e);return s&&Dn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Hn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=en(o,0,1);if(r){const f=On(r,o[0],e);f!==o[0]&&(o=[f,...o.slice(1)])}o=Hn(o,e,!0)}if(n){const r=o.length-1,f=en(o,r,-1);if(f){const a=On(f,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Hn(o,n,!1)}const s=mo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Fn(o,e,!0)),n&&(o=Fn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Xn(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const f=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=f}}d(Xn,"prepareEdgeEndpointsForRenderer");function yo(t){return new Map(t.map(e=>[e.id,e]))}d(yo,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Yn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d(Yn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const f=r.x,a=r.y;if(typeof f!="number"||typeof a!="number")continue;const l=r.width??0,c=r.height??0;e=Math.min(e,f-l/2),n=Math.max(n,f+l/2),o=Math.min(o,a-c/2),s=Math.max(s,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=yo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Yn(s,e)-Yn(o,e));for(const o of n){const s=t.filter(f=>f.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function sn(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup);let r=1/0,f=-1/0;for(const l of s){const c=l[e];typeof c=="number"&&(r=Math.min(r,c),f=Math.max(f,c))}if(!Number.isFinite(r)||!Number.isFinite(f))return!1;const a=d(l=>r+f-l,"mirror");for(const l of n){const c=l[e];typeof c=="number"&&(l[e]=a(c));const g=l.groupTitleRect;g&&(l.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const l of o)for(const c of l.points??[])c[e]=a(c[e]);return!0}d(sn,"mirrorAxis");function ms(t){return(t.nodes??[]).some(n=>!n.isGroup)?sn(t,"y"):!0}d(ms,"applyBtDirectionTransform");function ys(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,f=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-f)*I+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-f)*I+a,Mt=j-r;G.x=ft,G.y=Mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&sn(t,"x"),!0;const h=yo(n),i=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,h);if(!G)continue;const j=i.get(G)??[];j.push(P),i.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=i.get(P.id)??[],j=po(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),M=L+2*y,E=a+M,O=(b+v)/2-M/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?C.bottom:C.top,H=I.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>I.cx?C.right:C.left,H=I.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const M=ce(v,L,ae),E=ce(L,y,ae);if(M&&E||!M&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const w=!M&&Qe(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&Qe(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(w||B)){M?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(ps,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<4)continue;const c=xt(l,.001);if(c.length<4)continue;const g=c.length-1,p=c[g],I=c[g-1],u=c[g-2],h=p.x-I.x,i=p.y-I.y,x=Math.hypot(h,i);if(x>=10||x<.001)continue;const C=I.x-u.x,b=I.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(I,p,.001),y=Ot(I,p,.001),M=Nt(u,I,.001),E=Ot(u,I,.001);if(!(L&&E||y&&M))continue;const w=a.end,B=a.start,O=w?e.get(w):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,w?[w]:[],-2)||Pt(G,j,f,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&ao(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St=0){const J=c[g-3],rt=[B,w].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const _t=[...c.slice(0,g-2),G,j];a.points=_t;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,At=-1;for(let Kt=0;Kt<_t.length-1;Kt++){const qt=_t[Kt],Jt=_t[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>At&&(At=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(xs,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Sn=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function bs(t,e){const s=d((u,h)=>{const i=u.x??0,x=u.y??0,C=h.x-i,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:i+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:i+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const i=xt(u.points??[]);if(i.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?i[0]:i[i.length-1],L=h?i[1]:i[i.length-2],y=s(C,v);let M=v;if(Sn(L,y)&&(M=L),gt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,M.y),max:Math.max(y.y,M.y),boundary:y,railEnd:M,rect:b};if(yt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,M.x),max:Math.max(y.x,M.x),boundary:y,railEnd:M,rect:b}},"terminalLaneFor"),f=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&>(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),l=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:f(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),c=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const i=f(u,h);if(i2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const i=xt(u.edge.points??[]);if(i.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const M=i.length>1&&ce(i[1],u.railEnd,et),E=i.slice(M?2:1),w=E[0];return w&&!Sn(w,C)?void 0:[x,C,...E]}const v=i.length>1&&ce(i[i.length-2],u.railEnd,et),L=i.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Sn(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,i=xt(h.points??[]);if(i.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,M=v.x??0,E=v.y??0,[w,B]=i;return yt(w,B,et)&&Math.abs(y-E)<1&&Math.abs(L-M)>1||gt(w,B,et)&&Math.abs(L-M)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let i=!1;for(let x=0;x{const w=p(M),B=p(E);return w!==B?Number(w)-Number(B):+!E.atStart-+!M.atStart});for(const M of y){for(const E of I){const w=g(M,E);if(!w)continue;const B=r({...M.edge,points:w},M.atStart);if(!(!B||h.some(O=>O.edge!==M.edge&&(l(B,O)||L&&c(B,O))))){M.edge.points=w,i=!0;break}}if(i)break}}if(!i)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,l)=>{const c=a.start,g=a.end,p=at(l);if(p.length!==l.length-1)return!1;const I=[c,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,I,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const i of p)for(const x of at(xt(h)))if(de(i,x,.5)>=Xt||he(i.a,i.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),f=d((a,l)=>{if(l+4>=a.length)return;const c=a[l],g=a[l+1],p=a[l+2],I=a[l+3],u=a[l+4],h=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&>(c,I,et)&>(c,u,et)&>(g,p,et)&&(g.x-c.x)*(I.x-p.x)<0,i=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&yt(c,I,et)&&yt(c,u,et)&&yt(g,p,et)&&(g.y-c.y)*(I.y-p.y)<0;if(h||i)return xt([...a.slice(0,l+1),u,...a.slice(l+5)]);if(l+5>=a.length)return;const x=a[l+5],C=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&Ot(u,x)&>(c,u,et)&>(c,x,et)&>(p,I,et)&&(p.x-g.x)*(u.x-I.x)<0,b=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&&Nt(u,x)&&yt(c,u,et)&&yt(c,x,et)&&yt(p,I,et)&&(p.y-g.y)*(u.y-I.y)<0;if(!(!C&&!b))return xt([...a.slice(0,l+1),x,...a.slice(l+6)])},"withoutDogleg");for(let a=0;a<8;a++){let l=!1;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(let p=0;p<=g.length-5;p++){const I=f(g,p);if(!(!I||!r(c,I))){c.points=I,l=!0;break}}if(l)break}if(!l)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Gn(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),l=d((h,i,x)=>xt(h===i?x??[]:h.points??[]),"pointsFor"),c=d((h,i)=>{let x=0;for(let C=0;C{const i=at(h);if(i.length!==3)return;const x=i[1];if(!(i[0].horizontal===x.horizontal||i[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return i.horizontal?Wt(i.a.x,i.b.x,b.left,b.right)>=Xt&&i.a.y>=b.top-2&&i.a.y<=b.bottom+2:Wt(i.a.y,i.b.y,b.top,b.bottom)>=Xt&&i.a.x>=b.left-2&&i.a.x<=b.right+2})},"blockingRectsFor"),I=d((h,i,x)=>{const C=h.map(v=>({...v}));if(i.horizontal)C[i.index].y=x,C[i.index+1].y=x;else if(i.vertical)C[i.index].x=x,C[i.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,i,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(i);if(b.length!==i.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,f,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(l(v)))if(de(L,y,.5)>=Xt)return!1}return c(h,i)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const i=c();let x=!1;for(const C of a){const b=l(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(M=>M.rect.top))-20,Math.max(...L.map(M=>M.rect.bottom))+20]:[Math.min(...L.map(M=>M.rect.left))-20,Math.max(...L.map(M=>M.rect.right))+20];for(const M of y){const E=I(b,v.segment,M);if(!(!E||!u(C,E,i))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(Gn,"liftObstacleHuggingSameSideRails");function $n(t,e){const o=d(l=>{const c=l.groupTitleRect;if(!(!c||typeof c.left!="number"||typeof c.right!="number"||typeof c.top!="number"||typeof c.bottom!="number"||!Number.isFinite(c.left)||!Number.isFinite(c.right)||!Number.isFinite(c.top)||!Number.isFinite(c.bottom)||c.right<=c.left||c.bottom<=c.top))return{left:c.left,right:c.right,top:c.top,bottom:c.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId)return;const c=l.direction,g=typeof c=="string"?c.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(l),I=l.y,u=l.height;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(i<=0||h{if(!l.horizontal)return!1;const g=l.a.y;return g<=c.top+et||g>=c.bottom-et?!1:Wt(l.a.x,l.b.x,c.left,c.right)>=Xt},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(l=>!!l);if(f.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const c=xt(l.points??[]);for(const g of at(c))for(const p of f)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const l of f){const c=l.node.y,g=l.node.height;typeof c!="number"||typeof g!="number"||!Number.isFinite(c)||!Number.isFinite(g)||g<=0||(l.node.y=c-a/2,l.node.height=g+a,l.node.groupTitleRect={...l.rect,top:l.rect.top-a,bottom:l.rect.bottom-a})}}d($n,"liftTopLaneTitleBandsAboveRails");function zn(t,e){const o=d(c=>{const g=c.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId||c.direction!=="LR")return;const p=o(c),I=c.x,u=c.width;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(h<=0||i{if(!c.vertical)return!1;const p=c.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(c.a.y,c.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),f=d((c,g)=>{if(!c.horizontal)return!1;const p=c.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(c.a.x,c.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(c=>!!c);if(a.length===0)return;let l=0;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(const p of at(g))for(const I of a)if(r(p,I.rect))l=Math.max(l,I.rect.right-p.a.x+4);else if(f(p,I.rect)){const u=Math.min(p.a.x,p.b.x);l=Math.max(l,I.rect.right-u+4)}}if(!(l<=et))for(const c of a){const g=c.node.x,p=c.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(c.node.x=g-l/2,c.node.width=p+l,c.node.groupTitleRect={...c.rect,left:c.rect.left-l,right:c.rect.right-l})}}d(zn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,i=new Map)=>xt(i.get(h)??h.points??[]),"replacementPointsFor"),f=d((h=new Map)=>{let i=0;for(let x=0;xs.reduce((i,x)=>i+oe(r(x,h)),0),"totalBends"),l=d(h=>{const i=r(h);if(i.length<4)return;const x=i[i.length-2],C=i[i.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),c=d((h,i)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:i.tailStart.y};else if(Ot(C,b,et))v={x:i.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,i.tailStart,i.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(i))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,i,x)=>{for(const C of s)if(C!==h){for(const b of at(i))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),I=d((h,i,x)=>!g(h,i)&&!p(h,i,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const i of s){const x=i.end;if(!x||!e.has(x)||r(i).length<4)continue;const b=h.get(x)??[];b.push(i),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const i=f();if(i===0)return;const x=a();let C,b=i,v=x;for(const L of u().values())for(let y=0;y=i||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),l=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),c=d((L=new Map)=>{let y=0;for(let M=0;Ma.reduce((y,M)=>y+oe(l(M,L)),0),"totalBends"),p=d(L=>{const y=L.start,M=L.end,E=y?e.get(y):void 0,w=M?e.get(M):void 0,B=E?te(E):void 0,O=w?te(w):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),I=d((L,y,M)=>{if(M.index<=0||M.index+1>=y.length-1)return;const E=p(L);if(E){if(M.vertical){const w=M.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=wO+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"vertical",side:k,coord:w,min:Math.min(M.a.y,M.b.y),max:Math.max(M.a.y,M.b.y)}:void 0}if(M.horizontal){const w=M.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=wO+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"horizontal",side:k,coord:w,min:Math.min(M.a.x,M.b.x),max:Math.max(M.a.x,M.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const M=l(y);for(const E of at(M)){const w=I(y,M,E);w&&L.push(w)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),i=d(L=>{const y=[],M=new Set;for(const E of L){if(M.has(E))continue;const w=[E],B=[];for(M.add(E);w.length>0;){const O=w.pop();B.push(O);for(const k of L)!M.has(k)&&h(O,k)&&(M.add(k),w.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const M of L)y.some(E=>Math.abs(E-M.coord){const y=L.map(w=>w.coord),M=x(L),E=[];if(L.length<=6){const w=new Array(M.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of M.entries())w[k]||(w[k]=!0,B.push(H),O(),B.pop(),w[k]=!1)},"visit");return O(),E}for(let w=0;w{const M=new Map;for(const[w,B]of L.entries()){const O=y[w],k=M.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),M.set(B.edge,k)}const E=new Map;for(const[w,B]of M){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(w,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,M]of L){const E=[y.start,y.end].filter(w=>!!w);for(const w of at(M))if(Pt(w.a,w.b,r,E,-2)||Pt(w.a,w.b,f,[],-2))return!1}for(let y=0;y=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=c();if(y===0)return;let M,E=y,w=g(),B=Number.POSITIVE_INFINITY;for(const O of i(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=c(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>w||G===w&&j>=B)||(M=H,E=P,w=G,B=j)}if(!M)return;for(const[O,k]of M)O.points=k}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),f=d((u,h,i)=>xt(u===h?i??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,i)=>{const x=i.a.x-i.b.x,C=i.a.y-i.b.y;return h+Math.hypot(x,C)},0),"pathLength"),l=d((u,h)=>{let i=0;for(let x=0;x{if(u.horizontal){const i=u.a.y;return(Math.abs(i-h.top)<1||Math.abs(i-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const i=u.a.x;return(Math.abs(i-h.left)<1||Math.abs(i-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),i=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&i.push(b)}return i},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const i=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(i,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(i,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-i.x)!==Math.sign(b.x-C.x):Math.sign(x.y-i.y)!==Math.sign(b.y-C.y)))return[];const M=gt(i,b,et)||yt(i,b,et)?[]:[{x:i.x,y:b.y},{x:b.x,y:i.y}],E=M.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:M.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),w=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return w.has(O)?!1:(w.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,h,i)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>c(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(f(b)))if(de(v,L,.5)>=Xt)return!1}return l(u,h)<=i},"candidateIsSafe");for(let u=0;u<8;u++){const h=l();let i,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=f(L),M=oe(y,et),E=a(y);for(let w=0;w<=y.length-4;w++)for(const B of p(y,w)){const O=oe(B,et),k=a(B);if(!(OC||P===C&&(O>b||O===b&&k>=v)||(i=L,x=B,C=P,b=O,v=k)}}if(!i||!x)return;i.points=x}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const f=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const F=R.x??0,_=R.y??0,V=te(R);V&&f.push({id:String(R.id??""),cx:F,cy:_,rect:V})}if(f.length===0)return;const a=new Map(f.map(R=>[R.id,R])),l=f.map(R=>({id:R.id,rect:R.rect})),c=["top","bottom","left","right"],g={top:Math.min(...f.map(R=>R.rect.top))-20,bottom:Math.max(...f.map(R=>R.rect.bottom))+20,left:Math.min(...f.map(R=>R.rect.left))-20,right:Math.max(...f.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),I=new Map(p.map((R,F)=>[R,F])),u=d(R=>{const F=R==="left"||R==="top"?-1:1,_=[];for(let V=0;V<=2;V++)_.push(g[R]+F*20*V);return _},"outwardTracksForSide"),h=d((R,F=new Map)=>xt(F.get(R)??R.points??[]),"replacementPointsFor"),i=d((R,F)=>{let _=0;for(const V of R)for(const K of F)he(V.a,V.b,K.a,K.b,et)&&_++;return _},"crossingCountBetweenSegments"),x=d((R,F)=>i(at(R),at(F)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let F=0;const _=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y0&&(F+=T,_.push({first:q,second:A,count:T}),Z(q),Z(A))}}return K.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),{count:F,pairs:_,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,F)=>{const _=new Set(F.keys());if(_.size===0)return R.count;let V=0;for(const Z of R.pairs)(_.has(Z.first)||_.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z{const F=new Map;for(const K of R.pairs){const Z=F.get(K.first)??new Set;Z.add(K.second),F.set(K.first,Z);const Y=F.get(K.second)??new Set;Y.add(K.first),F.set(K.second,Y)}const _=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of F.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(I.get(q)??0)-(I.get(m)??0)),Y.length>1&&_.push(Y)}return _},"crossingComponents"),L=d(R=>[R.start,R.end].filter(F=>!!F),"endpointIdsFor"),y=d(R=>{const F=[];for(const _ of v(R)){const V=new Set(_),K=new Set(_.flatMap(Y=>L(Y))),Z=[..._];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),F.push(Z)}return F},"pairSearchGroups"),M=d((R,F,_)=>b(R,new Map([[F,_]])),"crossingCountWithSingleReplacement"),E=d(R=>{const F=new Map;for(const _ of R.pairs)F.set(_.first,(F.get(_.first)??0)+_.count),F.set(_.second,(F.get(_.second)??0)+_.count);return F},"currentCrossingsByEdge"),w=d(R=>R.slice(1).reduce((F,_,V)=>{const K=R[V];return F+Math.abs(_.x-K.x)+Math.abs(_.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((F,_)=>F+oe(h(_,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((F,_)=>F+w(h(_,R)),0),"totalLength"),k=d((R,F,_=new Map)=>{const V=at(F);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,_)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,F)=>{const _=[R.start,R.end].filter(V=>!!V);for(const V of at(F))if(Pt(V.a,V.b,l,_,-2))return!0;return!1},"pathHitsNode"),P=d((R,F)=>{const _=ue(xt(F));at(_).length===_.length-1&&R.push(_)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,F,_)=>{switch(F){case"left":return Math.min(R.x,_.x)-20;case"right":return Math.max(R.x,_.x)+20;case"top":return Math.min(R.y,_.y)-20;case"bottom":return Math.max(R.y,_.y)+20}},"localTrackForSameSide"),tt=d((R,F,_,V)=>{const K=_==="left"||_==="top"?-1:1,Z=[j(F,_,V),g[_]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,fo(F,_,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:Z,y:F.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:F.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,F,_,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:Y,y:F.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),_t=d((R,F,_,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:F.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const F=new Set;return R.map(_=>xt(_)).filter(_=>{const V=_.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return F.has(V)||_.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,F,_,V)=>{const K=[],Z=lo(R,F,_,V,20,et);Z&&P(K,Z),F===V&&tt(K,R,F,_);const Y=G(F),q=G(V);return Y&&!q?ft(K,R,F,_,V):!Y&&q?Mt(K,R,F,_,V):Y?Ht(K,R,F,_,V):_t(K,R,F,_,V),nt(K)},"buildCandidatesForSides"),rt=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[F,_,{x:S,y:_.y},{x:S,y:q.y},q]);for(const A of m)P(R,[F,_,{x:S,y:_.y},{x:S,y:A},{x:q.x,y:A},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[F,_,{x:_.x,y:S},{x:q.x,y:S},q]);for(const A of m)P(R,[F,_,{x:_.x,y:S},{x:A,y:S},{x:A,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const F=R.start,_=R.end,V=_?a.get(_):void 0;if(!F||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const F=R.start,_=R.end,V=F?a.get(F):void 0,K=_?a.get(_):void 0;if(!V||!K)return[];const Z=[];for(const Y of c){const q=Le(V,Y);for(const m of c)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),At=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,F,_)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=_.get(K)??at(h(K));F.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,F,_,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=i(q,_.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:F.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:w(Y)}}).filter(({crossings:Y})=>Y<=F.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,_),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,F,_,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===F||m.second===F||m.first===V||m.second===V)&&(Y+=m.count);let q=i(_.segments,K.segments);for(const m of p){if(m===F||m===V)continue;const S=Z.get(m)??at(h(m));q+=i(_.segments,S)+i(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,F)=>{for(const _ of R.sharedTrackConflicts)if(_!==F)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,F)=>R.segments.some(_=>F.segments.some(V=>de(_,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,F,_,V)=>se(F,_.edge)&&se(V,R.edge)&&!Ee(F,V),"pairCandidatesAreCompatible"),Te=d((R,F,_,V,K)=>{const Z=Jt(R.current,F.edge,_,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[F.edge,_.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(F.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+_.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(F.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+_.length+K.length}},"scorePairReplacement"),un=d((R,F)=>R.crossings{let K=V;for(const Z of F.candidates)for(const Y of _.candidates){if(!me(F,Z,_,Y))continue;const q=Te(R,F,Z,_,Y);q&&un(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),gn=d(R=>{const F=B(),_=O(),V=At(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,w(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:F,length:_};const A={current:R,currentBends:F,currentLength:_,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const F=C(),_=F.count;if(_===0)return;let V,K,Z=_,Y=Number.POSITIVE_INFINITY;for(const m of F.edges){const S=oe(h(m),et);for(const A of St(m)){const T=H(m,A),N=!T&&k(m,A),D=M(F,m,A),W=oe(A,et);T||N||!(D<_||D===_&&WZ||D===Z&&W>=Y||(V=m,K=A,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=gn(F);if(!q)return;for(const[m,S]of q)m.points=S}}d(vs,"resolveRenderedOrthogonalCrossings");var be=.001,Br=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=ln(e),s=["top","bottom","left","right"],r=20,f={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},a=d((i,x,C,b)=>{const v=[],L=lo(i,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(fo(i,x,C,f[x])),v},"buildOrthogonalPathCandidates"),l=d((i,x)=>{for(let C=0;C{let b=0;const v=Be(i,be),L=x.start,y=x.end;for(const M of t){if(M===x||M.isLayoutOnly)continue;const E=M.start,w=M.end;if(!C&&L&&y&&(E===L||E===y||w===L||w===y))continue;const B=M.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(ho(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Br&&b++}}return b},"pathConflictCount"),g=4,p=d((i,x)=>{const C=Math.abs(i.y-x.rect.top),b=Math.abs(i.y-x.rect.bottom),v=Math.abs(i.x-x.rect.left),L=Math.abs(i.x-x.rect.right);let y="top",M=C;return b{const b=I.get(i)??[];b.push({side:x,edgeId:C}),I.set(i,b)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points??[];if(x.length<1)continue;const C=i.id??"",b=i.start,v=i.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((i,x,C)=>{var b;return((b=I.get(i))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C0){const Mt=c(tt,i,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}c(tt,i)>w||ftG.edgeId!==M));const P=I.get(v);P&&I.set(v,P.filter(G=>G.edgeId!==M)),u(b,p(B[0],L),M),u(v,p(B[B.length-1],y),M)}}}d(Ls,"simplifyDetouredEdges");var Qt=.001,ko=10,Ue=7;function Vn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const f=r.x-s.x,a=r.y-s.y;if(!(Math.abs(f)+Math.abs(a)r&&Ze(t,Es(r)))}d(jn,"labelOverlapsOwnMarker");function Ke(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const i=h.points;if(!(!i||i.length<2))for(let x=0;x{const x=wn(i,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&Ze(x,b))return!0;return!1},"labelOverlapsForeignNode"),c=d((h,i)=>{const x=wn(i,r);for(const C of n)if(C.edgeId!==h&&an(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,i,x)=>l(h,x)||c(i,x),"labelOverlapsAnything"),p=[],I=d(h=>{for(const{id:i,rect:x}of s)if(ts(x,h))return i},"findContainingLane"),u=d((h,i)=>p.some(x=>x.labelId!==h&&Ze(i,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const i=h.labelNodeId;if(!i)continue;const x=e.get(i);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx0?y:L,E=b>=v?"horizontal":"vertical",w=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,At=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==At?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=I(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+f,St=ut.rect.right-b/2-f,At=ut.rect.top+v/2+f,Kt=ut.rect.bottom-v/2-f;if(pt>St||At>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,At,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt{const J=w(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!jn(St.rect,C)&&!u(i,St.rect)&&!g(i,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=w(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const At=j(St);if(At&&!jn(At.rect,C)&&!u(i,At.rect)&&!l(i,At.rect)&&(rt||!c(h.id,At.rect)))return{laneId:At.laneId,anchor:At.anchor}}},"findLaneContainingFallback"),_t=Mt(M)??(M.lengthrt.labelId===i);J>=0?p[J]={labelId:i,rect:nt}:p.push({labelId:i,rect:nt})}}}d(Ke,"anchorLabelsToPolyline");var Cn=1e-6,kr=8,Fo=kr/2,Fr=3;function Un(t,e){return t{const g=Un(a,l);let p=0;const I=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const i=c==="x"?h.w/2:h.h/2;i>p&&(p=i)},"consider");I(f.labelNodeId);for(const u of t){if(u===f||u.isLayoutOnly)continue;const h=u.start,i=u.end;!h||!i||Un(h,i)===g&&I(u.labelNodeId)}return p>0?p+Fr:0},"labelClearanceFor");for(const f of t){if(f.isLayoutOnly)continue;const a=f.points;if(!co(a,Cn))continue;const l=uo(f,n,Cn);if(!l)continue;const{srcId:c,dstId:g,srcInfo:p,dstInfo:I,collinearX:u,collinearY:h}=l;if(u===h)continue;let i,x;if(u){const y=I.cy>p.cy;i={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:I.cx,y:y?I.rect.top:I.rect.bottom}}else{const y=I.cx>p.cx;i={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?I.rect.left:I.rect.right,y:I.cy}}if(Pt(i,x,o,[c,g],1))continue;const b=r(f,c,g,u?"x":"y"),v=b>Fo?b:Fo,L=[0,v,-v];for(const y of L){const M={...i},E={...x};if(u){if(M.x+=y,E.x+=y,M.x<=p.rect.left||M.x>=p.rect.right||E.x<=I.rect.left||E.x>=I.rect.right)continue}else if(M.y+=y,E.y+=y,M.y<=p.rect.top||M.y>=p.rect.bottom||E.y<=I.rect.top||E.y>=I.rect.bottom)continue;if(!Pt(M,E,o,[c,g],1)&&!Qe(M,E,t,f,{epsilon:Cn})){f.points=[M,E];break}}}}d(Ts,"straightenCollinearSiblingDetours");function Wn(t,e){const{realNodeRects:l,labelNodeRects:c}=Me(e.values()),g=d((y,M)=>Be(M,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=M.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const M of t){if(M.isLayoutOnly)continue;const E=M.points;!E||E.length<2||y.push(...g(M,xt(E)))}return y},"allSegments"),I=d((y,M)=>y.horizontal&&M.horizontal?Wt(y.a.x,y.b.x,M.a.x,M.b.x)>=8&&Math.abs(y.a.y-M.a.y)<7:y.vertical&&M.vertical?Wt(y.a.y,y.b.y,M.a.y,M.b.y)>=8&&Math.abs(y.a.x-M.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,M)=>{const E=y.start,w=y.end,B=g(y,M);if(B.length!==M.length-1)return!1;const O=[E,w].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,l,O,-2)||Pt(H.a,H.b,c,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(I(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,M)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const w=E.map(B=>({...B}));if(y.horizontal)w[y.index].y+=M,w[y.index+1].y+=M;else if(y.vertical)w[y.index].x+=M,w[y.index+1].x+=M;else return;return g(y.edge,w).length===w.length-1?w:void 0},"shiftedCandidate"),i=d((y,M)=>({x:y.x??(M.left+M.right)/2,y:y.y??(M.top+M.bottom)/2}),"nodeCenter"),x=d(y=>{const M=y.edge,E=xt(M.points??[]);if(E.length!==4||y.index!==1)return;const w=M.start?e.get(M.start):void 0,B=M.end?e.get(M.end):void 0,O=w?te(w):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!w||!B||!O||!k||H.length===0))return{sourceCenter:i(w,O),targetCenter:i(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,M,E,w,B,O)=>{const k=w.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+M;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,M,E,w,B,O)=>{const k=w.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+M;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,M)=>{const E=x(y);if(E){if(y.vertical)return C(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const M=p();let E=!1;for(let w=0;wP.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(Wn,"nudgeSharedInteriorSubpaths");function As(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=o.x-n.x,a=o.y-n.y,l=s*a-r*f;if(Math.abs(l)<1e-10)return!1;const c=n.x-t.x,g=n.y-t.y,p=(c*a-g*f)/l,I=(c*r-g*s)/l,u=.01;return p>u&&p<1-u&&I>u&&I<1-u}d(As,"segmentsIntersect");function ws(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<2)continue;const c=a.start,g=a.end,p=a.labelNodeId,I=a.id??`${c}->${g}`;for(const u of s)if(!(u.nodeId===c||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h0){const a=o.filter(c=>c.type==="edge-node-overlap").length,l=o.filter(c=>c.type==="edge-edge-crossing").length;Ln.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${l} edge crossing(s)`);for(const c of o)Ln.warn(`[SWIMLANE_VALIDATE] ${c.type}: ${c.detail}`)}return o}d(ws,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ys(t,e)||e==="BT"&&s.length>0&&!ms(t))return;for(const a of o){if(a.isLayoutOnly)continue;const l=a.points;!l||l.length<2||(a.points=ue(tn(l)))}Ls(o,n),Ts(o,n),ps(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Ke(o,r),is(o,r),xs(o,r),Wn(o,r),bs(o,r),Ms(o,r),Gn(o,r),Is(o,r);const f=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ke(o,r),Xn(o,r),Gn(o,r),Ke(o,r),Xn(o,r)},"finalizeRenderedEdges");f(),Wn(o,r),f(),$n(o,r),zn(o,r),$n(o,r),zn(o,r)}d(Rs,"postProcessSwimlaneLayout");function Ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const f=`${r.id}:${r.src}->${r.dst}`;n.has(f)||(n.add(f),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function xo(t,e){return t.edges.filter(n=>n.dst===e)}d(xo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function bo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(bo,"buildSortedSuccessorMap");function Mo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(Mo,"buildInDegreeMap");function Io(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Io,"sortedZeroInDegreeNodes");function fn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(fn,"buildPredecessorSuccessorMaps");function So(t,e,n,o){var f,a;let s=0;for(const l of t.nodes)o!=null&&o.skipGroups&&((f=t.nodeById.get(l))!=null&&f.isGroup)||(s=Math.max(s,n[l]??0));const r=Array.from({length:s+1},()=>[]);for(const l of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(l))!=null&&a.isGroup)||r[Math.max(0,n[l]??0)].push(l);return r}d(So,"buildLayersFromRanks");function _e(t){const e=Mo(t),n=Io(e),o=[],s=bo(t);for(;n.length;){const r=n.shift();o.push(r);for(const f of s.get(r)??[])if(e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0){let a=0;for(;a{if(s-o<=1)return 0;const r=o+s>>1;let f=n(o,r)+n(r,s),a=o,l=r,c=o;for(;a=s||ap.dst===I.dst?p.id.localeCompare(I.id):p.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const I=p.dst;o[I]===0?r(I):o[I]===1&&s.push(p)}o[g]=2},"dfs"),f=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of f)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),l=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:l,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function ge(t){const e=Ps(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function dn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(dn,"buildTopLaneOrder");function vo(t,e){const n=dn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const f of e)!o.has(f)||s.has(f)||(s.add(f),r.push(f));for(const f of n)s.has(f)||r.push(f);return r}d(vo,"resolveTopLaneOrder");var _r={EPSILON:1e-6},rn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},_o={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=fn(n);for(const y of r.values())y.sort((M,E)=>M.localeCompare(E));const f=_e(n)??[...n.nodes].sort((y,M)=>y.localeCompare(M)),a=new Map;for(const[y,M]of f.entries())a.set(M,y);const l=new Map,c=new Map;for(const y of n.nodes)c.set(y,[]);for(const y of f){const M=(r.get(y)??[]).filter(E=>l.has(E));if(M.length>0){const E=ks(y,M,{laneOf:o,rankHint:s,topoIndex:a});l.set(y,E),c.get(E).push(y)}else l.has(y)||l.set(y,null)}for(const y of n.nodes)l.has(y)||l.set(y,null);const g=new Set;for(const y of n.nodes)(l.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,M)=>{const E=a.get(y)??0,w=a.get(M)??0;return E===w?y.localeCompare(M):E-w}),I=Fs(n),u=new Map;for(const[y,M]of I.entries())u.set(y,[...M].sort((E,w)=>E.localeCompare(w)));const h=_s(u),i=Ds(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of i)for(const M of y.nodes){const E=x.get(M);E?E.push(y.id):x.set(M,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const M of c.get(y)??[])L(M);b.push(y)}},"walk");for(const y of p)L(y);for(const y of f)L(y);return{parent:l,children:c,roots:p,componentOf:h,blocks:i,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:f}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,f)=>{var i,x;const a=n.laneOf(r),l=n.laneOf(f),c=a!=null&&a===o,g=l!=null&&l===o;if(c!==g)return c?-1:1;const p=(i=n.rankHint)==null?void 0:i[r],I=(x=n.rankHint)==null?void 0:x[f];if(p!=null&&I!=null&&p!==I)return I-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(f)??0;return u!==h?u-h:r.localeCompare(f)})[0]}d(ks,"chooseParent");function Fs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Fs,"buildAdjacency");function _s(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const f of t.get(r)??[])e.has(f)||s.push(f)}}n++}return e}d(_s,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const f=d((a,l)=>{e.set(a,++r),n.set(a,r);for(const c of t.get(a)??[])c!==l&&(e.has(c)?(e.get(c)??0)<(e.get(a)??0)&&(o.push([a,c]),n.set(a,Math.min(n.get(a)??r,e.get(c)??r))):(o.push([a,c]),f(c,a),n.set(a,Math.min(n.get(a)??r,n.get(c)??r)),(n.get(c)??0)>=(e.get(a)??0)&&s.push(Hs(a,c,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||f(a,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const f=n.pop();if(s.push(f),r.add(f[0]),r.add(f[1]),f[0]===t&&f[1]===e||f[0]===e&&f[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,f=new Array(r).fill(-1),a=new Array(r).fill(0),l=[],c=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(f[L]=-1,a[L]=0,c.has(b)||(c.add(b),l.push(b)))}for(;l.length>0;){const b=l.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(c.has(y))continue;const M=s.get(y);M!=null&&(f[M]=v,a[M]=a[v]+1,c.add(y),l.push(y))}}for(const b of o){if(c.has(b))continue;const v=s.get(b);v!=null&&(f[v]=-1,a[v]=0,c.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b{if(b===-1||v===-1)return-1;a[b]>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const M=p[y][b],E=p[y][v];M===-1||E===-1||M!==E&&(b=M,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],M=e[L];if(y==null||M==null||(y>M&&([v,L]=[L,v],[y,M]=[M,y]),y==null||M==null||y===M))continue;const E=s.get(v),w=s.get(L);if(E==null||w==null)continue;const B=I(E,w);if(B===-1)continue;const O=u[B];for(let k=y;k{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,M=n.children.get(b)??[];for(const E of M){const w=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=w.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}i(y,w)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let f=n[r]??0;const a=[...e.get(r)??[]];a.sort(Lo(n));for(const l of a){s(l);const c=o.get(l);c!=null&&(f=Math.min(f,c))}o.set(r,f)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Lo(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Lo,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const l of e){const c=n[l]??0;c>s&&(s=c)}const r=Array.from({length:s+1},()=>[]),f=new Set,a=d(l=>{if(f.has(l))return;f.add(l);const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l);for(const g of o(l))a(g)},"emit");for(const l of t)a(l);for(const l of e)if(!f.has(l)){const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l),f.add(l)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const f=e[s]??0,a=[],l=[],c=n.get(s);for(const g of r){const p=o.get(g)??f;p>f?a.push({child:g,min:p}):l.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),l.sort((g,p)=>{const I=(c==null?void 0:c.get(g))??0,u=(c==null?void 0:c.get(p))??0;if(I!==u)return I-u;const h=o.get(g)??f,i=o.get(p)??f;return h!==i?h-i:g.localeCompare(p)}),[...a.map(g=>g.child),...l]}}d(zs,"createChildOrderer");function cn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const f=Xs(t,e,o),a=[...r].sort(Lo(e)),l=Ys(a,s,e),c=zs(s,e,f,l);let g=Gs(a,t.nodes,e,c);return g=$s(g),g}d(cn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),f=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&f.push(r.get(a.dst));return Co(f)}d(Vs,"countCrossingsBetweenAdjacent");function Kn(t,e,n){const o=[];for(const r of e){const f=n[r.src],a=n[r.dst];if(f==null||a==null||f===a)continue;let l=r.src,c=r.dst,g=f,p=a;f>a&&(l=r.dst,c=r.src,g=a,p=f);for(let I=g;I(n[I]??0)-(n[p]??0));for(const p of g){const I=n[p]??0;if(I===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=I)continue;const h=I;n[p]=u;const i=cn(t,n,s),x=Kn(i,t.edges,n);x(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const f=t.edges.filter(i=>i.src===s);if(f.length===0)continue;let a=!1,l=0;for(const i of f){const x=n(i.dst);x==null||x===r?a=!0:l++}if(l===0||a)continue;let c=0,g=!1;for(const i of t.edges){if(i.dst!==s)continue;const x=n(i.src);x&&(x===r?g=!0:c++)}if(c>0||!g)continue;const p=e[s]??0,I=p+l;let u=0;for(const i of t.edges)i.dst===s&&(u=Math.max(u,(e[i.src]??0)+1));const h=Math.max(p,u,I);h!==p&&(e[s]=h)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=Ie(t),o=_e(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let f=Object.create(null);for(const l of o){const c=xo(n,l),g=e!=null&&e.ignoreCrossLaneEdges?c.filter(p=>{const I=r(p.src),u=r(l);return!I||!u?!0:I===u}):c;if(g.length===0)f[l]=0;else if(s&&g.length===1){const p=g[0].src,I=r(p),u=r(l);I!==u?f[l]=f[p]??0:f[l]=(f[p]??0)+1}else{let p=-1/0;for(const I of g)p=Math.max(p,(f[I.src]??0)+1);f[l]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(f=js(n,f)),e!=null&&e.ignoreCrossLaneEdges&&Us(n,f),{layers:cn(n,f,r),rankOf:f,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=Ie(t),s={...Ws(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:f,succs:a}=fn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const i=r(h.src),x=r(h.dst);if(i&&x&&i!==x)return!1}return!0}),l=_e(n)??[...n.nodes],c=[...l].reverse(),g=d((h,i)=>{let x=0;for(const v of f.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,i)),Math.min(Math.max(i,x),C)},"clampFeasible"),p=rn.GRAVITY_ITERATIONS,I=d(h=>{let i=!1;for(const x of h){const C=f.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,w)=>E+(s[w]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,w)=>E+(s[w]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),M=g(x,y);M!==s[x]&&(s[x]=M,i=!0)}return i},"relaxOrder");for(let h=0;h0){const x=Math.min(...i.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:So(n,l,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=Mo(t),n=bo(t);let o=Io(e);const s=[];for(;o.length>0;){const r=[];for(const f of o){s.push(f);for(const a of n.get(f)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((f,a)=>f.localeCompare(a))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?qs(n)??[...n.nodes].sort():_e(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),f=Object.create(null),a=new Map,l=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const I=xo(n,g);let u=0;if(I.length>0)for(const C of I){const b=C.src,v=f[b]??0;u=Math.max(u,v+l(b,g))}const h=r(g),i=a.get(h)??0,x=Math.max(u,i);f[g]=x,a.set(h,x+1)}return{layers:So(n,o,f,{skipGroups:!0}),rankOf:f,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let f=0;const a=new Map(n.nodeById),l=d(u=>{const h=`placeholder-${f++}`,i={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,i),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),c=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of c){const h=o[u.src]??0,i=o[u.dst]??0;if(i-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function qn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(qn,"median");function Jn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Jn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function Zn(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),f=ke(e),a=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&a.push({u:r.get(c.src),v:f.get(c.dst)});a.sort((c,g)=>c.u===g.u?c.v-g.v:c.u-g.u);const l=a.map(c=>c.v);return Co(l)}d(Zn,"countCrossingsBetweenAdjacent");function qe(t,e,n){return[...t].sort((o,s)=>{const r=qn(e.get(o)??[]),f=qn(e.get(s)??[]);return r===f?tr(o,s,n):isFinite(r)?isFinite(f)?r-f:-1:1})}d(qe,"sortByHeuristic");function Qn(t,e,n,o,s,r){const f=ke(t),a=ke(e),l=Qs(e,f,n,o);if(!s||!r||r.length===0)return qe(e,l,a);const c=new Map;for(const I of e){const u=s(I),h=c.get(u)??[];h.push(I),c.set(u,h)}const g=[];for(const I of r){const u=c.get(I);if(!u||u.length===0)continue;const h=qe(u,l,a);g.push(...h)}const p=c.get(null);if(p&&p.length>0){const I=qe(p,l,a);for(const u of I){const h=Jn(l.get(u)??[]);let i=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Jn(l.get(C)??[]);if(hf.has(i.src)&&a.has(i.dst)),g=l?n.filter(i=>a.has(i.src)&&l.has(i.dst)):void 0,p=d(i=>{let x=Zn(t,i,c);return g&&o&&(x+=Zn(i,o,g)),x},"crossingScore"),I=s?new Map:null;if(s&&I)for(const i of e)I.set(i,s(i));let u=!0,h=p(r);for(;u;){u=!1;for(let i=0;i+1[...a]),s=e.edges,r=ge(e),f=vo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let l=1;l=0;l--)o[l]=Qn(o[l+1],o[l],s,"up",r,f),o[l]=to(o[l+1],o[l],s,o[l-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=(n==null?void 0:n.layerGap)??_o.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??_o.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,f=(n==null?void 0:n.direction)??"TB",a=f==="LR"||f==="RL",l=t.layers,c=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),i=vo(e,n==null?void 0:n.laneOrder),x=l.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1Math.max(Mt,I(Ht)),0),H=l[O+1].reduce((Mt,Ht)=>Math.max(Mt,I(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of l)for(const k of O)b.add(h(k));const v=b.has(null),L=i.filter(O=>b.has(O)),y=[...v?[null]:[],...L],M=Object.create(null);for(const O of L)M[O]=0;v&&(M.null=0);for(const O of l){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+I(ft),0)+s*Math.max(0,G.length-1);M[P]=Math.max(M[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);M.null=Math.max(M.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?M.null:M[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;PI(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let _t=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];c[J]=_t+rt/2,g[J]=w+H/2,_t+=rt+s}}}const G=C[O]??0;w+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((c[H]??0)+(c[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(c[tt]=G)}}return{x:c,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function eo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:f}of e){const a=n.get(s),l=n.get(r);a==null||l==null||(o+=f*Math.abs(a-l))}return o}d(eo,"laneArrangementCost");function ar(t){const e=dn(t);if(e.length<2)return[];const n=new Map(e.map((r,f)=>[r,f])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const f=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!f||!a||!t.nodeById.has(f)||!t.nodeById.has(a))continue;const l=o(f),c=o(a);if(!l||!c||l===c)continue;const g=n.get(l),p=n.get(c);if(g==null||p==null)continue;const[I,u]=g<=p?[l,c]:[c,l],h=`${I}\0${u}`,i=s.get(h);i?i.weight++:s.set(h,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function no(t,e,n){const o=[...t];let s=eo(o,e),r=!0,f=0;const a=Math.max(1,o.length);for(;r&&fs.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:f})=>`${s}:${r}:${f}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=dn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((a,l)=>[a,l]));let r=no(n,o,s);const f=Math.max(0,e.restarts??or);for(let a=0;alt&&l*3>=a?f>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(oo,"chooseOrthogonalSide");function so(t,e){return Math.abs(t.to-e.from)m.isGroup&&!m.parentId);for(const m of c){const S={id:m.id},A=d(T=>{f.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(A)},"assignLane");A(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,A=m.height??10,T=m.x??0,N=m.y??0,D=Dr;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-A/2-D,maxY:N+A/2+D,visualXHalfExtent:l?A/2+D:S/2+D}}),p=d((m,S,A,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:A,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,A),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),I=d((m,S)=>{const A=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-A/2,y:D};case"right":return{x:N+A/2,y:D}}},"portForSide"),u=d((m,S,A)=>I(m,oo(m,S,A?"bottom":"top")),"getOrthogonalPort"),h=[],i=[],x=new Set,C=1e3,b=d((m,S,A)=>{if(h.length===0)return 0;const T=Math.abs(S.y-A.y)U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,A.y)-lt,U=Math.max(S.y,A.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coordU||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const A=r.get(m.start),T=r.get(m.end),N=f.get(m.start),D=f.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=A&&T?Math.abs((T.x??0)-(A.x??0)):0,U=A&&T?Math.abs((T.y??0)-(A.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const A=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(A-T)>1?A-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,A,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>A&&z.nodeId===A||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minYm.y&&z.maxX>N&&z.minXm.x&&z.maxY>W&&z.minYoo(m,S,"bottom"),"determineSide"),w=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const N=(T.x??0)-(A.x??0),D=(T.y??0)-(A.y??0);w.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(A,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:A.x??0,y:A.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of w.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of w.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,A)=>{const T=B(S),N=B(A);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-A.edgeIdx});for(let S=1;S=N||(H.set(P(A.srcId,A.srcSide),N-1),H.set(P(A.srcId,T),D+1),A.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of w.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of w.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const A=O(m);if(S.has(A)||(H.get(P(m.srcId,A))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,A),1),m.srcSide=A}for(const m of w.values()){const{edgeIdx:S,srcId:A,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(A),ot=r.get(T),U=`${A}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((wt,Gt)=>wt.oppositeCoord-Gt.oppositeCoord);const A=m.split(":"),T=A.slice(0,-2).join(":"),N=A[A.length-2],D=A[A.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[wt,Gt]of S.entries()){const ee=Bt+wt*st,mn=`${Gt.edgeIdx}:${D}`;tt.set(mn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:A})=>Mt(A))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:A})=>Mt(A)):!1,"faceHasLabelNode"),_t=d((m,S,A)=>S==="top"||S==="bottom"?{x:m.x+A,y:m.y}:{x:m.x,y:m.y+A},"applyPortOffset"),nt=d((m,S,A)=>{const T=w.get(m),N={x:A.x??0,y:A.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(A,D);let U=T?I(S,T.srcSide):u(S,N,!0),z=T?I(A,T.dstSide):u(A,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=_t(U,W,bt)),dt!==void 0&&(z=_t(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(i[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,A,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(A.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(A.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.xQ.minY&&X.y{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],wt=ct(U,Bt);if(wt.inside&&wt.obstacle){const X=wt.obstacle;if(bt){const $=st(N,A,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,A,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,A,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,A,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)1||Ct>1,kt=M.get(S.start??"")??0,mt=M.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const mn=p("vertical",U.x,U.y,U.y);U.x=mn.coord;const pr=p("vertical",z.x,z.y,z.y);z.x=pr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,Ae=Math.min(U.y,z.y)-50,we=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX$&&X.minYht&&(ye=Math.min(ye,X.minX-We),pe=Math.max(pe,X.maxX+We),Ae=Math.min(Ae,X.minY-We),we=Math.max(we,X.maxY+We))}for(const X of g){if(X.maxXpe||X.maxYwe)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,Ae,we),p("vertical",X.maxX+Q,Ae,we)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const xr=a.filter(X=>X.orientation==="horizontal"&&X.coord>=Ae&&X.coord<=we),br=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),De=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),He=De(U.x,U.y),Eo=De(z.x,z.y),Xe=new Map,yn=new Map,pn=new Map,Ye=new Set,Se=[];Xe.set(He,0),pn.set(He,"n"),Se.push({key:He,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ye.add(He);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),xn={x:z.x,y:U.y},Mr=xe(U,xn),Ir=xe(xn,z),Sr=Mr||Ir,bn={x:U.x,y:z.y},Cr=xe(U,bn),vr=xe(bn,z);if(Sr?Cr||vr||(Math.abs(U.x-z.x)0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ye.delete(X.key),X.key===Eo){let mt=Eo,Vt=z;for($t=[Vt];yn.has(mt);){const re=yn.get(mt);$t.unshift(re),Vt=re,mt=De(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=br.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=xr.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rtne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minYQ&&ne.maxX>Vt&&ne.minX$&&ne.maxY>Dt&&ne.minY10&&Mn<-5||Re<-10&&Mn>5)&&(Et=Math.abs(Mn)*100),(Zt>10&&Ge<-5||Zt<-10&&Ge>5)&&(Et+=Math.abs(Ge)*50);let To=0;const Ao=pn.get(X.key)??"n",wo=Math.abs(Ge)>lt?"h":"v";Ao!=="n"&&Ao!==wo&&(To=50);const Lr=Ut+Lt+Et+To,$e=(Xe.get(X.key)??1/0)+Lr,Ro=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if($e<(Xe.get(vt)??1/0))if(yn.set(vt,X.pt),Xe.set(vt,$e),pn.set(vt,wo),!Ye.has(vt))Se.push({key:vt,f:$e+Ro,pt:mt}),Ye.add(vt);else{const ne=Se.findIndex(Er=>Er.key===vt);ne!==-1&&(Se[ne].f=$e+Ro)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=QLt.minXjt&&Lt.minYFt);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(Ft=>Ft.minXMath.min(X.y,$.y));if(jt.length>0){let Ft=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;Ft=Math.min(Ft,Lt)}Q=Ft}}}const mt=d(Dt=>{const jt=$.y>X.y,Ft=g.filter(Lt=>{const Et=Math.min(X.x,$.x)Lt.minX,Zt=Math.min(X.y,$.y)Lt.minY;return Et&&Zt});let vt=Ft;if(l&&Ft.length>0){const Lt=Ft.filter(Et=>Et.minXDt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),Ft={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,Ft),Et=xe(Ft,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;Xm.from{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!A.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=A.index,A.segments=[...A.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const A=m.pipe.tracks[m.trackIndex];A.segments=A.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const A=i[m.edgeIndex];for(const T of A){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),At=d(m=>{const S=i[m.edgeIndex],A=S.indexOf(h.indexOf(m)),T=[];return A>0&&T.push(h[S[A-1]]),A{if(m.orientation===S.orientation)return!1;const A=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>A.from&&T.pipe.coordT.from&&A.pipe.coord{for(const A of m.tracks)if(!A.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return A.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const A=At(m),T=At(S);return A.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,A)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);A(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let A=0;A{if(me.has(m))return me.get(m);const S=i[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;otMath.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),un=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())i[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const A=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=A(D),bt=A(W);if(Math.abs(z-bt)>1)return bt-z;const dt=i[D].length,ct=i[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=i[D][0],It=i[W][0];if(h[st]&&h[It]){const Bt=h[st],wt=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(wt.to-wt.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[i[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),hn=d(()=>{let m=0;const S=new Map;for(const[A,T]of s.entries())i[A].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(A));for(const A of S.values()){A.sort((N,D)=>{const W=d(z=>{const bt=i[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=A.map(N=>h[i[N][i[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),gn=d(()=>{let m=0;for(const S of a){const A=[];for(const T of S.tracks)for(const N of T.segments){const D=i[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&A.push(h[D])}A.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const A=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;DN.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const wt=x.has(Bt.edgeIndex)?m.coord:It;_.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,wt)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*vn);if(U.length===0&&N.size>0){const st=[...N].sort((wt,Gt)=>Math.abs(D.get(wt)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*vn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*vn)}}for(const[m,S]of s.entries()){const A=i[m]??[];if(A.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=A.map(dt=>{const ct=h[dt],st=_.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dtlt&&T.push(ve(ct,It)),Gt&&wt.orient===ct.orient)if(Math.abs(ct.coord-wt.coord)>lt){const ee=ct.orient==="vertical"?(It+wt.from)/2:so(ct,wt);T.push(ve(ct,ee),ve(wt,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,so(ct,wt)));else if(Gt)T.push(ve(ct,wt.coord));else{const ee=Math.abs(ct.from-It)lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dtlt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const A=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=A-N/2,ot=A+N/2,U=T-D/2,z=T+D/2;if(m.xot||m.yz)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const A=m.start,T=m.end,N=A?r.get(A):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function mr(t){var g,p,I,u,h;const e=Jo(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((I=t.config.swimlane)==null?void 0:I.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,f=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=gr(t),{ordered:l,coordinates:c}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:f,direction:a});Zo(e,l,c,{nodeGap:n,layerGap:o});for(const i of t.edges??[])delete i.points;hr(t,a);for(const i of t.edges??[])(!i.curve||i.curve==="basis")&&(i.curve="rounded");return Rs(t,a),ws(t),a}d(mr,"runSwimlaneLayoutCore");function yr(t){qo(t);const e=Qo(t);t.nodes=e.nodes,t.edges=e.edges}d(yr,"prepareSwimlaneLayout");var $r=Tr({prepareLayout:yr,runLayoutCore:mr,afterPaint:Wo});export{$r as render}; diff --git a/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-BWEneQLP.js b/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-BWEneQLP.js new file mode 100644 index 000000000..6e928a171 --- /dev/null +++ b/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-BWEneQLP.js @@ -0,0 +1,8 @@ +import{c as r,s as e}from"./flowDiagram-HODETNUW-BRjqrD7u.js";import{_ as a}from"./mermaid.core-YRnlneqM.js";import"./chunk-5VM5RSS4-DuWyxJ-G.js";import"./chunk-XXDRQBXY-CEoTwp0p.js";import"./chunk-POPQ4Y6H-OaNnn-K8.js";import"./chunk-F27PBJKO-2GmsQB4U.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";import"./channel-BcBgmgAp.js";var o=a(t=>`${e(t)} + .swimlane.cluster rect { + stroke: ${t.clusterBorder} !important; + } + [data-look="neo"].cluster rect { + filter: none; + } +`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js b/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js deleted file mode 100644 index ecf1a757f..000000000 --- a/amplifier_web/static/assets/swimlanesDiagram-VR7AAH4N-CLgWPzHj.js +++ /dev/null @@ -1,8 +0,0 @@ -import{c as r,s as e}from"./flowDiagram-HODETNUW-Bfis7KwQ.js";import{_ as a}from"./mermaid.core-BQ5lTCZr.js";import"./chunk-5VM5RSS4-XkKVGNmc.js";import"./chunk-XXDRQBXY-DdE0HtLo.js";import"./chunk-POPQ4Y6H-C_hQ_kWj.js";import"./chunk-F27PBJKO-35QGDevQ.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./channel-CSv1n6Zd.js";var o=a(t=>`${e(t)} - .swimlane.cluster rect { - stroke: ${t.clusterBorder} !important; - } - [data-look="neo"].cluster rect { - filter: none; - } -`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/amplifier_web/static/assets/timeline-definition-24CTP7MA-Ck5GR00U.js b/amplifier_web/static/assets/timeline-definition-24CTP7MA-tqGUvpOH.js similarity index 99% rename from amplifier_web/static/assets/timeline-definition-24CTP7MA-Ck5GR00U.js rename to amplifier_web/static/assets/timeline-definition-24CTP7MA-tqGUvpOH.js index 8752aed1e..b573aa9f2 100644 --- a/amplifier_web/static/assets/timeline-definition-24CTP7MA-Ck5GR00U.js +++ b/amplifier_web/static/assets/timeline-definition-24CTP7MA-tqGUvpOH.js @@ -1,4 +1,4 @@ -import{_ as l,y as pt,U as Wt,V as Pt,W as Bt,c as gt,l as S,D as Vt,L as Ft,X as ft,j as J,t as zt,Y as Gt,p as Ot}from"./mermaid.core-BQ5lTCZr.js";import{d as ot}from"./arc-CxD3pp7w.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var X="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?X="Parse error on line "+(M+1)+`: +import{_ as l,y as pt,U as Wt,V as Pt,W as Bt,c as gt,l as S,D as Vt,L as Ft,X as ft,j as J,t as zt,Y as Gt,p as Ot}from"./mermaid.core-YRnlneqM.js";import{d as ot}from"./arc-D2jKxjLS.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var X="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?X="Parse error on line "+(M+1)+`: `+_.showPosition()+` Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":X="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,C=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},q&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,C,M,R.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/amplifier_web/static/assets/vennDiagram-4TSXK5OY-kVi8iDPL.js b/amplifier_web/static/assets/vennDiagram-4TSXK5OY-pcfAD8hQ.js similarity index 99% rename from amplifier_web/static/assets/vennDiagram-4TSXK5OY-kVi8iDPL.js rename to amplifier_web/static/assets/vennDiagram-4TSXK5OY-pcfAD8hQ.js index 63b1eca59..2735229c0 100644 --- a/amplifier_web/static/assets/vennDiagram-4TSXK5OY-kVi8iDPL.js +++ b/amplifier_web/static/assets/vennDiagram-4TSXK5OY-pcfAD8hQ.js @@ -1,4 +1,4 @@ -import{b1 as Gt,s as Kt,g as Ht,o as Yt,n as Xt,a as Zt,b as Jt,_ as S,y as St,D as Qt,j as rt,am as $t,U as te,V as ee,W as ne,d as se,p as ie,A as re,B as oe}from"./mermaid.core-BQ5lTCZr.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let h=e[e.length-1];for(let u=0;uy.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(h)ct(n))}function tt(t,n){let s=0;for(let e=0;ev.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx=1)break;for(let f=1;fl+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a{const p={};for(let d=0;dxt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;ul===h?0:lr.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;dp.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;mt[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function q(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function U(I){return C=>{const W=I.sets.map(J=>{let G=V[J],X=k[J];return G||(G={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:G.x*(1-C)+X.x*C,y:G.y*(1-C)+X.y*C,radius:G.radius*(1-C)+X.radius*C}});return wt(W,y)}}const A=B.selectAll(".venn-area").data(f,I=>I.sets),j=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),F=j.append("path"),L=j.append("text").attr("class","label").text(I=>q(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(F.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",U)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const D=_.selectAll("text").filter(I=>I.sets in R).text(I=>q(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in D?D.on("end",ot(k,q)):D.each("end",ot(k,q)):D.each(ot(k,q)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",U);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),Y.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:j,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` +import{b1 as Gt,s as Kt,g as Ht,o as Yt,n as Xt,a as Zt,b as Jt,_ as S,y as St,D as Qt,j as rt,am as $t,U as te,V as ee,W as ne,d as se,p as ie,A as re,B as oe}from"./mermaid.core-YRnlneqM.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let h=e[e.length-1];for(let u=0;uy.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(h)ct(n))}function tt(t,n){let s=0;for(let e=0;ev.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx=1)break;for(let f=1;fl+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a{const p={};for(let d=0;dxt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;ul===h?0:lr.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;dp.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;mt[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function q(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function U(I){return C=>{const W=I.sets.map(J=>{let G=V[J],X=k[J];return G||(G={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:G.x*(1-C)+X.x*C,y:G.y*(1-C)+X.y*C,radius:G.radius*(1-C)+X.radius*C}});return wt(W,y)}}const A=B.selectAll(".venn-area").data(f,I=>I.sets),j=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),F=j.append("path"),L=j.append("text").attr("class","label").text(I=>q(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(F.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",U)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const D=_.selectAll("text").filter(I=>I.sets in R).text(I=>q(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in D?D.on("end",ot(k,q)):D.each("end",ot(k,q)):D.each(ot(k,q)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",U);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),Y.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:j,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` M`,t,n),e.push(` m`,-s,0),e.push(` a`,s,s,0,1,0,s*2,0),e.push(` diff --git a/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js b/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-Ck_DXu78.js similarity index 99% rename from amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js rename to amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-Ck_DXu78.js index e70842c0d..ce730095b 100644 --- a/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-xeAzTPpE.js +++ b/amplifier_web/static/assets/wardleyDiagram-VM6X3IG4-Ck_DXu78.js @@ -1,4 +1,4 @@ -import{p as zt}from"./chunk-JWPE2WC7-wq4F1yC9.js";import{s as Lt,g as Tt,o as At,n as Xt,a as Et,b as Yt,_ as y,E as It,y as Bt,A as Q,l as et,D as Ft,d as Rt,p as Ot,c as V}from"./mermaid.core-BQ5lTCZr.js";import{p as Wt}from"./cynefin-OW5HDTMX-C5aohCXI.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map +import{p as zt}from"./chunk-JWPE2WC7-DQLdNA-f.js";import{s as Lt,g as Tt,o as At,n as Xt,a as Et,b as Yt,_ as y,E as It,y as Bt,A as Q,l as et,D as Ft,d as Rt,p as Ot,c as V}from"./mermaid.core-YRnlneqM.js";import{p as Wt}from"./cynefin-OW5HDTMX-r2gVnQsI.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map `+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),L=v.getDiagramTitle(),M=((J=g.size)==null?void 0:J.width)??r.width,k=((K=g.size)==null?void 0:K.height)??r.height,N=Ft(o);N.selectAll("*").remove(),Rt(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const B=M-r.padding*2,F=k-r.padding*2;L&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(L);const T=y(t=>r.padding+t/100*B,"projectX"),A=y(t=>k-r.padding-t/100*F,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+B/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+F/2})`).text(bt);const R=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(R.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===R.length){let i=0;n.forEach(h=>{s.push({start:i,end:h}),i=h})}else{const i=1/R.length;R.forEach((h,l)=>{s.push({start:l*i,end:(l+1)*i})})}R.forEach((i,h)=>{const l=s[h],x=r.padding+l.start*B,f=r.padding+l.end*B,u=(x+f)/2;h>0&&t.append("line").attr("x1",x).attr("x2",x).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+B*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-F*s).attr("y2",k-r.padding-F*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:T(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f{const u=c.get(f);u&&(h=Math.min(h,u.x),l=Math.max(l,u.x),x=u.y)}),h!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=x-u/2,S=c.get(s.nodeId);if(S){const z=(h+l)/2;S.x=z,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",w).attr("width",l-h+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.x+l/f*h}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.y+x/f*h}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.x+l/f*h}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.y+x/f*h}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=s.y-n.y,l=s.x-n.x,x=Math.sqrt(l*l+h*h),f=8,u=h/x;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,h=s.x-n.x,l=s.y-n.y,x=Math.sqrt(h*h+l*l),f=8,u=-h/x;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=(n.y+s.y)/2,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x),u=8,w=x/f,S=-l/f,z=i+w*u,W=h+S*u;let Y=Math.atan2(x,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${z} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=T(t.targetX),i=A(t.targetY),h=s-n.x,l=i-n.y,x=Math.sqrt(h*h+l*l),f=r.nodeRadius+2,u=x>f?s-h/x*f:s,w=x>f?i-l/x*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:T(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i{const h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=T(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,h=16,l=11,x=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const z=x.append("text").attr("x",n+i).attr("y",s+i+(S+1)*h).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(z)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const z=w+i*2+105,W=f.length*h+i*2+S/2,Y=r.padding,Pt=M-r.padding-z,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*h)}),x.insert("rect","text").attr("x",n).attr("y",s).attr("width",z).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=T(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=T(n.x),i=A(n.y),h=60,l=30,x=20,f=` M ${s} ${i-l/2} L ${s+h-x} ${i-l/2} diff --git a/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js b/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-BMGpkbBF.js similarity index 99% rename from amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js rename to amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-BMGpkbBF.js index 320c0b9b1..eb70fbe80 100644 --- a/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-DF_x_q58.js +++ b/amplifier_web/static/assets/xychartDiagram-S5SC5T6Z-BMGpkbBF.js @@ -1,4 +1,4 @@ -import{s as pi,g as mi,o as $t,n as yi,a as bi,b as wi,_ as a,l as Ut,D as Ai,d as Ci,p as Si,y as Dt,i as Ri,A as Gt,B as _i,E as ki,aB as Ti,Q as Xt}from"./mermaid.core-BQ5lTCZr.js";import{i as Di}from"./init-Gi6I4Gst.js";import{o as Pi}from"./ordinal-Cboi1Yqb.js";import{l as Nt}from"./linear-BcEdwvr4.js";import"./app-zsnl1T1T.js";import"./client-BPXDbY79.js";import"./defaultLocale-DX6XiGOO.js";function vi(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s"u"&&(P.yylloc={});var wt=P.yylloc;r.push(wt);var xi=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(B){d.length=d.length-2*B,_.length=_.length-B,r.length=r.length-B}a(fi,"popStack");function Ft(){var B;return B=x.pop()||P.lex()||Vt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=g.symbols_[B]||B),B}a(Ft,"lex");for(var I,U,V,At,j={},xt,Y,Wt,ft;;){if(U=d[d.length-1],this.defaultActions[U]?V=this.defaultActions[U]:((I===null||typeof I>"u")&&(I=Ft()),V=lt[U]&<[U][I]),typeof V>"u"||!V.length||!V[0]){var Ct="";ft=[];for(xt in lt[U])this.terminals_[xt]&&xt>ui&&ft.push("'"+this.terminals_[xt]+"'");P.showPosition?Ct="Parse error on line "+(dt+1)+`: +import{s as pi,g as mi,o as $t,n as yi,a as bi,b as wi,_ as a,l as Ut,D as Ai,d as Ci,p as Si,y as Dt,i as Ri,A as Gt,B as _i,E as ki,aB as Ti,Q as Xt}from"./mermaid.core-YRnlneqM.js";import{i as Di}from"./init-Gi6I4Gst.js";import{o as Pi}from"./ordinal-Cboi1Yqb.js";import{l as Nt}from"./linear-61bSIS_K.js";import"./app-DmCHnbVO.js";import"./client-BPXDbY79.js";import"./defaultLocale-DX6XiGOO.js";function vi(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s"u"&&(P.yylloc={});var wt=P.yylloc;r.push(wt);var xi=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(B){d.length=d.length-2*B,_.length=_.length-B,r.length=r.length-B}a(fi,"popStack");function Ft(){var B;return B=x.pop()||P.lex()||Vt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=g.symbols_[B]||B),B}a(Ft,"lex");for(var I,U,V,At,j={},xt,Y,Wt,ft;;){if(U=d[d.length-1],this.defaultActions[U]?V=this.defaultActions[U]:((I===null||typeof I>"u")&&(I=Ft()),V=lt[U]&<[U][I]),typeof V>"u"||!V.length||!V[0]){var Ct="";ft=[];for(xt in lt[U])this.terminals_[xt]&&xt>ui&&ft.push("'"+this.terminals_[xt]+"'");P.showPosition?Ct="Parse error on line "+(dt+1)+`: `+P.showPosition()+` Expecting `+ft.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Ct="Parse error on line "+(dt+1)+": Unexpected "+(I==Vt?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Ct,{text:P.match,token:this.terminals_[I]||I,line:P.yylineno,loc:wt,expected:ft})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+I);switch(V[0]){case 1:d.push(I),_.push(P.yytext),r.push(P.yylloc),d.push(V[1]),I=null,Ot=P.yyleng,m=P.yytext,dt=P.yylineno,wt=P.yylloc;break;case 2:if(Y=this.productions_[V[1]][1],j.$=_[_.length-Y],j._$={first_line:r[r.length-(Y||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(Y||1)].first_column,last_column:r[r.length-1].last_column},xi&&(j._$.range=[r[r.length-(Y||1)].range[0],r[r.length-1].range[1]]),At=this.performAction.apply(j,[m,Ot,dt,$.yy,V[1],_,r].concat(di)),typeof At<"u")return At;Y&&(d=d.slice(0,-1*Y*2),_=_.slice(0,-1*Y),r=r.slice(0,-1*Y)),d.push(this.productions_[V[1]][0]),_.push(j.$),r.push(j._$),Wt=lt[d[d.length-2]][d[d.length-1]],d.push(Wt);break;case 3:return!0}}return!0},"parse")},ht=(function(){var W={EOF:1,parseError:a(function(g,d){if(this.yy.parser)this.yy.parser.parseError(g,d);else throw new Error(g)},"parseError"),setInput:a(function(l,g){return this.yy=g||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var g=l.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:a(function(l){var g=l.length,d=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===x.length?this.yylloc.first_column:0)+x[x.length-d.length].length-d[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(l){this.unput(this.match.slice(l))},"less"),pastInput:a(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var l=this.pastInput(),g=new Array(l.length+1).join("-");return l+this.upcomingInput()+` diff --git a/amplifier_web/static/build.json b/amplifier_web/static/build.json index 8ea50ebbb..51368709d 100644 --- a/amplifier_web/static/build.json +++ b/amplifier_web/static/build.json @@ -1 +1 @@ -{"version":"0.20.45","id":"b48fe668835544e3"} +{"version":"0.20.46","id":"b48fe668835544e3"} diff --git a/amplifier_web/static/index.html b/amplifier_web/static/index.html index 2f6cdea0f..98fcaddae 100644 --- a/amplifier_web/static/index.html +++ b/amplifier_web/static/index.html @@ -16,7 +16,7 @@ Amplifier - +
diff --git a/amplifier_web/update_inventory_index.py b/amplifier_web/update_inventory_index.py index 1c6c3c351..bbc307be0 100644 --- a/amplifier_web/update_inventory_index.py +++ b/amplifier_web/update_inventory_index.py @@ -16,6 +16,7 @@ def signature(manager): + from . import __version__ from .session_files import amplifier_home from .updates import active_release, foundation_home @@ -44,6 +45,7 @@ def signature(manager): return hashlib.sha256( json.dumps( [ + __version__, active_release(home), stamps, tools, diff --git a/pyproject.toml b/pyproject.toml index a715e9375..2ae49f23a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "amplifier-unified" -version = "0.20.45" +version = "0.20.46" description = "A local voice-first Amplifier workspace with a shared user and agent interface" readme = "README.md" requires-python = ">=3.13" diff --git a/tests/test_runtime_shared_policy.py b/tests/test_runtime_shared_policy.py new file mode 100644 index 000000000..3b077c7fe --- /dev/null +++ b/tests/test_runtime_shared_policy.py @@ -0,0 +1,96 @@ +"""Exact shared source copies must not turn branch followers into standing pins.""" +import json +from pathlib import Path +import subprocess + +import pytest + +from amplifier_web import runtime_environment as environments +from amplifier_web.runtime_qualification import installed_graph + + +@pytest.fixture +def shared_build(tmp_path, monkeypatch): + monkeypatch.delenv('AMPLIFIER_SOURCE_STORE', raising=False) + home = tmp_path / 'app' + generation = 'a' * 32 + receipt = environments.receipt_directory(home, generation) + receipt.mkdir(parents=True) + (home / 'updates/active.json').write_text(json.dumps({'current': generation})) + project = environments.prepare_project(home, generation) + build = home / 'source-store/builds' / ('b' * 64) + build.mkdir(parents=True) + def git(*args): + return subprocess.check_output(['git', *args], cwd=build, text=True, stderr=subprocess.DEVNULL).strip() + git('init', '-b', 'main') + git('config', 'user.name', 'Fixture') + git('config', 'user.email', 'fixture@example.invalid') + (build / 'module.py').write_text('version = 1\n') + git('add', 'module.py') + git('commit', '-m', 'fixture') + revision = git('rev-parse', 'HEAD') + url = 'https://example.invalid/fixture' + (build / '.amplifier_cache_meta.json').write_text(json.dumps({ + 'git_url': url, 'ref': revision, 'commit': revision, 'buildInput': True})) + dist = project / '.venv/lib/python3.13/site-packages/amplifier_fixture-1.dist-info' + dist.mkdir(parents=True) + (dist / 'METADATA').write_text('Metadata-Version: 2.1\nName: amplifier-fixture\nVersion: 1\n') + (dist / 'direct_url.json').write_text(json.dumps({'url': build.as_uri(), 'dir_info': {}})) + bindings = receipt / 'foundation/cache/.source-bindings' + bindings.mkdir(parents=True) + binding = bindings / 'source.json' + binding.write_text(json.dumps({'git_url': url, 'ref': 'main', 'commit': revision})) + return home, generation, receipt, project, build, binding, revision + + +def dependency(home): + return next(row for row in environments.inventory(home) if row.get('package') == 'amplifier-fixture') + + +def test_owned_shared_build_follows_exact_generation_binding_without_rewriting_receipts(shared_build): + home, generation, receipt, project, build, binding, revision = shared_build + graph = installed_graph(project) + before = binding.read_bytes() + assert graph[0]['cacheSource']['ref'] == revision + row = dependency(home) + assert row['ref'] == 'main' and row['eligible'] and row['current'] == revision + policies = environments.shared_build_policies(home, generation, graph) + assert policies['amplifier-fixture']['revision'] == revision + (receipt / 'runtime-sources.json').write_text(json.dumps(policies)) + assert dependency(home)['ref'] == 'main' + assert installed_graph(project) == graph and binding.read_bytes() == before + + +@pytest.mark.parametrize('case', ['pin', 'ambiguous', 'different-revision', 'dirty', 'local-checkout', 'other-generation']) +def test_uncertain_or_explicit_sources_are_not_unpinned(shared_build, case): + home, generation, receipt, project, build, binding, revision = shared_build + data = json.loads(binding.read_text()) + if case == 'pin': + data['ref'] = revision + elif case == 'ambiguous': + binding.with_name('second.json').write_text(json.dumps({**data, 'ref': 'stable'})) + elif case == 'different-revision': + data['commit'] = 'c' * 40 + elif case == 'dirty': + (build / 'module.py').write_text('version = 2\n') + elif case == 'local-checkout': + local = home.parent / 'local' + build.rename(local) + dist = next(project.glob('.venv/lib/python*/site-packages/*.dist-info')) + (dist / 'direct_url.json').write_text(json.dumps({'url': local.as_uri(), 'dir_info': {}})) + elif case == 'other-generation': + other = environments.receipt_directory(home, 'd' * 32) / 'foundation/cache/.source-bindings' + other.mkdir(parents=True) + binding.rename(other / binding.name) + assert not dependency(home)['eligible'] + return + binding.write_text(json.dumps(data)) + assert not dependency(home)['eligible'] + + +def test_recorded_explicit_pin_wins_over_shared_binding(shared_build): + home, generation, receipt, project, build, binding, revision = shared_build + policy = environments.shared_build_policies(home, generation, installed_graph(project)) + policy['amplifier-fixture']['ref'] = revision + (receipt / 'runtime-sources.json').write_text(json.dumps(policy)) + assert not dependency(home)['eligible'] diff --git a/tests/test_update_generations.py b/tests/test_update_generations.py index 3092ca913..8de18c072 100644 --- a/tests/test_update_generations.py +++ b/tests/test_update_generations.py @@ -114,6 +114,9 @@ async def test_inventory_reuses_index_and_invalidates_on_configuration_change( (shared / "settings.yaml").write_text("bundle: {active: foundation}") await inventory(manager, scan) assert scan.await_count == 2 + monkeypatch.setattr("amplifier_web.__version__", "next-fixture-release") + await inventory(manager, scan) + assert scan.await_count == 3 # New inventory rules cannot reuse old app results. def test_offered_profiles_ignore_history_and_behavior_names(tmp_path): diff --git a/uv.lock b/uv.lock index 9eed54929..9046ad6fb 100644 --- a/uv.lock +++ b/uv.lock @@ -189,7 +189,7 @@ dependencies = [ [[package]] name = "amplifier-unified" -version = "0.20.45" +version = "0.20.46" source = { editable = "." } dependencies = [ { name = "aiohttp" },